[fltk.commit] [Library] r9895 - branches/branch-3.0/src/fltk3
Author: manolo Date: 2013-04-21 08:45:37 -0700 (Sun, 21 Apr 2013) New Revision: 9895 Log: Some improvement in memory allocation for function create_default_drag_image(). Modified: branches/branch-3.0/src/fltk3/cocoa.mm Modified: branches/branch-3.0/src/fltk3/cocoa.mm === --- branches/branch-3.0/src/fltk3/cocoa.mm 2013-04-20 22:16:03 UTC (rev 9894) +++ branches/branch-3.0/src/fltk3/cocoa.mm 2013-04-21 15:45:37 UTC (rev 9895) @@ -3220,6 +3220,8 @@ } static fltk3::Image *create_default_drag_image() +/* Creates a small image that can be used when dragging from an FLTK widget. + */ { const int version_threshold = 100700; int width, height; @@ -3236,21 +3238,22 @@ char str[4]; int l = fltk3::utf8encode(0x1F69A, str); // the Delivery truck Unicode character from Apple Color Emoji font fltk3::draw(str, l, 1, 16); -fl_end_offscreen(); } else { -CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); +CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); // draw two nested squares fltk3::rectf(0,0,width,height); CGContextSetRGBStrokeColor( (CGContextRef)off, 0,0,0,0.6); fltk3::rect(0,0,width,height); fltk3::rect(2,2,width-4,height-4); } + fl_end_offscreen(); CGContextRef c = (CGContextRef)off; unsigned char *pdata = (unsigned char *)CGBitmapContextGetData(c); fltk3::Image *img = new fltk3::RGBImage(pdata, CGBitmapContextGetWidth(c), CGBitmapContextGetHeight(c), 4); - img = img-copy(); + fltk3::Image *img2 = img-copy(); + delete img; fl_delete_offscreen(off); - return img; + return img2; } ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9894 - branches/branch-1.3/src
Author: manolo Date: 2013-04-20 15:16:03 -0700 (Sat, 20 Apr 2013) New Revision: 9894 Log: Use the new Fl_Window* Fl_Widget::top_window() member function. Modified: branches/branch-1.3/src/Fl_cocoa.mm Modified: branches/branch-1.3/src/Fl_cocoa.mm === --- branches/branch-1.3/src/Fl_cocoa.mm 2013-04-19 13:52:28 UTC (rev 9893) +++ branches/branch-1.3/src/Fl_cocoa.mm 2013-04-20 22:16:03 UTC (rev 9894) @@ -3275,12 +3275,7 @@ [mypasteboard setData:(NSData*)text forType:@public.utf8-plain-text]; CFRelease(text); Fl_Widget *w = Fl::pushed(); - Fl_Window *win = w-window(); - if (win == NULL) { -win = (Fl_Window*)w; - } else { -while(win-window()) win = win-window(); - } + Fl_Window *win = w-top_window(); NSView *myview = [Fl_X::i(win)-xid contentView]; NSEvent *theEvent = [NSApp currentEvent]; ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9892 - branches/branch-1.3/src
Author: manolo Date: 2013-04-19 02:20:56 -0700 (Fri, 19 Apr 2013) New Revision: 9892 Log: Cosmetic improvement of image used when dragging non-text data. Minimum OS version has been verified. Modified: branches/branch-1.3/src/Fl_cocoa.mm Modified: branches/branch-1.3/src/Fl_cocoa.mm === --- branches/branch-1.3/src/Fl_cocoa.mm 2013-04-18 16:15:59 UTC (rev 9891) +++ branches/branch-1.3/src/Fl_cocoa.mm 2013-04-19 09:20:56 UTC (rev 9892) @@ -3191,7 +3191,7 @@ fl_font(FL_HELVETICA, 10); p = text; int nl = 0; - while((q=strchr(p, '\n')) != NULL) { + while(nl 100 (q=strchr(p, '\n')) != NULL) { nl++; w2 = int(fl_width(p, q - p)); if (w2 width) width = w2; @@ -3232,7 +3232,7 @@ static NSImage *defaultDragImage(int *pwidth, int *pheight) { - const int version_threshold = 100800; + const int version_threshold = 100700; int width, height; if (fl_mac_os_version = version_threshold) { width = 50; height = 40; @@ -3246,7 +3246,7 @@ fl_font(FL_HELVETICA, 20); fl_color(FL_BLACK); char str[4]; -int l = fl_utf8encode(0x1F69A, str); // the Delivery truck Unicode character +int l = fl_utf8encode(0x1F69A, str); // the Delivery truck Unicode character from Apple Color Emoji font fl_draw(str, l, 1, 16); } else { // draw two squares ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9893 - in branches/branch-3.0: include/fltk3 src/fltk3
Author: manolo Date: 2013-04-19 06:52:28 -0700 (Fri, 19 Apr 2013) New Revision: 9893 Log: Added default image usable when dragging data out of a widget. Modified: branches/branch-3.0/include/fltk3/run.h branches/branch-3.0/src/fltk3/cocoa.mm Modified: branches/branch-3.0/include/fltk3/run.h === --- branches/branch-3.0/include/fltk3/run.h 2013-04-19 09:20:56 UTC (rev 9892) +++ branches/branch-3.0/include/fltk3/run.h 2013-04-19 13:52:28 UTC (rev 9893) @@ -761,6 +761,9 @@ copy/cut/paste operations. */ void paste(fltk3::Widget receiver, int source /*=0*/); // platform dependent +#if defined(__APPLE__) + extern fltk3::Image *default_drag_image; +#endif /** Initiate a Drag And Drop operation. The selection buffer should be filled with relevant data before calling this method. FLTK will @@ -772,8 +775,9 @@ On the Mac OS platform, the \p dragimage optional argument sets the image to use as a cursor when dragging. - If no (or a NULL) dragging image is used, the text - data in the selection buffer is used to build the cursor. + If no (or a NULL) argument is used, the text in the selection buffer is used to build the cursor. + Otherwise, the argument is the image to use as a cursor; + the variable fltk3::Image *fltk3::default_drag_image is an adequate default drag image. */ int dnd( #if defined(__APPLE__) || defined(FL_DOXYGEN) Modified: branches/branch-3.0/src/fltk3/cocoa.mm === --- branches/branch-3.0/src/fltk3/cocoa.mm 2013-04-19 09:20:56 UTC (rev 9892) +++ branches/branch-3.0/src/fltk3/cocoa.mm 2013-04-19 13:52:28 UTC (rev 9893) @@ -88,6 +88,7 @@ static fltk3::Region MacRegionMinusRect(fltk3::Region r, int x,int y,int w,int h); static void cocoaMouseHandler(NSEvent *theEvent); static int calc_mac_os_version(); +static fltk3::Image *create_default_drag_image(); static fltk3::DisplayDevice fl_quartz_display(new fltk3::QuartzGraphicsDriver); @@ -101,6 +102,7 @@ fltk3::Window *fltk3::Window::current_; int fl_mac_os_version = calc_mac_os_version(); // the version number of the running Mac OS X (e.g., 100604 for 10.6.4) static SEL inputContextSEL = (fl_mac_os_version = 100600 ? @selector(inputContext) : @selector(FLinputContext)); +fltk3::Image *fltk3::default_drag_image = create_default_drag_image(); // forward declarations of variables in this file static int got_events = 0; @@ -3217,6 +3219,41 @@ return image; } +static fltk3::Image *create_default_drag_image() +{ + const int version_threshold = 100700; + int width, height; + if (fl_mac_os_version = version_threshold) { +width = 50; height = 40; + } + else { +width = 16; height = 16; + } + fltk3::Offscreen off = fltk3::QuartzGraphicsDriver::create_offscreen_with_alpha(width, height); + fl_begin_offscreen(off); + if (fl_mac_os_version = version_threshold) { +fltk3::font(fltk3::HELVETICA, 20); +char str[4]; +int l = fltk3::utf8encode(0x1F69A, str); // the Delivery truck Unicode character from Apple Color Emoji font +fltk3::draw(str, l, 1, 16); +fl_end_offscreen(); +} + else { +CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); +fltk3::rectf(0,0,width,height); +CGContextSetRGBStrokeColor( (CGContextRef)off, 0,0,0,0.6); +fltk3::rect(0,0,width,height); +fltk3::rect(2,2,width-4,height-4); + } + CGContextRef c = (CGContextRef)off; + unsigned char *pdata = (unsigned char *)CGBitmapContextGetData(c); + fltk3::Image *img = new fltk3::RGBImage(pdata, CGBitmapContextGetWidth(c), CGBitmapContextGetHeight(c), 4); + img = img-copy(); + fl_delete_offscreen(off); + return img; + } + + int fltk3::dnd(fltk3::Image* dragimage) { CFDataRef text = CFDataCreate(kCFAllocatorDefault, (UInt8*)fl_selection_buffer[0], fl_selection_length[0]); ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9891 - branches/branch-1.3/src
Author: manolo Date: 2013-04-18 09:15:59 -0700 (Thu, 18 Apr 2013) New Revision: 9891 Log: Cosmetic improvement of image used when dragging non-text data. Minimum OS version still has to be verified. Modified: branches/branch-1.3/src/Fl_cocoa.mm Modified: branches/branch-1.3/src/Fl_cocoa.mm === --- branches/branch-1.3/src/Fl_cocoa.mm 2013-04-17 16:37:24 UTC (rev 9890) +++ branches/branch-1.3/src/Fl_cocoa.mm 2013-04-18 16:15:59 UTC (rev 9891) @@ -3232,14 +3232,30 @@ static NSImage *defaultDragImage(int *pwidth, int *pheight) { - const int width = 16, height = 16; + const int version_threshold = 100800; + int width, height; + if (fl_mac_os_version = version_threshold) { +width = 50; height = 40; +} + else { +width = 16; height = 16; +} Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(width, height); fl_begin_offscreen(off); - CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); - fl_rectf(0,0,width,height); - CGContextSetRGBStrokeColor( (CGContextRef)off, 0,0,0,0.6); - fl_rect(0,0,width,height); - fl_rect(2,2,width-4,height-4); + if (fl_mac_os_version = version_threshold) { +fl_font(FL_HELVETICA, 20); +fl_color(FL_BLACK); +char str[4]; +int l = fl_utf8encode(0x1F69A, str); // the Delivery truck Unicode character +fl_draw(str, l, 1, 16); +} + else { // draw two squares +CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); +fl_rectf(0,0,width,height); +CGContextSetRGBStrokeColor( (CGContextRef)off, 0,0,0,0.6); +fl_rect(0,0,width,height); +fl_rect(2,2,width-4,height-4); + } fl_end_offscreen(); NSImage* image = CGBitmapContextToNSImage( (CGContextRef)off ); fl_delete_offscreen( off ); ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9888 - branches/branch-1.3/documentation
Author: manolo Date: 2013-04-17 00:50:23 -0700 (Wed, 17 Apr 2013) New Revision: 9888 Log: Have file src/Fl_Sys_Menu_Bar.mm processed by Doxygen. Modified: branches/branch-1.3/documentation/Doxyfile Modified: branches/branch-1.3/documentation/Doxyfile === --- branches/branch-1.3/documentation/Doxyfile 2013-04-17 07:45:31 UTC (rev 9887) +++ branches/branch-1.3/documentation/Doxyfile 2013-04-17 07:50:23 UTC (rev 9888) @@ -577,7 +577,8 @@ src/development.dox \ src/license.dox \ src/examples.dox \ - src/faq.dox + src/faq.dox \ +../src/Fl_Sys_Menu_Bar.mm # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9889 - branches/branch-1.3/src
Author: manolo Date: 2013-04-17 05:06:04 -0700 (Wed, 17 Apr 2013) New Revision: 9889 Log: Removed some unnecessary data duplication. Modified: branches/branch-1.3/src/Fl_Sys_Menu_Bar.mm Modified: branches/branch-1.3/src/Fl_Sys_Menu_Bar.mm === --- branches/branch-1.3/src/Fl_Sys_Menu_Bar.mm 2013-04-17 07:50:23 UTC (rev 9888) +++ branches/branch-1.3/src/Fl_Sys_Menu_Bar.mm 2013-04-17 12:06:04 UTC (rev 9889) @@ -69,7 +69,7 @@ @implementation FLMenuItem - (const Fl_Menu_Item*) getFlItem { - return *(const Fl_Menu_Item **)[(NSData*)[self representedObject] bytes]; + return (const Fl_Menu_Item *)[(NSData*)[self representedObject] bytes]; } - (void) doCallback:(id)unused { @@ -134,7 +134,7 @@ FLMenuItem *item = [[FLMenuItem alloc] initWithTitle:(NSString*)cfname action:@selector(doCallback:) keyEquivalent:@]; - NSData *pointer = [NSData dataWithBytes:mitem length:sizeof(Fl_Menu_Item*)]; + NSData *pointer = [NSData dataWithBytesNoCopy:(void*)mitem length:sizeof(Fl_Menu_Item) freeWhenDone:NO]; [item setRepresentedObject:pointer]; [menu addItem:item]; CFRelease(cfname); ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9890 - branches/branch-3.0/src/fltk3
Author: manolo Date: 2013-04-17 09:37:24 -0700 (Wed, 17 Apr 2013) New Revision: 9890 Log: Removed some unnecessary data duplication and update describing comments. Modified: branches/branch-3.0/src/fltk3/cocoaSysMenuBar.mm Modified: branches/branch-3.0/src/fltk3/cocoaSysMenuBar.mm === --- branches/branch-3.0/src/fltk3/cocoaSysMenuBar.mm2013-04-17 12:06:04 UTC (rev 9889) +++ branches/branch-3.0/src/fltk3/cocoaSysMenuBar.mm2013-04-17 16:37:24 UTC (rev 9890) @@ -25,31 +25,23 @@ // http://www.fltk.org/str.php // -/** +/* * This code is a quick hack! It was written as a proof of concept. * It has been tested on the menubar sample program and provides * basic functionality. * - * To use the System Menu Bar, simply replace the main fltk3::MenuBar - * in an application with fltk3::SysMenuBar. + * To use the System Menu Bar, simply replace the main Fl_Menu_Bar + * in an application with Fl_Sys_Menu_Bar. * * FLTK features not supported by the Mac System menu * - * - no invisible menu items * - no symbolic labels - * - embossed labels will be underlined instead + * - no embossed labels * - no font sizes - * - Shortcut Characters should be English alphanumeric only, no modifiers yet + * - Shortcut Characters should be Latin letters only * - no disable main menus - * - changes to menubar in run-time don't update! - * (disable, etc. - toggle and radio button do!) * - * No care was taken to clean up the menu bar after destruction! - * ::menu(bar) should only be called once! * Many other calls of the parent class don't work. - * Changing the menu items has no effect on the menu bar. - * Starting with OS X 10.5, FLTK applications must be created as - * a bundle for the System Menu Bar (and maybe other features) to work! */ #if defined(__APPLE__) || defined(FLTK3_DOXYGEN) @@ -82,7 +74,7 @@ @implementation FLMenuItem - (const fltk3::MenuItem*) getFlItem { - return *(const fltk3::MenuItem **)[(NSData*)[self representedObject] bytes]; + return (const fltk3::MenuItem *)[(NSData*)[self representedObject] bytes]; } - (void) doCallback:(id)unused { @@ -143,7 +135,7 @@ FLMenuItem *item = [[FLMenuItem alloc] initWithTitle:cfname action:@selector(doCallback:) keyEquivalent:@]; - NSData *pointer = [NSData dataWithBytes:mitem length:sizeof(fltk3::MenuItem*)]; + NSData *pointer = [NSData dataWithBytesNoCopy:(void*)mitem length:sizeof(fltk3::MenuItem) freeWhenDone:NO]; [item setRepresentedObject:pointer]; [menu addItem:item]; [item setTarget:item]; ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9884 - branches/branch-1.3/src
Author: ianmacarthur Date: 2013-04-16 05:02:23 -0700 (Tue, 16 Apr 2013) New Revision: 9884 Log: Apply the *nix file-chooser patches from STR #2935. Modified: branches/branch-1.3/src/Fl_File_Browser.cxx Modified: branches/branch-1.3/src/Fl_File_Browser.cxx === --- branches/branch-1.3/src/Fl_File_Browser.cxx 2013-04-15 13:47:58 UTC (rev 9883) +++ branches/branch-1.3/src/Fl_File_Browser.cxx 2013-04-16 12:02:23 UTC (rev 9884) @@ -62,6 +62,33 @@ # include sys/mount.h #endif // __APPLE__ +#if defined(_AIX) +extern C { +# include sys/types.h +# include sys/vmount.h +# include sys/mntctl.h + // Older AIX versions don't expose this prototype + int + mntctl(int, int, char *); +} +#endif // _AIX + +#if defined(__NetBSD__) +extern C { +# include sys/param.h // For '__NetBSD_Version__' definition +# if defined(__NetBSD_Version__) (__NetBSD_Version__ = 3) +#include sys/types.h +#include sys/statvfs.h +#if defined(HAVE_PTHREAD) defined(HAVE_PTHREAD_H) +# include pthread.h +#endif // HAVE_PTHREAD HAVE_PTHREAD_H +#ifdef HAVE_PTHREAD + static pthread_mutex_t getvfsstat_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif // HAVE_PTHREAD/ +# endif // __NetBSD_Version__ +} +#endif // __NetBSD__ + // // FL_BLINE definition from Fl_Browser.cxx... // @@ -522,6 +549,77 @@ // Free the memory used for the file system info array... delete[] fs; } +#elif defined(_AIX) +// AIX don't write the mounted filesystems to a file like '/etc/mnttab'. +// But reading the list of mounted filesystems from the kernel is possible: +// http://publib.boulder.ibm.com/infocenter/pseries/v5r3/topic/com.ibm.aix.basetechref/doc/basetrf1/mntctl.htm +int res = -1, len; +char *list = NULL, *name; +struct vmount *vp; + +// We always have the root filesystem +add(/, icon); +// Get the required buffer size for the vmount structures +res = mntctl(MCTL_QUERY, sizeof(len), (char *) len); +if (!res) { + // Allocate buffer ... + list = (char *) malloc((size_t) len); + if (NULL == list) { +res = -1; + } else { +// ... and read vmount structures from kernel +res = mntctl(MCTL_QUERY, len, list); +if (0 = res) { + res = -1; +} else { + for (i = 0, vp = (struct vmount *) list; i res; ++i) { +name = (char *) vp + vp-vmt_data[VMT_STUB].vmt_off; +strlcpy(filename, name, sizeof(filename)); +// Skip the already added root filesystem +if (strcmp(/, filename) != 0) { + strlcat(filename, /, sizeof(filename)); + add(filename, icon); +} +vp = (struct vmount *) ((char *) vp + vp-vmt_length); + } +} + } +} +// Note: Executing 'free(NULL)' is allowed and simply do nothing +free((void *) list); +#elif defined(__NetBSD__) defined(__NetBSD_Version__) \ + (__NetBSD_Version__ = 3) +// NetBSD don't write the mounted filesystems to a file like '/etc/mnttab'. +// Since NetBSD 3.0 the system call getvfsstat(2) has replaced getfsstat(2) +// that is used by getmntinfo(3): +// http://www.daemon-systems.org/man/getmntinfo.3.html +int res = -1; +struct statvfs *list; + +// We always have the root filesystem +add(/, icon); +# ifdef HAVE_PTHREAD +// Lock mutex for thread safety +if (!pthread_mutex_lock(getvfsstat_mutex)) { +# endif // HAVE_PTHREAD + // Get list of statvfs structures + res = getmntinfo(list, ST_WAIT); + if(0 res) { +for (i = 0; i res; ++i) { + strlcpy(filename, list[i].f_mntonname, sizeof(filename)); + // Skip the already added root filesystem + if (strcmp(/, filename) != 0) { +strlcat(filename, /, sizeof(filename)); +add(filename, icon); + } +} + } else { + res = -1; + } +# ifdef HAVE_PTHREAD + pthread_mutex_unlock(getvfsstat_mutex); +} +# endif // HAVE_PTHREAD #else // // UNIX code uses /etc/fstab or similar... @@ -550,7 +648,10 @@ if (sscanf(line, %*s%4095s, filename) != 1) continue; -strlcat(filename, /, sizeof(filename)); +// Add a trailing slash (except for the root filesystem) +if (strcmp(/, filename) != 0) { + strlcat(filename, /, sizeof(filename)); +} //printf(Fl_File_Browser::load() - adding \%s\ to list...\n, filename); add(filename, icon); @@ -558,8 +659,13 @@ } fclose(mtab); +} else { + // Every Unix has a root filesystem '/'. + // This last stage fallback ensures that the user don't get an empty + // window after requesting filesystem list. + add(/, icon); } -#endif // WIN32 || __EMX__ +#endif // WIN32 || __EMX__ || __APPLE__ || _AIX || ... } else {
[fltk.commit] [Library] r9885 - in branches/branch-1.3: FL ide/Xcode3/FLTK.xcodeproj ide/Xcode4/FLTK.xcodeproj src
Author: manolo Date: 2013-04-16 07:02:42 -0700 (Tue, 16 Apr 2013) New Revision: 9885 Log: Renamed src/Fl_Sys_Menu_Bar.cxx to src/Fl_Sys_Menu_Bar.mm because objective-c code is used. Some code is transferred from Fl_cocoa.mm thus reducing somewhat this very large source file. Added: branches/branch-1.3/src/Fl_Sys_Menu_Bar.mm Removed: branches/branch-1.3/src/Fl_Sys_Menu_Bar.cxx Modified: branches/branch-1.3/FL/mac.H branches/branch-1.3/ide/Xcode3/FLTK.xcodeproj/project.pbxproj branches/branch-1.3/ide/Xcode4/FLTK.xcodeproj/project.pbxproj branches/branch-1.3/src/Fl_cocoa.mm branches/branch-1.3/src/Makefile Modified: branches/branch-1.3/FL/mac.H === --- branches/branch-1.3/FL/mac.H2013-04-16 12:02:23 UTC (rev 9884) +++ branches/branch-1.3/FL/mac.H2013-04-16 14:02:42 UTC (rev 9885) @@ -83,7 +83,6 @@ free(r); } } -extern void *fl_system_menu; extern void *fl_default_cursor; // This object contains all mac-specific stuff about a window: Modified: branches/branch-1.3/ide/Xcode3/FLTK.xcodeproj/project.pbxproj === --- branches/branch-1.3/ide/Xcode3/FLTK.xcodeproj/project.pbxproj 2013-04-16 12:02:23 UTC (rev 9884) +++ branches/branch-1.3/ide/Xcode3/FLTK.xcodeproj/project.pbxproj 2013-04-16 14:02:42 UTC (rev 9885) @@ -134,7 +134,6 @@ 319E158B9FA80488D676A040 /* fltk_jpeg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C39FA04F3B7CD8E53876D0F4 /* fltk_jpeg.framework */; }; 31F6473A9B5FD4FFB078BA78 /* fltk.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FEB0F8FE6383384180570D94 /* fltk.framework */; }; 3222D7D927BF1220D08F1DF8 /* fltk.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = FEB0F8FE6383384180570D94 /* fltk.framework */; }; - 32824BE9A80F72339A5B441F /* Fl_Sys_Menu_Bar.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 30662FB4292F9C613576933B /* Fl_Sys_Menu_Bar.cxx */; }; 33175A3FB04A133479A558BA /* pngwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = 11A4DF1725F38E4341C5C663 /* pngwrite.c */; }; 339D0DFC256DE06A10F214B3 /* Fl_Wizard.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 9951B49F640C2C15321EED9C /* Fl_Wizard.cxx */; }; 33FCC793A92F544711E09A1E /* fltk_png.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98A16A4EC098BA7DB21E13DC /* fltk_png.framework */; }; @@ -328,6 +327,7 @@ 7F66B1D912BB924C00C67B59 /* Fl_cocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7F66B1D612BB924C00C67B59 /* Fl_cocoa.mm */; }; 7F66B1DA12BB924C00C67B59 /* Fl_Native_File_Chooser_MAC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7F66B1D712BB924C00C67B59 /* Fl_Native_File_Chooser_MAC.mm */; }; 7F66B1DB12BB924C00C67B59 /* Fl_Quartz_Printer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7F66B1D812BB924C00C67B59 /* Fl_Quartz_Printer.mm */; }; + 7FFDE4AD171D8AA3008753A3 /* Fl_Sys_Menu_Bar.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7FFDE4AC171D8AA3008753A3 /* Fl_Sys_Menu_Bar.mm */; }; 812129561A1981D6DEFBCBFB /* Fl_Positioner.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 05BBBFE4BED0452E5D6A81F7 /* Fl_Positioner.cxx */; }; 812761E94039F13357F56EE6 /* fltk_png.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 98A16A4EC098BA7DB21E13DC /* fltk_png.framework */; }; 813BAC8244B19F51594C89C4 /* pngrio.c in Sources */ = {isa = PBXBuildFile; fileRef = D33C668435685F7CCB359EE2 /* pngrio.c */; }; @@ -4155,7 +4155,6 @@ 2DD93178E8AFA850DAC293FC /* fl_dnd.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_dnd.cxx; path = ../../src/fl_dnd.cxx; sourceTree = SOURCE_ROOT; }; 2DE25DB4CE986C1857B5ECF7 /* Fl_Native_File_Chooser.cxx */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; name = Fl_Native_File_Chooser.cxx; path = ../../src/Fl_Native_File_Chooser.cxx; sourceTree = SOURCE_ROOT; }; 2E774D7FE17DC45AFDF985FE /* message.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = message.cxx; path = ../../test/message.cxx; sourceTree = SOURCE_ROOT; }; - 30662FB4292F9C613576933B /* Fl_Sys_Menu_Bar.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Sys_Menu_Bar.cxx; path = ../../src/Fl_Sys_Menu_Bar.cxx; sourceTree = SOURCE_ROOT; }; 31D736821E68F01A1A11FC9F /* Fl_Help_View.H */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = Fl_Help_View.H; path = ../../FL/Fl_Help_View.H; sourceTree = SOURCE_ROOT; };
[fltk.commit] [Library] r9886 - branches/branch-1.3/src
Author: manolo Date: 2013-04-16 07:11:21 -0700 (Tue, 16 Apr 2013) New Revision: 9886 Log: Renamed src/Fl_Sys_Menu_Bar.cxx to src/Fl_Sys_Menu_Bar.mm because objective-c code is used (cont'd). Modified: branches/branch-1.3/src/CMakeLists.txt Modified: branches/branch-1.3/src/CMakeLists.txt === --- branches/branch-1.3/src/CMakeLists.txt 2013-04-16 14:02:42 UTC (rev 9885) +++ branches/branch-1.3/src/CMakeLists.txt 2013-04-16 14:11:21 UTC (rev 9886) @@ -33,7 +33,6 @@ Fl_Menu.cxx Fl_Menu_.cxx Fl_Menu_Bar.cxx - Fl_Sys_Menu_Bar.cxx Fl_Menu_Button.cxx Fl_Menu_Window.cxx Fl_Menu_add.cxx @@ -199,6 +198,7 @@ Fl_cocoa.mm Fl_Quartz_Printer.mm Fl_Native_File_Chooser_MAC.mm + Fl_Sys_Menu_Bar.mm ) else() set(MMFILES ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9878 - branches/branch-1.3/src
Author: manolo Date: 2013-04-15 04:00:24 -0700 (Mon, 15 Apr 2013) New Revision: 9878 Log: Reduced the usage of global variables. Modified: branches/branch-1.3/src/Fl_cocoa.mm Modified: branches/branch-1.3/src/Fl_cocoa.mm === --- branches/branch-1.3/src/Fl_cocoa.mm 2013-04-12 23:30:55 UTC (rev 9877) +++ branches/branch-1.3/src/Fl_cocoa.mm 2013-04-15 11:00:24 UTC (rev 9878) @@ -91,9 +91,7 @@ static void cocoaMouseHandler(NSEvent *theEvent); static int calc_mac_os_version(); -static Fl_Quartz_Graphics_Driver fl_quartz_driver; -static Fl_Display_Device fl_quartz_display(fl_quartz_driver); -Fl_Display_Device *Fl_Display_Device::_display = fl_quartz_display; // the platform display +Fl_Display_Device *Fl_Display_Device::_display = new Fl_Display_Device(new Fl_Quartz_Graphics_Driver); // the platform display // public variables CGContextRef fl_gc = 0; @@ -924,20 +922,7 @@ } @end -/* - * Open callback function to call... - */ -static void(*open_cb)(const char *) = 0; -/* - * Install an open documents event handler... - */ -void fl_open_callback(void (*cb)(const char *)) { - fl_open_display(); - open_cb = cb; -} - - @interface FLWindowDelegate : NSObject #if MAC_OS_X_VERSION_MAX_ALLOWED = MAC_OS_X_VERSION_10_6 NSWindowDelegate @@ -1091,6 +1076,7 @@ #endif { BOOL seen_open_file; + void (*open_cb)(const char*); } - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender; - (void)applicationDidBecomeActive:(NSNotification *)notify; @@ -1100,6 +1086,7 @@ - (void)applicationWillUnhide:(NSNotification *)notify; - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename; - (void)applicationDidFinishLaunching:(NSNotification *)aNotification; +- (void)open_cb:(void (*)(const char*))cb; @end @implementation FLAppDelegate - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender @@ -1250,8 +1237,20 @@ // under Mac OS 10.8 when a file is dragged on the application icon if (fl_mac_os_version = 100800 seen_open_file) [[NSApp mainWindow] orderFront:self]; } +- (void)open_cb:(void (*)(const char*))cb +{ + open_cb = cb; +} @end +/* + * Install an open documents event handler... + */ +void fl_open_callback(void (*cb)(const char *)) { + fl_open_display(); + [[NSApp delegate] open_cb:cb]; +} + @implementation FLApplication + (void)sendEvent:(NSEvent *)theEvent { ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9879 - branches/branch-3.0/test
Author: manolo Date: 2013-04-15 04:42:16 -0700 (Mon, 15 Apr 2013) New Revision: 9879 Log: Added call of fl_open_callback() by the editor demo. Modified: branches/branch-3.0/test/editor.cxx Modified: branches/branch-3.0/test/editor.cxx === --- branches/branch-3.0/test/editor.cxx 2013-04-15 11:00:24 UTC (rev 9878) +++ branches/branch-3.0/test/editor.cxx 2013-04-15 11:42:16 UTC (rev 9879) @@ -798,16 +798,22 @@ return w; } +void cb(const char *fname) { + load_file(fname, -1); +} + int main(int argc, char **argv) { textbuf = new fltk3::TextBuffer; //textbuf-transcoding_warning_action = NULL; style_init(); - + fl_open_callback(cb); + fltk3::Window* window = new_view(); window-show(1, argv); - +#ifndef __APPLE__ if (argc 1) load_file(argv[1], -1); +#endif return fltk3::run(); } ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9880 - branches/branch-3.0/ide/Xcode4/plists
Author: manolo Date: 2013-04-15 04:43:52 -0700 (Mon, 15 Apr 2013) New Revision: 9880 Log: The editor demo accepts file drag and drop on program icon. Modified: branches/branch-3.0/ide/Xcode4/plists/editor-Info.plist Modified: branches/branch-3.0/ide/Xcode4/plists/editor-Info.plist === --- branches/branch-3.0/ide/Xcode4/plists/editor-Info.plist 2013-04-15 11:42:16 UTC (rev 9879) +++ branches/branch-3.0/ide/Xcode4/plists/editor-Info.plist 2013-04-15 11:43:52 UTC (rev 9880) @@ -4,6 +4,23 @@ dict keyCFBundleDevelopmentRegion/key stringEnglish/string + keyCFBundleDocumentTypes/key + array + dict + keyCFBundleTypeExtensions/key + array + string*/string + /array + keyCFBundleTypeName/key + stringAllFiles/string + keyCFBundleTypeRole/key + stringEditor/string + keyLSTypeIsPackage/key + false/ + keyNSPersistentStoreTypeKey/key + stringXML/string + /dict + /array keyCFBundleExecutable/key string${EXECUTABLE_NAME}/string keyCFBundleIdentifier/key ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9881 - branches/branch-3.0/src/fltk3
Author: manolo Date: 2013-04-15 04:45:23 -0700 (Mon, 15 Apr 2013) New Revision: 9881 Log: Reduced the usage of global variables. Modified: branches/branch-3.0/src/fltk3/cocoa.mm Modified: branches/branch-3.0/src/fltk3/cocoa.mm === --- branches/branch-3.0/src/fltk3/cocoa.mm 2013-04-15 11:43:52 UTC (rev 9880) +++ branches/branch-3.0/src/fltk3/cocoa.mm 2013-04-15 11:45:23 UTC (rev 9881) @@ -89,8 +89,7 @@ static void cocoaMouseHandler(NSEvent *theEvent); static int calc_mac_os_version(); -static fltk3::QuartzGraphicsDriver fl_quartz_driver; -static fltk3::DisplayDevice fl_quartz_display(fl_quartz_driver); +static fltk3::DisplayDevice fl_quartz_display(new fltk3::QuartzGraphicsDriver); // public variables CGContextRef fl_gc = 0; @@ -901,21 +900,7 @@ } @end -/* - * Open callback function to call... - */ -static void(*open_cb)(const char *) = 0; - -/* - * Install an open documents event handler... - */ -void fl_open_callback(void (*cb)(const char *)) { - fl_open_display(); - open_cb = cb; -} - - @interface FLWindowDelegate : NSObject #if MAC_OS_X_VERSION_MAX_ALLOWED = MAC_OS_X_VERSION_10_6 NSWindowDelegate @@ -1068,6 +1053,7 @@ #endif { BOOL seen_open_file; + void (*open_cb)(const char*); } - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender; - (void)applicationDidBecomeActive:(NSNotification *)notify; @@ -1077,6 +1063,7 @@ - (void)applicationWillUnhide:(NSNotification *)notify; - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename; - (void)applicationDidFinishLaunching:(NSNotification *)aNotification; +- (void)open_cb:(void (*)(const char*))cb; @end @implementation FLAppDelegate - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender @@ -1227,8 +1214,20 @@ // under Mac OS 10.8 when a file is dragged on the application icon if (fl_mac_os_version = 100800 seen_open_file) [[NSApp mainWindow] orderFront:self]; } +- (void)open_cb:(void (*)(const char*))cb +{ + open_cb = cb; +} @end +/* + * Install an open documents event handler... + */ +void fl_open_callback(void (*cb)(const char *)) { + fl_open_display(); + [[NSApp delegate] open_cb:cb]; +} + @implementation FLApplication + (void)sendEvent:(NSEvent *)theEvent { ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9883 - branches/branch-3.0/src/fltk3
Author: manolo Date: 2013-04-15 06:47:58 -0700 (Mon, 15 Apr 2013) New Revision: 9883 Log: Removed processing of obsolete deadkey flag. Modified: branches/branch-3.0/src/fltk3/cocoa.mm Modified: branches/branch-3.0/src/fltk3/cocoa.mm === --- branches/branch-3.0/src/fltk3/cocoa.mm 2013-04-15 13:34:46 UTC (rev 9882) +++ branches/branch-3.0/src/fltk3/cocoa.mm 2013-04-15 13:47:58 UTC (rev 9883) @@ -1668,9 +1668,6 @@ // In this mode, there seem to be no key-down codes // printf(%08x %08x %08x\n, keyCode, mods, key); maskedKeyCode = keyCode 0x7f; - if ([theEvent type] == NSKeyUp) { -fltk3::e_state = 0xbfff; // clear the deadkey flag - } mods_to_e_state( mods ); // process modifier keys sym = macKeyLookUp[maskedKeyCode]; if (sym 0xff00) { // a simple key ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [WWW] r687 - trunk/phplib
Author: greg.ercolano Date: 2013-04-13 05:19:08 -0700 (Sat, 13 Apr 2013) New Revision: 687 Log: Small fix to prevent articles from having article operations [Edit|Delete|etc..] dangling at the ends of article posting's sentences. Modified: trunk/phplib/common.php Modified: trunk/phplib/common.php === --- trunk/phplib/common.php 2013-02-17 12:03:51 UTC (rev 686) +++ trunk/phplib/common.php 2013-04-13 12:19:08 UTC (rev 687) @@ -731,7 +731,7 @@ print(h$headinga name='_USER_COMMENT_$row[id]'From/a .$display_name, $create_date (score=$row[status])/h$heading\n - .$contents\n); + .$contents\nbr); html_start_links(); ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9874 - branches/branch-1.3/src
Author: ianmacarthur Date: 2013-04-12 02:52:31 -0700 (Fri, 12 Apr 2013) New Revision: 9874 Log: fl_set_fonts_xft had a lower case, rather than upper case S in the switch so would not detect the SuperBold font style correctly. Also, do a bit of defensive clipping of the generated font name, in case we run off the end of the name buffer (if the input font name is infeasibly long...!) Modified: branches/branch-1.3/src/fl_set_fonts_xft.cxx Modified: branches/branch-1.3/src/fl_set_fonts_xft.cxx === --- branches/branch-1.3/src/fl_set_fonts_xft.cxx2013-04-10 21:19:10 UTC (rev 9873) +++ branches/branch-1.3/src/fl_set_fonts_xft.cxx2013-04-12 09:52:31 UTC (rev 9874) @@ -102,12 +102,16 @@ nm2 = strchr(nm1, ','); } raw[0] = ' '; raw[1] = 0; // Default start of raw name text - strncat(raw, nm1, LOCAL_RAW_NAME_MAX); + strncat(raw, nm1, LOCAL_RAW_NAME_MAX-1); // only copy MAX-1 chars, we have already set cell 0 + // Ensure raw is terminated, just in case the given name is infeasibly long... + raw[LOCAL_RAW_NAME_MAX-1] = 0; #else // keep the first remaining name entry char *nm2 = strchr(pretty, ','); if(nm2) *nm2 = 0; // terminate name after first entry raw[0] = ' '; raw[1] = 0; // Default start of raw name text - strncat(raw, pretty, LOCAL_RAW_NAME_MAX-1); + strncat(raw, pretty, LOCAL_RAW_NAME_MAX-1); // only copy MAX-1 chars, we have already set cell 0 + // Ensure raw is terminated, just in case the given name is infeasibly long... + raw[LOCAL_RAW_NAME_MAX-1] = 0; #endif // At this point, the name is marked as regular... if (style) @@ -153,14 +157,14 @@ mods |= ITALIC; } goto NEXT_STYLE; - - case 's': + + case 'S': if (strncasecmp(style, SuperBold, 9) == 0) { mods |= BOLD; } goto NEXT_STYLE; - + default: // find the next gap goto NEXT_STYLE; } // switch end @@ -202,17 +206,17 @@ { FcFontSet *fnt_set; // Will hold the list of fonts we find FcPattern *fnt_pattern; // Holds the generic match all names pattern - FcObjectSet *fnt_obj_set = 0; // Holds the generic match all objects - + FcObjectSet *fnt_obj_set = 0; // Holds the generic match all objects + int j; // loop iterator variable int font_count; // Total number of fonts found to process char **full_list; // The list of font names we build if (fl_free_font FL_FREE_FONT) // already been here return (Fl_Font)fl_free_font; - + fl_open_display(); // Just in case... - + // Make sure fontconfig is ready... is this necessary? The docs say it is // safe to call it multiple times, so just go for it anyway! if (!FcInit()) @@ -228,10 +232,10 @@ // pattern_name? fnt_pattern = FcPatternCreate(); fnt_obj_set = FcObjectSetBuild(FC_FAMILY, FC_STYLE, (void *)0); - + // Hopefully, this is a set of all the fonts... fnt_set = FcFontList(0, fnt_pattern, fnt_obj_set); - + // We don't need the fnt_pattern and fnt_obj_set any more, release them FcPatternDestroy(fnt_pattern); FcObjectSetDestroy(fnt_obj_set); @@ -242,22 +246,22 @@ char *stop; char *start; char *first; - + font_count = fnt_set-nfont; // How many fonts? - + // Allocate array of char*'s to hold the name strings full_list = (char **)malloc(sizeof(char *) * font_count); - + // iterate through all the font patterns and get the names out... for (j = 0; j font_count; j++) { // NOTE: FcChar8 is a typedef of unsigned char... FcChar8 *font; // String to hold the font's name - + // Convert from fontconfig internal pattern to human readable name // NOTE: This WILL malloc storage, so we need to free it later... font = FcNameUnparse(fnt_set-fonts[j]); - + // The returned strings look like this... // Century Schoolbook:style=Bold Italic,fed kursiv,Fett Kursiv,... // So the bit we want is up to the first comma - BUT some strings have @@ -300,13 +304,13 @@ if (reg) reg[1]='.'; } } - + // Release the fnt_set - we don't need it any more FcFontSetDestroy(fnt_set); - + // Sort the list into alphabetic order qsort(full_list, font_count, sizeof(*full_list), name_sort); - + // Now let us add the names we got to fltk's font list... for (j = 0; j font_count; j++) { @@ -321,7 +325,7 @@ stored_name = strdup(xft_name); Fl::set_font((Fl_Font)(j + FL_FREE_FONT), stored_name); fl_free_font ++; - + free(full_list[j]); // release that name from our internal array } } ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9875 - branches/branch-1.3/src
Author: greg.ercolano Date: 2013-04-12 09:46:35 -0700 (Fri, 12 Apr 2013) New Revision: 9875 Log: Small fixes to new top_window_offset() method as per discussion in STR #2948. Modified: branches/branch-1.3/src/Fl_Window.cxx Modified: branches/branch-1.3/src/Fl_Window.cxx === --- branches/branch-1.3/src/Fl_Window.cxx 2013-04-12 09:52:31 UTC (rev 9874) +++ branches/branch-1.3/src/Fl_Window.cxx 2013-04-12 16:46:35 UTC (rev 9875) @@ -107,19 +107,19 @@ } /** - Finds the x/y offset of the current window relative to the top-level window. + Finds the x/y offset of the current widget relative to the top-level window. \param[out] xoff,yoff Returns the x/y offset - \returns the top-level window + \returns the top-level window (or NULL for a widget that's not in any window) */ Fl_Window* Fl_Widget::top_window_offset(int xoff, int yoff) const { xoff = yoff = 0; - const Fl_Window *win = (const Fl_Window*)this; - while (win win-window()) { -xoff += win-x(); // accumulate offsets -yoff += win-y(); -win = win-window(); // walk up window hierarchy + const Fl_Widget *w = this; + while (w w-window()) { +xoff += w-x();// accumulate offsets +yoff += w-y(); +w = w-window(); // walk up window hierarchy } - return (Fl_Window*)win; + return ((Fl_Widget*)w)-as_window(); } /** Gets the x position of the window on the screen */ ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9877 - branches/branch-1.3/test
Author: AlbrechtS Date: 2013-04-12 16:30:55 -0700 (Fri, 12 Apr 2013) New Revision: 9877 Log: Add different selection_color()'s and tooltips to scheme test buttons. Modified: branches/branch-1.3/test/unittest_schemes.cxx Modified: branches/branch-1.3/test/unittest_schemes.cxx === --- branches/branch-1.3/test/unittest_schemes.cxx 2013-04-12 18:40:00 UTC (rev 9876) +++ branches/branch-1.3/test/unittest_schemes.cxx 2013-04-12 23:30:55 UTC (rev 9877) @@ -80,21 +80,28 @@ { Fl_Button* o = new Fl_Button(10, 9, 90, 25, button); o-box(FL_UP_BOX); o-color((Fl_Color)101); + o-tooltip(selection_color() = default); o-labelfont(5); } // Fl_Button* o { Fl_Button* o = new Fl_Button(10, 36, 90, 25, button); o-box(FL_UP_BOX); o-color((Fl_Color)179); + o-selection_color(o-color()); + o-tooltip(selection_color() = color()); o-labelfont(4); o-labelcolor(FL_BACKGROUND2_COLOR); } // Fl_Button* o { Fl_Button* o = new Fl_Button(10, 63, 90, 25, button); o-box(FL_UP_BOX); o-color((Fl_Color)91); + o-selection_color(fl_lighter(o-color())); + o-tooltip(selection_color() = fl_lighter(color())); } // Fl_Button* o { Fl_Button* o = new Fl_Button(10, 90, 90, 25, button); o-box(FL_UP_BOX); o-color(FL_INACTIVE_COLOR); + o-selection_color(fl_darker(o-color())); + o-tooltip(selection_color() = fl_darker(color())); o-labelcolor(FL_BACKGROUND2_COLOR); } // Fl_Button* o { Fl_Tabs* o = new Fl_Tabs(10, 120, 320, 215); ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9870 - in branches/branch-1.3: FL src
Author: greg.ercolano Date: 2013-04-10 13:13:12 -0700 (Wed, 10 Apr 2013) New Revision: 9870 Log: While suggesting a new top_window() method for STR#2948, it's realized that for consistency, the recently added window_offset() method (a few days ago) should be renamed to top_window_offset(). Modified: branches/branch-1.3/FL/Fl_Window.H branches/branch-1.3/src/Fl_Gl_Window.cxx branches/branch-1.3/src/Fl_Window.cxx Modified: branches/branch-1.3/FL/Fl_Window.H === --- branches/branch-1.3/FL/Fl_Window.H 2013-04-09 20:11:28 UTC (rev 9869) +++ branches/branch-1.3/FL/Fl_Window.H 2013-04-10 20:13:12 UTC (rev 9870) @@ -120,7 +120,7 @@ \see force_position(int) */ int force_position() const { return ((flags() FORCE_POSITION)?1:0); } - Fl_Window* window_offset(int xoff, int yoff) const; + Fl_Window* top_window_offset(int xoff, int yoff) const; public: Modified: branches/branch-1.3/src/Fl_Gl_Window.cxx === --- branches/branch-1.3/src/Fl_Gl_Window.cxx2013-04-09 20:11:28 UTC (rev 9869) +++ branches/branch-1.3/src/Fl_Gl_Window.cxx2013-04-10 20:13:12 UTC (rev 9870) @@ -184,7 +184,7 @@ if (window()) { int xoff,yoff; -const Fl_Window *win = window_offset(xoff, yoff); // STR #2944 [2] +const Fl_Window *win = top_window_offset(xoff, yoff); // STR #2944 [2] xywh[0] = xoff; xywh[1] = win-h() - yoff - h(); } else { Modified: branches/branch-1.3/src/Fl_Window.cxx === --- branches/branch-1.3/src/Fl_Window.cxx 2013-04-09 20:11:28 UTC (rev 9869) +++ branches/branch-1.3/src/Fl_Window.cxx 2013-04-10 20:13:12 UTC (rev 9870) @@ -283,7 +283,7 @@ \param[out] xoff,yoff Returns the x/y offset \returns the top-level window */ -Fl_Window* Fl_Window::window_offset(int xoff, int yoff) const { +Fl_Window* Fl_Window::top_window_offset(int xoff, int yoff) const { xoff = yoff = 0; const Fl_Window *win = (const Fl_Window*)this; while (win win-window()) { ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9871 - in branches/branch-1.3: FL src
Author: greg.ercolano Date: 2013-04-10 13:51:24 -0700 (Wed, 10 Apr 2013) New Revision: 9871 Log: Solve STR#2948: Add new method Fl_Widget::top_window() to return the widget's top-level window. Docs for existing Fl_Widget::window() revised to clarify the difference between these two methods. Docs for window() also moved from .H - .cxx as per CMP (docs should be where code implementation is). Modified: branches/branch-1.3/FL/Fl_Widget.H branches/branch-1.3/src/Fl_Window.cxx Modified: branches/branch-1.3/FL/Fl_Widget.H === --- branches/branch-1.3/FL/Fl_Widget.H 2013-04-10 20:13:12 UTC (rev 9870) +++ branches/branch-1.3/FL/Fl_Widget.H 2013-04-10 20:51:24 UTC (rev 9871) @@ -919,12 +919,8 @@ */ void measure_label(int ww, int hh) const {label_.measure(ww, hh);} - /** Returns a pointer to the primary Fl_Window widget. - \retval NULL if no window is associated with this widget. - \note for an Fl_Window widget, this returns its Iparent/I window -(if any), not Ithis/I window. - */ Fl_Window* window() const ; + Fl_Window* top_window() const; /** Returns an Fl_Group pointer if this widget is an Fl_Group. Modified: branches/branch-1.3/src/Fl_Window.cxx === --- branches/branch-1.3/src/Fl_Window.cxx 2013-04-10 20:13:12 UTC (rev 9870) +++ branches/branch-1.3/src/Fl_Window.cxx 2013-04-10 20:51:24 UTC (rev 9871) @@ -80,11 +80,32 @@ clear_visible(); } +/** Returns a pointer to the nearest parent window up the widget hierarchy. +This will return sub-windows if there are any, or the parent window if there's no sub-windows. +If this widget IS the top-level window, NULL is returned. +\retval NULL if no window is associated with this widget. +\note for an Fl_Window widget, this returns its Iparent/I window + (if any), not Ithis/I window. +\see top_window() +*/ Fl_Window *Fl_Widget::window() const { for (Fl_Widget *o = parent(); o; o = o-parent()) if (o-type() = FL_WINDOW) return (Fl_Window*)o; return 0; } + +/** Returns a pointer to the top-level window for the widget. +In other words, the 'window manager window' that contains this widget. +This method differs from window() in that it won't return sub-windows (if there are any). +\returns the top-level window, or NULL if no top-level window is associated with this widget. +\see window() +*/ +Fl_Window *Fl_Widget::top_window() const { + const Fl_Widget *w = this; + while (w-parent()) { w = w-parent(); } // walk up the widget hierarchy to top-level item + return const_castFl_Widget*(w)-as_window(); // return if window, or NULL if not +} + /** Gets the x position of the window on the screen */ int Fl_Window::x_root() const { Fl_Window *p = window(); ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9872 - in branches/branch-1.3: FL src
Author: greg.ercolano Date: 2013-04-10 14:16:16 -0700 (Wed, 10 Apr 2013) New Revision: 9872 Log: As per notes from STR#2948: Moved top_window_offset() to being a member of Fl_Widget (was Fl_Window) and moved its code near implementations of top_window() and window(). Modified: branches/branch-1.3/FL/Fl_Widget.H branches/branch-1.3/FL/Fl_Window.H branches/branch-1.3/src/Fl_Window.cxx Modified: branches/branch-1.3/FL/Fl_Widget.H === --- branches/branch-1.3/FL/Fl_Widget.H 2013-04-10 20:51:24 UTC (rev 9871) +++ branches/branch-1.3/FL/Fl_Widget.H 2013-04-10 21:16:16 UTC (rev 9872) @@ -921,6 +921,7 @@ Fl_Window* window() const ; Fl_Window* top_window() const; + Fl_Window* top_window_offset(int xoff, int yoff) const; /** Returns an Fl_Group pointer if this widget is an Fl_Group. Modified: branches/branch-1.3/FL/Fl_Window.H === --- branches/branch-1.3/FL/Fl_Window.H 2013-04-10 20:51:24 UTC (rev 9871) +++ branches/branch-1.3/FL/Fl_Window.H 2013-04-10 21:16:16 UTC (rev 9872) @@ -120,7 +120,6 @@ \see force_position(int) */ int force_position() const { return ((flags() FORCE_POSITION)?1:0); } - Fl_Window* top_window_offset(int xoff, int yoff) const; public: Modified: branches/branch-1.3/src/Fl_Window.cxx === --- branches/branch-1.3/src/Fl_Window.cxx 2013-04-10 20:51:24 UTC (rev 9871) +++ branches/branch-1.3/src/Fl_Window.cxx 2013-04-10 21:16:16 UTC (rev 9872) @@ -106,6 +106,22 @@ return const_castFl_Widget*(w)-as_window(); // return if window, or NULL if not } +/** + Finds the x/y offset of the current window relative to the top-level window. + \param[out] xoff,yoff Returns the x/y offset + \returns the top-level window +*/ +Fl_Window* Fl_Widget::top_window_offset(int xoff, int yoff) const { + xoff = yoff = 0; + const Fl_Window *win = (const Fl_Window*)this; + while (win win-window()) { +xoff += win-x(); // accumulate offsets +yoff += win-y(); +win = win-window(); // walk up window hierarchy + } + return (Fl_Window*)win; +} + /** Gets the x position of the window on the screen */ int Fl_Window::x_root() const { Fl_Window *p = window(); @@ -299,22 +315,6 @@ icon_ = ic; } -/** - Finds the x/y offset of the current window relative to the top-level window. - \param[out] xoff,yoff Returns the x/y offset - \returns the top-level window -*/ -Fl_Window* Fl_Window::top_window_offset(int xoff, int yoff) const { - xoff = yoff = 0; - const Fl_Window *win = (const Fl_Window*)this; - while (win win-window()) { -xoff += win-x(); // accumulate offsets -yoff += win-y(); -win = win-window(); // walk up window hierarchy - } - return (Fl_Window*)win; -} - // // End of $Id$. // ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9873 - branches/branch-1.3
Author: greg.ercolano Date: 2013-04-10 14:19:10 -0700 (Wed, 10 Apr 2013) New Revision: 9873 Log: Mods to CHANGES file for recent additions/fixes Modified: branches/branch-1.3/CHANGES Modified: branches/branch-1.3/CHANGES === --- branches/branch-1.3/CHANGES 2013-04-10 21:16:16 UTC (rev 9872) +++ branches/branch-1.3/CHANGES 2013-04-10 21:19:10 UTC (rev 9873) @@ -2,12 +2,15 @@ - Fixed access of protected member (STR #2903) - Implemented support for the Mac OS text input system that deals with character composition - and input of languages with large character sets (e.g., Chinese and Japanese). This - implementation has been reported to work well for Chinese. Superficial testing suggests - it's also operational for Japanese. In-depth testing remains needed though. + and input of languages with large character sets (e.g., Chinese and Japanese). This + implementation has been reported to work well for Chinese. Superficial testing suggests + it's also operational for Japanese. In-depth testing remains needed though. - Mac OS version of Fl_Native_File_Chooser: when using filters in a save file dialog, - the output file extension gets changed when the user modifies the output file type. + the output file extension gets changed when the user modifies the output file type. - Removed the now unused src/Fl_mac.cxx + - Fixed various Mac specific opengl issues (STR #2944) +- Added new method Fl_Widget::top_window() (STR #2948) +- Added new method Fl_Widget::top_window_offset() (part of STR #2944) CHANGES IN FLTK 1.3.2 @@ -19,10 +22,10 @@ - Prevents scrollbars from drawing when widget is sized too small to be visible (STR #2886). - Documented how to make a Mac OS X FLTK application launchable by dropping files on its icon. - Fixed a Mac-specific issue appeared with OS 10.8 (Mountain Lion): long delay before - opening when the application is started by dragging a file on the application icon. + opening when the application is started by dragging a file on the application icon. - Fixed use of PNG image from in-memory data (STR #2884). - Added static Fl_RGB_Image::max_size(size_t) to limit the maximum memory size allowed to - RGB images (STR #2881). + RGB images (STR #2881). CHANGES IN FLTK 1.3.1 ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9869 - branches/branch-1.3/src
Author: greg.ercolano Date: 2013-04-09 13:11:28 -0700 (Tue, 09 Apr 2013) New Revision: 9869 Log: Fix STR# 2772: remove dead code in fl_measure() Modified: branches/branch-1.3/src/fl_draw.cxx Modified: branches/branch-1.3/src/fl_draw.cxx === --- branches/branch-1.3/src/fl_draw.cxx 2013-04-09 15:10:25 UTC (rev 9868) +++ branches/branch-1.3/src/fl_draw.cxx 2013-04-09 20:11:28 UTC (rev 9869) @@ -413,29 +413,22 @@ int lines; double width=0; int W = 0; - char symbol[2][255], *symptr; int symwidth[2], symtotal; - // count how many lines and put the last one into the buffer: - symbol[0][0] = '\0'; - symwidth[0] = 0; + symwidth[0] = 0; // size of symbol at beginning of string (if any) + symwidth[1] = 0; // size of symbol at end of string (if any) - symbol[1][0] = '\0'; - symwidth[1] = 0; - if (draw_symbols) { -if (str str[0] == '@' str[1] str[1] != '@') { - // Start with a symbol... - for (symptr = symbol[0]; - *str !isspace(*str) symptr (symbol[0] + sizeof(symbol[0]) - 1); - *symptr++ = *str++); - *symptr = '\0'; - if (isspace(*str)) str++; +// Symbol at beginning of string? +const char *sym2 = (str[0]=='@' str[1]=='@') ? str+2 : str; // sym2 check will skip leading @@ +if (str[0] == '@' str[1] != '@') { + while (*str !isspace(*str)) { ++str; }// skip over symbol + if (isspace(*str)) ++str;// skip over trailing space + sym2 = str; // sym2 check will skip leading symbol symwidth[0] = h; } - -if (str (p = strrchr(str, '@')) != NULL p (str + 1) p[-1]!='@') { - strlcpy(symbol[1], p, sizeof(symbol[1])); +// Symbol at end of string? +if ((p=strchr(sym2,'@')) != NULL p[1] != '@') { symwidth[1] = h; } } ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9865 - branches/branch-1.3/src
Author: greg.ercolano Date: 2013-04-08 09:49:55 -0700 (Mon, 08 Apr 2013) New Revision: 9865 Log: Fix STR# 2944 [1]: When an app uses overlays and gl_draw(), gl_draw() would mess up the raster position affecting the Mac overlay emulation in swapbuffer code. Modified: branches/branch-1.3/src/Fl_Gl_Window.cxx Modified: branches/branch-1.3/src/Fl_Gl_Window.cxx === --- branches/branch-1.3/src/Fl_Gl_Window.cxx2013-04-06 16:35:05 UTC (rev 9864) +++ branches/branch-1.3/src/Fl_Gl_Window.cxx2013-04-08 16:49:55 UTC (rev 9865) @@ -249,10 +249,34 @@ # endif #elif defined(__APPLE_QUARTZ__) if(overlay != NULL) { -//aglSwapBuffers does not work well with overlays under cocoa -glReadBuffer(GL_BACK); -glDrawBuffer(GL_FRONT); -glCopyPixels(0,0,w(),h(),GL_COLOR); +// STR# 2944 [1] +//Save matrixmode/proj/modelview/rasterpos before doing overlay. +// +int wo=w(), ho=h(); +GLint matrixmode; +GLfloat pos[4]; +glGetIntegerv(GL_MATRIX_MODE, matrixmode); +glGetFloatv(GL_CURRENT_RASTER_POSITION, pos); // save original glRasterPos +glMatrixMode(GL_PROJECTION); // save proj/model matrices +glPushMatrix(); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); +glLoadIdentity(); +glScalef(2.0f/wo, 2.0f/ho, 1.0f); +glTranslatef(-wo/2.0f, -ho/2.0f, 0.0f); // set transform so 0,0 is bottom/left of Gl_Window +glRasterPos2i(0,0); // set glRasterPos to bottom left corner +{ + // Emulate overlay by doing copypixels + glReadBuffer(GL_BACK); + glDrawBuffer(GL_FRONT); + glCopyPixels(0, 0, wo, ho, GL_COLOR); // copy GL_BACK to GL_FRONT +} +glPopMatrix(); // GL_MODELVIEW // restore model/proj matrices + glMatrixMode(GL_PROJECTION); + glPopMatrix(); +glMatrixMode(matrixmode); +glRasterPos3f(pos[0], pos[1], pos[2]); // restore original glRasterPos } else aglSwapBuffers((AGLContext)context_); ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9866 - in branches/branch-1.3: FL src
Author: greg.ercolano Date: 2013-04-08 11:24:17 -0700 (Mon, 08 Apr 2013) New Revision: 9866 Log: Fix for STR #2944 [2]: Fix Apple-specifc nested window problem for Fl_Gl_Window's. Added new method Fl_Widget::window_offset(x,y) to access the top-level window offset of the current widget. Open to alternative names for the new method. Modified: branches/branch-1.3/FL/Fl_Window.H branches/branch-1.3/src/Fl_Gl_Window.cxx branches/branch-1.3/src/Fl_Window.cxx Modified: branches/branch-1.3/FL/Fl_Window.H === --- branches/branch-1.3/FL/Fl_Window.H 2013-04-08 16:49:55 UTC (rev 9865) +++ branches/branch-1.3/FL/Fl_Window.H 2013-04-08 18:24:17 UTC (rev 9866) @@ -120,6 +120,7 @@ \see force_position(int) */ int force_position() const { return ((flags() FORCE_POSITION)?1:0); } + Fl_Window* window_offset(int xoff, int yoff) const; public: Modified: branches/branch-1.3/src/Fl_Gl_Window.cxx === --- branches/branch-1.3/src/Fl_Gl_Window.cxx2013-04-08 16:49:55 UTC (rev 9865) +++ branches/branch-1.3/src/Fl_Gl_Window.cxx2013-04-08 18:24:17 UTC (rev 9866) @@ -183,8 +183,10 @@ GLint xywh[4]; if (window()) { -xywh[0] = x(); -xywh[1] = window()-h() - y() - h(); +int xoff,yoff; +const Fl_Window *win = window_offset(xoff, yoff); // STR #2944 [2] +xywh[0] = xoff; +xywh[1] = win-h() - yoff - h(); } else { xywh[0] = 0; xywh[1] = 0; Modified: branches/branch-1.3/src/Fl_Window.cxx === --- branches/branch-1.3/src/Fl_Window.cxx 2013-04-08 16:49:55 UTC (rev 9865) +++ branches/branch-1.3/src/Fl_Window.cxx 2013-04-08 18:24:17 UTC (rev 9866) @@ -278,6 +278,21 @@ icon_ = ic; } +/** + Finds the x/y offset of the current window relative to the top-level window. + \param[out] xoff,yoff Returns the x/y offset + \returns the top-level window +*/ +Fl_Window* Fl_Window::window_offset(int xoff, int yoff) const { + xoff = yoff = 0; + const Fl_Window *win = (const Fl_Window*)this; + while (win win-window()) { +xoff += win-x(); // accumulate offsets +yoff += win-y(); +win = win-window(); // walk up window hierarchy + } + return (Fl_Window*)win; +} // // End of $Id$. ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9867 - in branches/branch-1.3: FL src
Author: greg.ercolano Date: 2013-04-08 13:18:40 -0700 (Mon, 08 Apr 2013) New Revision: 9867 Log: Solves STR #2939; adding when() support to Fl_Tabs. Also added a general Fl_Tabs code example to the docs. Modified: branches/branch-1.3/FL/Fl_Tabs.H branches/branch-1.3/src/Fl_Tabs.cxx Modified: branches/branch-1.3/FL/Fl_Tabs.H === --- branches/branch-1.3/FL/Fl_Tabs.H2013-04-08 18:24:17 UTC (rev 9866) +++ branches/branch-1.3/FL/Fl_Tabs.H2013-04-08 20:18:40 UTC (rev 9867) @@ -49,6 +49,49 @@ gap is larger. It is easiest to lay this out in fluid, using the fluid browser to select each child group and resize them until the tabs look the way you want them to. + + Typical use: + \code + Fl_Tabs *tabs = new Fl_Tabs(10,10,300,200); + { + Fl_Group *tab1 = new Fl_Group(20,30,280,170,Tab1); + { + ..widgets that go in tab#1.. + } + tab1-end(); + Fl_Group *tab2 = new Fl_Group(20,30,280,170,Tab2); + { + ..widgets that go in tab#2.. + } + tab2-end(); + } + tabs-end(); + \endcode + + In the above, tab1's tab can be made red by using tab1-selection_color(FL_RED); + and tab1's text can be made bold by tab1-labelfont(FL_HELVETICA_BOLD), + and can be made 'engraved' by tab1-labeltype(FL_ENGRAVED_LABEL); + + As of FLTK 1.3.3, Fl_Tabs() supports the following flags for when(): + +- \ref FL_WHEN_NEVER -- callback never invoked (all flags off) +- \ref FL_WHEN_CHANGED -- if flag set, invokes callback when a tab has been changed (on click or keyboard navigation) +- \ref FL_WHEN_NOT_CHANGED -- if flag set, invokes callback when the tabs remain unchanged (on click or keyboard navigation) +- \ref FL_WHEN_RELEASE -- if flag set, invokes callback on RELEASE of mouse button or keyboard navigation + + Notes: + +-# The above flags can be logically OR-ed (|) or added (+) to combine behaviors. +-# The default value for when() is \ref FL_WHEN_RELEASE (inherited from Fl_Widget). +-# If \ref FL_WHEN_RELEASE is the \em only flag specified, +the behavior will be as if (\ref FL_WHEN_RELEASE|\ref FL_WHEN_CHANGED) was specified. +-# The value of changed() will be valid during the callback. +-# If both \ref FL_WHEN_CHANGED and \ref FL_WHEN_NOT_CHANGED are specified, +the callback is invoked whether the tab has been changed or not. + The changed() method can be used to determine the cause. +-# \ref FL_WHEN_NOT_CHANGED can happen if someone clicks on an already selected tab, +or if a keyboard navigation attempt results in no change to the tabs, + such as using the arrow keys while at the left or right end of the tabs. */ class FL_EXPORT Fl_Tabs : public Fl_Group { Fl_Widget *value_; Modified: branches/branch-1.3/src/Fl_Tabs.cxx === --- branches/branch-1.3/src/Fl_Tabs.cxx 2013-04-08 18:24:17 UTC (rev 9866) +++ branches/branch-1.3/src/Fl_Tabs.cxx 2013-04-08 20:18:40 UTC (rev 9867) @@ -170,25 +170,59 @@ }} /* FALLTHROUGH */ case FL_DRAG: - case FL_RELEASE: -o = which(Fl::event_x(), Fl::event_y()); + case FL_RELEASE: { +// PUSH, DRAG, RELEASE.. +int do_cb=0; +if ((o = which(Fl::event_x(), Fl::event_y( { // get tab group for tab user is over + if (o != value()) set_changed(); // if over tab, handle change + else clear_changed(); +} if (event == FL_RELEASE) { - push(0); - if (o Fl::visible_focus() Fl::focus()!=this) { -Fl::focus(this); -redraw_tabs(); + push(0); // no longer 'pushed' + // Over a tab? + if (o) { + // Handle taking keyboard focus w/visible focus indication + if (Fl::visible_focus() Fl::focus()!=this) { + Fl::focus(this); + redraw_tabs(); + } + if (value(o)) { // commit to value, see if it changed.. + set_changed();// it changed + do_cb = + ( (when() FL_WHEN_RELEASE) // wants cb on RELEASE and.. + (when() FL_WHEN_CHANGED)// when changed? + ) || ( // ..or.. + (when() == FL_WHEN_RELEASE) // *only* WHEN_RELEASE specified? (default behavior) + ) ? 1 : 0; + } else { + clear_changed(); // no change + do_cb = (when() FL_WHEN_RELEASE // wants cb when RELEASE and.. + when() FL_WHEN_NOT_CHANGED)?1:0; // ..when no change occurred? + } } - if (o value(o)) { -Fl_Widget_Tracker wp(o); -set_changed(); - do_callback(); - if (wp.deleted()) return 1; - }
[fltk.commit] [Library] r9863 - in branches/branch-1.3: . src
Author: greg.ercolano Date: 2013-04-06 09:31:35 -0700 (Sat, 06 Apr 2013) New Revision: 9863 Log: Removing Fl_mac.cxx -- this code is no longer used. Removed: branches/branch-1.3/src/Fl_mac.cxx Modified: branches/branch-1.3/CHANGES Modified: branches/branch-1.3/CHANGES === --- branches/branch-1.3/CHANGES 2013-04-06 16:15:17 UTC (rev 9862) +++ branches/branch-1.3/CHANGES 2013-04-06 16:31:35 UTC (rev 9863) @@ -7,6 +7,7 @@ it's also operational for Japanese. In-depth testing remains needed though. - Mac OS version of Fl_Native_File_Chooser: when using filters in a save file dialog, the output file extension gets changed when the user modifies the output file type. + - Removed the now unused src/Fl_mac.cxx CHANGES IN FLTK 1.3.2 ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9864 - branches/branch-1.3/src
Author: greg.ercolano Date: 2013-04-06 09:35:05 -0700 (Sat, 06 Apr 2013) New Revision: 9864 Log: Small comment mods regarding Fl_mac.cxx - Fl_cocoa.mm Modified: branches/branch-1.3/src/Fl.cxx branches/branch-1.3/src/Fl_x.cxx Modified: branches/branch-1.3/src/Fl.cxx === --- branches/branch-1.3/src/Fl.cxx 2013-04-06 16:31:35 UTC (rev 9863) +++ branches/branch-1.3/src/Fl.cxx 2013-04-06 16:35:05 UTC (rev 9864) @@ -220,7 +220,7 @@ #elif defined(__APPLE__) -// implementation in Fl_mac.cxx +// implementation in Fl_cocoa.mm (was Fl_mac.cxx) #else Modified: branches/branch-1.3/src/Fl_x.cxx === --- branches/branch-1.3/src/Fl_x.cxx2013-04-06 16:31:35 UTC (rev 9863) +++ branches/branch-1.3/src/Fl_x.cxx2013-04-06 16:35:05 UTC (rev 9864) @@ -19,7 +19,7 @@ #ifdef WIN32 //# include Fl_win32.cxx #elif defined(__APPLE__) -//# include Fl_mac.cxx +//# include Fl_mac.cxx // now Fl_cocoa.mm #elif !defined(FL_DOXYGEN) # define CONSOLIDATE_MOTION 1 ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9859 - branches/branch-1.3/ide/Xcode4/plists
Author: manolo Date: 2013-04-05 07:53:26 -0700 (Fri, 05 Apr 2013) New Revision: 9859 Log: Added the NSHighResolutionCapable item to all .plist files for fltk apps to be high-resolution ready. Modified: branches/branch-1.3/ide/Xcode4/plists/CubeView-Info.plist branches/branch-1.3/ide/Xcode4/plists/Demo-Info.plist branches/branch-1.3/ide/Xcode4/plists/Fluid-Info.plist branches/branch-1.3/ide/Xcode4/plists/adjuster-Info.plist branches/branch-1.3/ide/Xcode4/plists/arc-Info.plist branches/branch-1.3/ide/Xcode4/plists/ask-Info.plist branches/branch-1.3/ide/Xcode4/plists/bitmap-Info.plist branches/branch-1.3/ide/Xcode4/plists/blocks-Info.plist branches/branch-1.3/ide/Xcode4/plists/boxtype-Info.plist branches/branch-1.3/ide/Xcode4/plists/browser-Info.plist branches/branch-1.3/ide/Xcode4/plists/button-Info.plist branches/branch-1.3/ide/Xcode4/plists/buttons-Info.plist branches/branch-1.3/ide/Xcode4/plists/checkers-Info.plist branches/branch-1.3/ide/Xcode4/plists/clock-Info.plist branches/branch-1.3/ide/Xcode4/plists/colbrowser-Info.plist branches/branch-1.3/ide/Xcode4/plists/color_chooser-Info.plist branches/branch-1.3/ide/Xcode4/plists/cube-Info.plist branches/branch-1.3/ide/Xcode4/plists/cursor-Info.plist branches/branch-1.3/ide/Xcode4/plists/curve-Info.plist branches/branch-1.3/ide/Xcode4/plists/device-Info.plist branches/branch-1.3/ide/Xcode4/plists/doublebuffer-Info.plist branches/branch-1.3/ide/Xcode4/plists/editor-Info.plist branches/branch-1.3/ide/Xcode4/plists/fast_slow-Info.plist branches/branch-1.3/ide/Xcode4/plists/file_chooser-Info.plist branches/branch-1.3/ide/Xcode4/plists/fltk-Info.plist branches/branch-1.3/ide/Xcode4/plists/fltk_forms-Info.plist branches/branch-1.3/ide/Xcode4/plists/fltk_gl-Info.plist branches/branch-1.3/ide/Xcode4/plists/fltk_images-Info.plist branches/branch-1.3/ide/Xcode4/plists/fltk_jpeg-Info.plist branches/branch-1.3/ide/Xcode4/plists/fltk_png-Info.plist branches/branch-1.3/ide/Xcode4/plists/fltk_zlib-Info.plist branches/branch-1.3/ide/Xcode4/plists/fonts-Info.plist branches/branch-1.3/ide/Xcode4/plists/forms-Info.plist branches/branch-1.3/ide/Xcode4/plists/fractals-Info.plist branches/branch-1.3/ide/Xcode4/plists/fullscreen-Info.plist branches/branch-1.3/ide/Xcode4/plists/gl_overlay-Info.plist branches/branch-1.3/ide/Xcode4/plists/glpuzzle-Info.plist branches/branch-1.3/ide/Xcode4/plists/hello-Info.plist branches/branch-1.3/ide/Xcode4/plists/help-Info.plist branches/branch-1.3/ide/Xcode4/plists/iconize-Info.plist branches/branch-1.3/ide/Xcode4/plists/image-Info.plist branches/branch-1.3/ide/Xcode4/plists/inactive-Info.plist branches/branch-1.3/ide/Xcode4/plists/input-Info.plist branches/branch-1.3/ide/Xcode4/plists/input_choice-Info.plist branches/branch-1.3/ide/Xcode4/plists/keyboard-Info.plist branches/branch-1.3/ide/Xcode4/plists/label-Info.plist branches/branch-1.3/ide/Xcode4/plists/line_style-Info.plist branches/branch-1.3/ide/Xcode4/plists/list_visuals-Info.plist branches/branch-1.3/ide/Xcode4/plists/mandelbrot-Info.plist branches/branch-1.3/ide/Xcode4/plists/menubar-Info.plist branches/branch-1.3/ide/Xcode4/plists/message-Info.plist branches/branch-1.3/ide/Xcode4/plists/minimum-Info.plist branches/branch-1.3/ide/Xcode4/plists/native-filechooser-Info.plist branches/branch-1.3/ide/Xcode4/plists/navigation-Info.plist branches/branch-1.3/ide/Xcode4/plists/output-Info.plist branches/branch-1.3/ide/Xcode4/plists/overlay-Info.plist branches/branch-1.3/ide/Xcode4/plists/pack-Info.plist branches/branch-1.3/ide/Xcode4/plists/pixmap-Info.plist branches/branch-1.3/ide/Xcode4/plists/pixmap_browser-Info.plist branches/branch-1.3/ide/Xcode4/plists/preferences-Info.plist branches/branch-1.3/ide/Xcode4/plists/radio-Info.plist branches/branch-1.3/ide/Xcode4/plists/resize-Info.plist branches/branch-1.3/ide/Xcode4/plists/resizebox-Info.plist branches/branch-1.3/ide/Xcode4/plists/rotated_text-Info.plist branches/branch-1.3/ide/Xcode4/plists/scroll-Info.plist branches/branch-1.3/ide/Xcode4/plists/shape-Info.plist branches/branch-1.3/ide/Xcode4/plists/subwindow-Info.plist branches/branch-1.3/ide/Xcode4/plists/sudoku-Info.plist branches/branch-1.3/ide/Xcode4/plists/symbols-Info.plist branches/branch-1.3/ide/Xcode4/plists/table-Info.plist branches/branch-1.3/ide/Xcode4/plists/tabs-Info.plist branches/branch-1.3/ide/Xcode4/plists/threads-Info.plist branches/branch-1.3/ide/Xcode4/plists/tile-Info.plist branches/branch-1.3/ide/Xcode4/plists/tiled_image-Info.plist branches/branch-1.3/ide/Xcode4/plists/tree-Info.plist branches/branch-1.3/ide/Xcode4/plists/utf8-Info.plist branches/branch-1.3/ide/Xcode4/plists/valuators-Info.plist branches/branch-1.3/ide/Xcode4/plists/zlib-Info.plist Modified: branches/branch-1.3/ide/Xcode4/plists/CubeView-Info.plist
[fltk.commit] [Library] r9860 - branches/branch-1.3/ide/Xcode4/Project Templates/FLTK Application/FLTK 1.3
Author: manolo Date: 2013-04-05 08:09:50 -0700 (Fri, 05 Apr 2013) New Revision: 9860 Log: Added the NSHighResolutionCapable item to all .plist files for fltk apps to be high-resolution ready. Modified: branches/branch-1.3/ide/Xcode4/Project Templates/FLTK Application/FLTK 1.3/___PROJECTNAMEASIDENTIFIER___-Info.plist Modified: branches/branch-1.3/ide/Xcode4/Project Templates/FLTK Application/FLTK 1.3/___PROJECTNAMEASIDENTIFIER___-Info.plist === --- branches/branch-1.3/ide/Xcode4/Project Templates/FLTK Application/FLTK 1.3/___PROJECTNAMEASIDENTIFIER___-Info.plist 2013-04-05 14:53:26 UTC (rev 9859) +++ branches/branch-1.3/ide/Xcode4/Project Templates/FLTK Application/FLTK 1.3/___PROJECTNAMEASIDENTIFIER___-Info.plist 2013-04-05 15:09:50 UTC (rev 9860) @@ -24,5 +24,7 @@ string1.0/string keyLSMinimumSystemVersion/key string${MACOSX_DEPLOYMENT_TARGET}/string + keyNSHighResolutionCapable/key + true/ /dict /plist ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9861 - branches/branch-1.3
Author: manolo Date: 2013-04-05 08:28:43 -0700 (Fri, 05 Apr 2013) New Revision: 9861 Log: Added the NSHighResolutionCapable item to fltk-config --post for fltk apps to be high-resolution ready. Modified: branches/branch-1.3/fltk-config.cmake.in branches/branch-1.3/fltk-config.in Modified: branches/branch-1.3/fltk-config.cmake.in === --- branches/branch-1.3/fltk-config.cmake.in2013-04-05 15:09:50 UTC (rev 9860) +++ branches/branch-1.3/fltk-config.cmake.in2013-04-05 15:28:43 UTC (rev 9861) @@ -317,7 +317,8 @@ string$post/string keyCFBundlePackageType/key stringAPPL/string -/dict + keyNSHighResolutionCapable/key + true/ /plist EOF ;; Modified: branches/branch-1.3/fltk-config.in === --- branches/branch-1.3/fltk-config.in 2013-04-05 15:09:50 UTC (rev 9860) +++ branches/branch-1.3/fltk-config.in 2013-04-05 15:28:43 UTC (rev 9861) @@ -317,6 +317,8 @@ string$post/string keyCFBundlePackageType/key stringAPPL/string + keyNSHighResolutionCapable/key + true/ /dict /plist EOF ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9856 - in branches/branch-1.3: FL documentation/src
Author: greg.ercolano Date: 2013-04-02 09:47:57 -0700 (Tue, 02 Apr 2013) New Revision: 9856 Log: Small color documentation clarification/improvements: o Added some references to the FLTK colormap diagram in obvious places (Fl_Color docs) o Added info regarding the 'reserved' colors o Added quotes to clarify RGBI description: RGB and I Modified: branches/branch-1.3/FL/Enumerations.H branches/branch-1.3/documentation/src/drawing.dox Modified: branches/branch-1.3/FL/Enumerations.H === --- branches/branch-1.3/FL/Enumerations.H 2013-03-29 18:26:36 UTC (rev 9855) +++ branches/branch-1.3/FL/Enumerations.H 2013-04-02 16:47:57 UTC (rev 9856) @@ -755,7 +755,7 @@ The Fl_Color type holds an FLTK color value. Colors are either 8-bit indexes into a virtual colormap -or 24-bit RGB color values. +or 24-bit RGB color values. (See \ref drawing_colors for the default FLTK colormap) Color indices occupy the lower 8 bits of the value, while RGB colors occupy the upper 24 bits, for a byte organization of RGBI. @@ -763,7 +763,7 @@ pre Fl_Color = 0xrrggbbii | | | | -| | | +--- index between 0 and 255 +| | | +--- \ref drawing_colors index between 0 and 255 | | +- blue color component (8 bit) | +--- green component (8 bit) +- red component (8 bit) @@ -774,7 +774,7 @@ */ /*@{*/ -/** an FLTK color value */ +/** An FLTK color value; see also \ref drawing_colors */ typedef unsigned int Fl_Color; // Standard colors. These are used as default colors in widgets and altered as necessary Modified: branches/branch-1.3/documentation/src/drawing.dox === --- branches/branch-1.3/documentation/src/drawing.dox 2013-03-29 18:26:36 UTC (rev 9855) +++ branches/branch-1.3/documentation/src/drawing.dox 2013-04-02 16:47:57 UTC (rev 9856) @@ -154,11 +154,12 @@ \section drawing_colors Colors FLTK manages colors as 32-bit unsigned integers, encoded as RGBI. -When the RGB bytes are non-zero, the value is treated as RGB. -If these bytes are zero, the I byte will be used as an index -into the colormap. +When the RGB bytes are non-zero, the value is treated as RGB. +If these bytes are zero, the I byte will be used as an index +into the colormap. Colors with both RGB set and an index 0 +are reserved for special use. -Values from 0 to 255, i.e. the I index value, represent +Values from 0 to 255, i.e. the I index value, represent colors from the FLTK 1.3.x standard colormap and are allocated as needed on screens without TrueColor support. The \b Fl_Color enumeration type defines the ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9857 - branches/branch-1.3/documentation/src
Author: greg.ercolano Date: 2013-04-02 09:51:56 -0700 (Tue, 02 Apr 2013) New Revision: 9857 Log: Followup: small color docs mod Modified: branches/branch-1.3/documentation/src/drawing.dox Modified: branches/branch-1.3/documentation/src/drawing.dox === --- branches/branch-1.3/documentation/src/drawing.dox 2013-04-02 16:47:57 UTC (rev 9856) +++ branches/branch-1.3/documentation/src/drawing.dox 2013-04-02 16:51:56 UTC (rev 9857) @@ -156,7 +156,7 @@ FLTK manages colors as 32-bit unsigned integers, encoded as RGBI. When the RGB bytes are non-zero, the value is treated as RGB. If these bytes are zero, the I byte will be used as an index -into the colormap. Colors with both RGB set and an index 0 +into the colormap. Colors with both RGB set and an I 0 are reserved for special use. Values from 0 to 255, i.e. the I index value, represent ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9855 - branches/branch-1.3/src
Author: greg.ercolano Date: 2013-03-29 11:26:36 -0700 (Fri, 29 Mar 2013) New Revision: 9855 Log: Code readability -- No logic was changed. o Adjusted /*FALLTHROUGH*/ comments for clarity o Added /* NOTREACHED */ comment for clarity o Brace cosmetics Modified: branches/branch-1.3/src/Fl_Button.cxx Modified: branches/branch-1.3/src/Fl_Button.cxx === --- branches/branch-1.3/src/Fl_Button.cxx 2013-03-29 04:36:51 UTC (rev 9854) +++ branches/branch-1.3/src/Fl_Button.cxx 2013-03-29 18:26:36 UTC (rev 9855) @@ -89,12 +89,12 @@ return 1; case FL_PUSH: if (Fl::visible_focus() handle(FL_FOCUS)) Fl::focus(this); +/* FALLTHROUGH */ case FL_DRAG: if (Fl::event_inside(this)) { if (type() == FL_RADIO_BUTTON) newval = 1; else newval = !oldval; -} else -{ +} else { clear_changed(); newval = oldval; } @@ -129,7 +129,7 @@ Fl::test_shortcut(shortcut()) : test_shortcut())) return 0; if (Fl::visible_focus() handle(FL_FOCUS)) Fl::focus(this); goto triggered_by_keyboard; - case FL_FOCUS : /* FALLTHROUGH */ + case FL_FOCUS : case FL_UNFOCUS : if (Fl::visible_focus()) { if (box() == FL_NO_BOX) { @@ -142,6 +142,7 @@ } else redraw(); return 1; } else return 0; +/* NOTREACHED */ case FL_KEYBOARD : if (Fl::focus() == this Fl::event_key() == ' ' !(Fl::event_state() (FL_SHIFT | FL_CTRL | FL_ALT | FL_META))) { ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9853 - in branches/branch-1.3: FL src
Author: greg.ercolano Date: 2013-03-28 20:37:04 -0700 (Thu, 28 Mar 2013) New Revision: 9853 Log: Documenting the public methods Fl_Tabs::push() Modified: branches/branch-1.3/FL/Fl_Tabs.H branches/branch-1.3/src/Fl_Tabs.cxx Modified: branches/branch-1.3/FL/Fl_Tabs.H === --- branches/branch-1.3/FL/Fl_Tabs.H2013-03-27 19:21:22 UTC (rev 9852) +++ branches/branch-1.3/FL/Fl_Tabs.H2013-03-29 03:37:04 UTC (rev 9853) @@ -69,7 +69,14 @@ Fl_Widget *value(); int value(Fl_Widget *); /** - \todo This public method needs to be documented +Returns the tab group for the tab the user has currently down-clicked on +and remains over until FL_RELEASE. Otherwise, returns NULL. + +While the user is down-clicked on a tab, the return value is the tab group +for that tab. But as soon as the user releases, or drags off the tab with +the button still down, the return value will be NULL. + +\see push(Fl_Widget*). */ Fl_Widget *push() const {return push_;} int push(Fl_Widget *); Modified: branches/branch-1.3/src/Fl_Tabs.cxx === --- branches/branch-1.3/src/Fl_Tabs.cxx 2013-03-27 19:21:22 UTC (rev 9852) +++ branches/branch-1.3/src/Fl_Tabs.cxx 2013-03-29 03:37:04 UTC (rev 9853) @@ -263,7 +263,15 @@ } /** - \todo This public method needs to be documented + This is called by the tab widget's handle() method to set the + tab group widget the user last FL_PUSH'ed on. Set back to zero + on FL_RELEASE. + + As of this writing, the value is mainly used by draw_tab() + to determine whether or not to draw a 'down' box for the tab + when it's clicked, and to turn it off if the user drags off it. + + \see push(). */ int Fl_Tabs::push(Fl_Widget *o) { if (push_ == o) return 0; ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9854 - branches/branch-1.3/src
Author: greg.ercolano Date: 2013-03-28 21:36:51 -0700 (Thu, 28 Mar 2013) New Revision: 9854 Log: Document Fl_Tabs::value()'s integer return value. Modified: branches/branch-1.3/src/Fl_Tabs.cxx Modified: branches/branch-1.3/src/Fl_Tabs.cxx === --- branches/branch-1.3/src/Fl_Tabs.cxx 2013-03-29 03:37:04 UTC (rev 9853) +++ branches/branch-1.3/src/Fl_Tabs.cxx 2013-03-29 04:36:51 UTC (rev 9854) @@ -304,6 +304,8 @@ Sets the widget to become the current visible widget/tab. Setting the value hides all other children, and makes this one visible, if it is really a child. + \returns 1 if there was a change (new value different from previous),BR + 0 if there was no change (new value already set) */ int Fl_Tabs::value(Fl_Widget *newvalue) { Fl_Widget*const* a = array(); ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9852 - branches/branch-1.3/test
Author: greg.ercolano Date: 2013-03-27 12:21:22 -0700 (Wed, 27 Mar 2013) New Revision: 9852 Log: Added some extra @@ tests for boundary conditions. Modified: branches/branch-1.3/test/unittest_symbol.cxx Modified: branches/branch-1.3/test/unittest_symbol.cxx === --- branches/branch-1.3/test/unittest_symbol.cxx2013-03-27 19:16:48 UTC (rev 9851) +++ branches/branch-1.3/test/unittest_symbol.cxx2013-03-27 19:21:22 UTC (rev 9852) @@ -71,11 +71,14 @@ DrawTextAndBoxes(@- Rt/Lt @- ,xx,yy); yy += fsize+10; // check symbol at lt+rt edges DrawTextAndBoxes(@@ At/Lt @-,xx,yy); yy += fsize+10; // check @@ at left, symbol at right DrawTextAndBoxes(@- Lt/At @@,xx,yy); yy += fsize+10; // check symbol at left, @@ at right + DrawTextAndBoxes(@@ At/At @@ ,xx,yy); yy += fsize+10; // check @@ at left+right xx = x0+200; yy = y0+10; - DrawTextAndBoxes(Line1\nLine2,xx,yy); yy += (fsize+10)*2; // check 2 lines, no symbol - DrawTextAndBoxes(@- Line1\nLine2 @-,xx,yy); yy += (fsize+10)*2; // check 2 lines, lt+rt symbols - DrawTextAndBoxes(@- Line1\nLine2\nLine3 @-,xx,yy); yy += (fsize+10)*3;// check 3 lines, lt+rt symbols + DrawTextAndBoxes(Line1\nLine2 ,xx,yy); yy += (fsize+10)*2; // check 2 lines, no symbol + DrawTextAndBoxes(@- Line1\nLine2 @- ,xx,yy); yy += (fsize+10)*2; // check 2 lines, lt+rt symbols + DrawTextAndBoxes(@- Line1\nLine2\nLine3 @-,xx,yy); yy += (fsize+10)*3; // check 3 lines, lt+rt symbols + DrawTextAndBoxes( ,xx,yy); yy += (fsize+10); // check abutting @@'s + DrawTextAndBoxes(@@ @@ ,xx,yy); yy += (fsize+10); // check @@'s with space sep fl_font(FL_HELVETICA, 14); fl_color(FL_RED); ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9841 - in branches/branch-1.3: FL src
Author: greg.ercolano Date: 2013-03-23 00:55:09 -0700 (Sat, 23 Mar 2013) New Revision: 9841 Log: o Added tab_cell_nav() method to control Tab/Shift-Tab navigation of table cells. o Added move_cursor(R,C,shiftflag). Needed allow Shift-Tab not to create a reverse selection. Modified: branches/branch-1.3/FL/Fl_Table.H branches/branch-1.3/src/Fl_Table.cxx Modified: branches/branch-1.3/FL/Fl_Table.H === --- branches/branch-1.3/FL/Fl_Table.H 2013-03-19 21:02:12 UTC (rev 9840) +++ branches/branch-1.3/FL/Fl_Table.H 2013-03-23 07:55:09 UTC (rev 9841) @@ -210,6 +210,12 @@ #if FLTK_ABI_VERSION = 10301 int _scrollbar_size; #endif +#if FLTK_ABI_VERSION = 10303 + enum { +TABCELLNAV = 10, /// tab cell navigation flag + }; + unsigned int flags_; +#endif // An STL-ish vector without templates class FL_EXPORT IntVector { @@ -823,6 +829,7 @@ int is_selected(int r, int c); // selected cell void get_selection(int row_top, int col_left, int row_bot, int col_right); void set_selection(int row_top, int col_left, int row_bot, int col_right); + int move_cursor(int R, int C, int shiftselect); int move_cursor(int R, int C); /** @@ -1107,6 +1114,36 @@ _scrollbar_size = newSize; } #endif +#if FLTK_ABI_VERSION = 10303 + /** +Flag to control if Tab navigates table cells or not. + +If on, Tab key navigates table cells. +If off, Tab key navigates fltk widget focus. (default) + +As of fltk 1.3, the default behavior of the Tab key is to navigate focus off +the current widget, and on to the next one. But in some applications, +it's useful for Tab to be used to navigate cells in the Fl_Table. + +\param [in] val If \p val is 1, Tab key navigates cells in table, not fltk widgets.BR +If \p val is 0, Tab key will advance focus to the next fltk widget (default), and does not navigate cells in table. + */ + void tab_cell_nav(int val) { +if ( val ) flags_ |= TABCELLNAV; +else flags_ = ~TABCELLNAV; + } + + /** +Get state of fltk widget tab navigation flag. + +\returns 1 if Tab configured to navigate widget focus (default) or 0 for Tab to navigate table cells. + +\see tab_cell_nav(int) + */ + int tab_cell_nav() const { +return(flags_ TABCELLNAV ? 1 : 0); + } +#endif }; #endif /*_FL_TABLE_H*/ Modified: branches/branch-1.3/src/Fl_Table.cxx === --- branches/branch-1.3/src/Fl_Table.cxx2013-03-19 21:02:12 UTC (rev 9840) +++ branches/branch-1.3/src/Fl_Table.cxx2013-03-23 07:55:09 UTC (rev 9841) @@ -131,6 +131,9 @@ #if FLTK_ABI_VERSION = 10301 _scrollbar_size = 0; #endif +#if FLTK_ABI_VERSION = 10303 + flags_= 0; // TABCELLNAV off +#endif box(FL_THIN_DOWN_FRAME); vscrollbar = new Fl_Scrollbar(x()+w()-Fl::scrollbar_size(), y(), @@ -674,7 +677,7 @@ redraw_range(R1, R2, C1, C2); } -int Fl_Table::move_cursor(int R, int C) { +int Fl_Table::move_cursor(int R, int C, int shiftselect) { if (select_row == -1) R++; if (select_col == -1) C++; R += select_row; @@ -687,7 +690,7 @@ damage_zone(current_row, current_col, select_row, select_col, R, C); select_row = R; select_col = C; - if (!Fl::event_state(FL_SHIFT)) { + if (!shiftselect || !Fl::event_state(FL_SHIFT)) { current_row = R; current_col = C; } @@ -696,7 +699,11 @@ return 1; } -// #define DEBUG 1 +int Fl_Table::move_cursor(int R, int C) { + return move_cursor(R,C,1); +} + +//#define DEBUG 1 #ifdef DEBUG #include FL/names.h #define PRINTEVENT \ @@ -1020,10 +1027,13 @@ ret = move_cursor(1, 0); break; case FL_Tab: +#if FLTK_ABI_VERSION = 10303 + if ( !tab_cell_nav() ) break; // not navigating cells? let fltk handle it (STR#2862) +#endif if ( _event_state FL_SHIFT ) { -ret = move_cursor(0, -1); // shift-tab - left +ret = move_cursor(0, -1, 0); // shift-tab - left } else { - ret = move_cursor(0, 1);// tab - right + ret = move_cursor(0, 1, 0); // tab - right } break; } ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9842 - branches/branch-1.3/examples
Author: greg.ercolano Date: 2013-03-23 01:02:02 -0700 (Sat, 23 Mar 2013) New Revision: 9842 Log: o Modified example to take advantage of new Fl_Table::tab_cell_nav() method o Changed behavior of example to be more predictable o Enter key can be used to toggle edit mode o User can navigate table cells with arrow keys or tab/shift-tab without slipping into cell edit mode o Fixed other issues with Alt, Shift, multicell selection.. Modified: branches/branch-1.3/examples/table-spreadsheet.cxx Modified: branches/branch-1.3/examples/table-spreadsheet.cxx === --- branches/branch-1.3/examples/table-spreadsheet.cxx 2013-03-23 07:55:09 UTC (rev 9841) +++ branches/branch-1.3/examples/table-spreadsheet.cxx 2013-03-23 08:02:02 UTC (rev 9842) @@ -58,8 +58,7 @@ values[r][c] = c + (r*MAX_COLS);// initialize cells end(); row_edit = col_edit = 0; -select_row = current_row = 0; -select_col = current_col = 0; +set_selection(0,0,0,0); } ~Spreadsheet() { } @@ -76,6 +75,7 @@ void start_editing(int R, int C) { row_edit = R; // Now editing this row/col col_edit = C; +set_selection(R,C,R,C);// Clear any previous multicell selection int X,Y,W,H; find_cell(CONTEXT_CELL, R,C, X,Y,W,H); // Find X/Y/W/H of cell input-resize(X,Y,W,H);// Move Fl_Input widget there @@ -160,7 +160,7 @@ } // Background if ( C cols()-1 R rows()-1 ) { - fl_draw_box(FL_THIN_UP_BOX, X,Y,W,H, (R==row_edit C==col_edit) ? FL_YELLOW : FL_WHITE); + fl_draw_box(FL_THIN_UP_BOX, X,Y,W,H, is_selected(R,C) ? FL_YELLOW : FL_WHITE); } else { fl_draw_box(FL_THIN_UP_BOX, X,Y,W,H, 0xbbddbb00); // money green } @@ -209,16 +209,19 @@ return; case FL_KEYBOARD: // key press in table? - switch (Fl::event_key()) { - case FL_Escape: exit(0);// ESC closes app - case FL_Shift_L: return;// ignore shift - case FL_Shift_R: return; - } - if (C == cols()-1 || R == rows()-1) return; // no editing of totals column + if ( Fl::event_key() == FL_Escape ) exit(0); // ESC closes app done_editing(); // finish any previous editing - start_editing(R,C); // start new edit - if (Fl::event() == FL_KEYBOARD Fl::e_text[0] != '\r') { - input-handle(Fl::event()); // pass keypress to input widget + if (C==cols()-1 || R==rows()-1) return; // no editing of totals column + switch ( Fl::e_text[0] ) { + case '0': case '1': case '2': case '3': // any of these should start editing new cell + case '4': case '5': case '6': case '7': + case '8': case '9': case '+': case '-': + start_editing(R,C); // start new edit + input-handle(Fl::event()); // pass typed char to input + break; + case '\r': case '\n': // let enter key edit the cell + start_editing(R,C); // start new edit + break; } return; } @@ -237,9 +240,13 @@ } int main() { - Fl::option(Fl::OPTION_ARROW_FOCUS, 1); // we want arrow keys to navigate table's widgets Fl_Double_Window *win = new Fl_Double_Window(862, 322, Fl_Table Spreadsheet); Spreadsheet *table = new Spreadsheet(10, 10, win-w()-20, win-h()-20); +#if FLTK_ABI_VERSION = 10303 + table-tab_cell_nav(1); // enable tab navigation of table cells (instead of fltk widgets) +#endif + table-tooltip(Use keyboard to navigate cells:\n + Arrow keys or Tab/Shift-Tab); // Table rows table-row_header(1); table-row_header_width(70); ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9843 - branches/branch-1.3/FL
Author: greg.ercolano Date: 2013-03-23 01:14:08 -0700 (Sat, 23 Mar 2013) New Revision: 9843 Log: Small doc fixes for new tab_cell_nav() methods. Modified: branches/branch-1.3/FL/Fl_Table.H Modified: branches/branch-1.3/FL/Fl_Table.H === --- branches/branch-1.3/FL/Fl_Table.H 2013-03-23 08:02:02 UTC (rev 9842) +++ branches/branch-1.3/FL/Fl_Table.H 2013-03-23 08:14:08 UTC (rev 9843) @@ -1122,7 +1122,7 @@ If off, Tab key navigates fltk widget focus. (default) As of fltk 1.3, the default behavior of the Tab key is to navigate focus off -the current widget, and on to the next one. But in some applications, +of the current widget, and on to the next one. But in some applications, it's useful for Tab to be used to navigate cells in the Fl_Table. \param [in] val If \p val is 1, Tab key navigates cells in table, not fltk widgets.BR @@ -1134,9 +1134,9 @@ } /** -Get state of fltk widget tab navigation flag. +Get state of table's 'Tab' key cell navigation flag. -\returns 1 if Tab configured to navigate widget focus (default) or 0 for Tab to navigate table cells. +\returns 1 if Tab configured to navigate cells in tablebr0 to navigate widget focus (default) \see tab_cell_nav(int) */ ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9845 - branches/branch-1.3/examples
Author: greg.ercolano Date: 2013-03-23 11:40:53 -0700 (Sat, 23 Mar 2013) New Revision: 9845 Log: Adding an example to demonstrate how to create an Fl_Browser with icons on the items. Based on an example I'd added to STR#1739 to demo someone's patch. Added: branches/branch-1.3/examples/howto-browser-with-icons.cxx Modified: branches/branch-1.3/examples/Makefile Modified: branches/branch-1.3/examples/Makefile === --- branches/branch-1.3/examples/Makefile 2013-03-23 09:25:27 UTC (rev 9844) +++ branches/branch-1.3/examples/Makefile 2013-03-23 18:40:53 UTC (rev 9845) @@ -6,6 +6,7 @@ # Executables ALL = howto-add_fd-and-popen$(EXEEXT) \ + howto-browser-with-icons$(EXEEXT) \ howto-drag-and-drop$(EXEEXT) \ howto-parse-args$(EXEEXT) \ howto-text-over-image-button$(EXEEXT) \ Added: branches/branch-1.3/examples/howto-browser-with-icons.cxx === --- branches/branch-1.3/examples/howto-browser-with-icons.cxx (rev 0) +++ branches/branch-1.3/examples/howto-browser-with-icons.cxx 2013-03-23 18:40:53 UTC (rev 9845) @@ -0,0 +1,186 @@ +// +// $Id$ +// +//Demonstrate creating an Fl_Browser with icons - Greg Ercolano 10/07/09 (STR#1739) +// +//Shows how one can add icons to items in a browser. +// +// Copyright 2009,2013 Greg Ercolano. +// 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 FL/Fl.H +#include FL/Fl_Double_Window.H +#include FL/Fl_Browser.H +#include FL/Fl_Choice.H +#include FL/Fl_Image.H +#include FL/Fl_Pixmap.H + +static const char *big[] = { // XPM + 50 34 4 1, +c #00, + o c #ff9900, + @ c #ff, + # c None, + ##, + ### ## , + ### o ### o , + ### oo oo # oo oo , + ### oo oo ### oo oo , + ### oooo # oooo , + ### oo oo ### oo oo , + ### oo oo oo oo , + ### oo oo ooo oo oo , + ### ooooo , + ### oo oooooo , + oo ooo o ooo oo #, + oo o oo #, + # oo o oo ##, + # o ooo o ##, + ## ooo ###, + # o o o ##, + # @@@ ooo @@@ ##, + # @ ooo @ ##, + # @ ooo @ ##, + # @@@ ooo @@@ ##, + # o o o ##, + ## oo oo ###, + ## @@@ @@@ ###, + ## ooo@ @ooo ###, + ### o@@@ @@@o , + # oo oo ##, + ## o@@ @ @ @@o ###, + ### @@@ @ @@@ , + @ #, + ## @ ###, + @#, + #, + ##, +}; + + +static const char *med[] = { // XPM + 14 14 2 1, + # c #00, +c #ff, + ##, + ##, + ## ##, + ## ## ## ##, + ## ## ## ##, + ## ##, + ######, + ######, + ## ##, + ## ## ## ##, + ## ## ## ##, + ## ##, + ##, + ##, +}; + +static const char *sml[] = { // XPM + 9 11 5 1, + . c None, + @ c #00, + + c #808080, + r c #802020, + # c #ff8080, + ., + ., + @+..., + @@@+., + @@r@@+..., + @@##r@@+., + @@r@@, + @@##r@@+., + @@r@@+..., + @@@+., + @+..., +}; + +// Create a custom browser +// +//You don't *have* to derive a class just to control icons in a browser, +//but in final apps it's something you'd do to keep the implementation clean. +// +//All it really comes down to is calling browser-icon() to
[fltk.commit] [Library] r9846 - branches/branch-1.3/FL
Author: greg.ercolano Date: 2013-03-23 14:24:18 -0700 (Sat, 23 Mar 2013) New Revision: 9846 Log: Expanded docs for Fl_Browser_ to define the supported keyboard navigation behavior. Modified: branches/branch-1.3/FL/Fl_Browser_.H Modified: branches/branch-1.3/FL/Fl_Browser_.H === --- branches/branch-1.3/FL/Fl_Browser_.H2013-03-23 18:40:53 UTC (rev 9845) +++ branches/branch-1.3/FL/Fl_Browser_.H2013-03-23 21:24:18 UTC (rev 9846) @@ -54,6 +54,25 @@ useful if actually figuring out the size of an object requires accessing image data or doing stat() on a file or doing some other slow operation. + + Keyboard navigation of browser items + + The keyboard navigation of browser items is only possible if + visible_focus() is enabled. If disabled, the widget rejects keyboard focus; + Tab and Shift-Tab focus navigation will skip the widget. + + In 'Select' and 'Normal' mode, the widget rejects keyboard focus; + no navigation keys are supported (other than scrollbar positioning). + + In 'Hold' mode, the widget accepts keyboard focus, and Up/Down arrow + keys can navigate the selected item. + + In 'Multi' mode, the widget accepts keyboard focus, and Up/Down arrow + keys navigate the focus box; Space toggles the current item's selection, + Enter selects only the current item (deselects all others). If Shift + (or Ctrl) is combined with Up/Down arrow keys, the current item's + selection state is extended to the next item. In this way one can + extend a selection or de-selection. */ class FL_EXPORT Fl_Browser_ : public Fl_Group { int position_; // where user wants it scrolled to ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9847 - branches/branch-1.3/test
Author: greg.ercolano Date: 2013-03-23 14:32:34 -0700 (Sat, 23 Mar 2013) New Revision: 9847 Log: Added Fl_Choice to browser test program to let one change the browser type(), allowing testing of the different browser modes.. Modified: branches/branch-1.3/test/browser.cxx Modified: branches/branch-1.3/test/browser.cxx === --- branches/branch-1.3/test/browser.cxx2013-03-23 21:24:18 UTC (rev 9846) +++ branches/branch-1.3/test/browser.cxx2013-03-23 21:32:34 UTC (rev 9847) @@ -57,6 +57,7 @@ #include FL/Fl_Double_Window.H #include FL/Fl_Button.H #include FL/Fl_Int_Input.H +#include FL/Fl_Choice.H #include FL/fl_ask.H #include stdio.h #include string.h @@ -70,6 +71,7 @@ *visible, *swap, *sort; +Fl_Choice *btype; Fl_Int_Input *field; void b_cb(Fl_Widget* o, void*) { @@ -113,12 +115,22 @@ browser-sort(FL_SORT_ASCENDING); } +void btype_cb(Fl_Widget *, void *) { + for ( int t=1; t=browser-size(); t++ ) browser-select(t,0); + browser-select(1,0);// leave focus box on first line + if ( strcmp(btype-text(),Normal)==0) browser-type(FL_NORMAL_BROWSER); + else if ( strcmp(btype-text(),Select)==0) browser-type(FL_SELECT_BROWSER); + else if ( strcmp(btype-text(),Hold )==0) browser-type(FL_HOLD_BROWSER); + else if ( strcmp(btype-text(),Multi )==0) browser-type(FL_MULTI_BROWSER); + browser-redraw(); +} + int main(int argc, char **argv) { int i; if (!Fl::args(argc,argv,i)) Fl::fatal(Fl::help); const char* fname = (i argc) ? argv[i] : browser.cxx; - Fl_Double_Window window(480,400,fname); - browser = new Fl_Select_Browser(0,0,480,350,0); + Fl_Double_Window window(560,400,fname); + browser = new Fl_Select_Browser(0,0,560,350,0); browser-type(FL_MULTI_BROWSER); //browser-type(FL_HOLD_BROWSER); //browser-color(42); @@ -159,7 +171,7 @@ } browser-position(0); - field = new Fl_Int_Input(50, 350, 430, 25, Line #:); + field = new Fl_Int_Input(55, 350, 505, 25, Line #:); field-callback(show_cb); top = new Fl_Button(0, 375, 80, 25, Top); @@ -181,6 +193,15 @@ sort = new Fl_Button(400, 375, 80, 25, Sort); sort-callback(sort_cb); + btype = new Fl_Choice(480, 375, 80, 25); + btype-add(Normal); + btype-add(Select); + btype-add(Hold); + btype-add(Multi); + btype-callback(btype_cb); + btype-value(3); + btype-tooltip(Changes the browser type()); + window.resizable(browser); window.show(argc,argv); return Fl::run(); ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9839 - branches/branch-1.3/examples
Author: greg.ercolano Date: 2013-03-19 03:34:03 -0700 (Tue, 19 Mar 2013) New Revision: 9839 Log: Small fixes to keyboard navigation and 'current cell' coloring. Modified: branches/branch-1.3/examples/table-spreadsheet.cxx Modified: branches/branch-1.3/examples/table-spreadsheet.cxx === --- branches/branch-1.3/examples/table-spreadsheet.cxx 2013-03-18 20:00:04 UTC (rev 9838) +++ branches/branch-1.3/examples/table-spreadsheet.cxx 2013-03-19 10:34:03 UTC (rev 9839) @@ -52,10 +52,14 @@ input-callback(input_cb, (void*)this); input-when(FL_WHEN_ENTER_KEY_ALWAYS); // callback triggered when user hits Enter input-maximum_size(5); +input-color(FL_YELLOW); for (int c = 0; c MAX_COLS; c++) for (int r = 0; r MAX_ROWS; r++) values[r][c] = c + (r*MAX_COLS);// initialize cells end(); +row_edit = col_edit = 0; +select_row = current_row = 0; +select_col = current_col = 0; } ~Spreadsheet() { } @@ -156,7 +160,7 @@ } // Background if ( C cols()-1 R rows()-1 ) { - fl_draw_box(FL_THIN_UP_BOX, X,Y,W,H, FL_WHITE); + fl_draw_box(FL_THIN_UP_BOX, X,Y,W,H, (R==row_edit C==col_edit) ? FL_YELLOW : FL_WHITE); } else { fl_draw_box(FL_THIN_UP_BOX, X,Y,W,H, 0xbbddbb00); // money green } @@ -205,7 +209,11 @@ return; case FL_KEYBOARD: // key press in table? - if ( Fl::event_key() == FL_Escape ) exit(0); // ESC closes app + switch (Fl::event_key()) { + case FL_Escape: exit(0);// ESC closes app + case FL_Shift_L: return;// ignore shift + case FL_Shift_R: return; + } if (C == cols()-1 || R == rows()-1) return; // no editing of totals column done_editing(); // finish any previous editing start_editing(R,C); // start new edit @@ -229,6 +237,7 @@ } int main() { + Fl::option(Fl::OPTION_ARROW_FOCUS, 1); // we want arrow keys to navigate table's widgets Fl_Double_Window *win = new Fl_Double_Window(862, 322, Fl_Table Spreadsheet); Spreadsheet *table = new Spreadsheet(10, 10, win-w()-20, win-h()-20); // Table rows ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9840 - branches/branch-1.3/examples
Author: greg.ercolano Date: 2013-03-19 14:02:12 -0700 (Tue, 19 Mar 2013) New Revision: 9840 Log: o Simplified example to take advantage of Fl_Table's existing features. o Replaced hard coded row/col counts. o Enabled arrow keyboard navigation (setting Fl::OPTION_ARROW_FOCUS) o Fixed small bug in handle() that was calling Fl_Table::handle() instead of Fl_Table_Row::handle() that was preventing Fl_Table_Row's row selection from working.. Modified: branches/branch-1.3/examples/table-with-keynav.cxx Modified: branches/branch-1.3/examples/table-with-keynav.cxx === --- branches/branch-1.3/examples/table-with-keynav.cxx 2013-03-19 10:34:03 UTC (rev 9839) +++ branches/branch-1.3/examples/table-with-keynav.cxx 2013-03-19 21:02:12 UTC (rev 9840) @@ -40,24 +40,11 @@ Fl_Output*G_sum = 0; // displays sum of user's selection class MyTable : public Fl_Table_Row { -int row_beg, col_beg, row_end, col_end;// kb nav + mouse selection protected: -// See if row R and column C is inside selection area -int IsSelected(int R, int C) { - if ( G_rowselect-value() == 0 ) - return( (R = row_beg R = col_end -C = col_beg C = row_end) ? 1 : 0); - else - return( (R = row_beg R = col_end) ? 1 : 0); -} // Handle drawing all cells in table void draw_cell(TableContext context, int R=0,int C=0, int X=0,int Y=0,int W=0,int H=0) { static char s[30]; switch ( context ) { - case CONTEXT_STARTPAGE: - // Whenever we redraw the table, update row/col selection vals first - get_selection(row_beg, col_beg, col_end, row_end); - break; case CONTEXT_COL_HEADER: case CONTEXT_ROW_HEADER: fl_font(FL_HELVETICA | FL_BOLD, 14); @@ -74,8 +61,8 @@ return; case CONTEXT_CELL: { // Keyboard nav and mouse selection highlighting - int is_select = IsSelected(R,C); - fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, is_select ? FL_YELLOW : FL_WHITE); + int selected = G_rowselect-value() ? row_selected(R) : is_selected(R,C); + fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, selected ? FL_YELLOW : FL_WHITE); // Draw text for the cell fl_push_clip(X+3, Y+3, W-6, H-6); { @@ -112,9 +99,9 @@ // Update the displayed sum value int GetSelectionSum() { int sum = -1; -for ( int R=0; R11; R++ ) { - for ( int C=0; C11; C++ ) { - if ( IsSelected(R,C) ) { +for ( int R=0; Rrows(); R++ ) { + for ( int C=0; Ccols(); C++ ) { + if ( G_rowselect-value() ? row_selected(R) : is_selected(R,C) ) { if ( sum == -1 ) sum = 0; sum += R*C; } @@ -133,10 +120,7 @@ } // Keyboard and mouse events int handle(int e) { -// See if selection changed -static int lastselect = 0; - int thisselect = row_beg + (row_end*11) + (col_beg*11*2) + (col_end*11*3); -int ret = Fl_Table::handle(e); +int ret = Fl_Table_Row::handle(e); if ( e == FL_KEYBOARD Fl::event_key() == FL_Escape ) exit(0); switch (e) { case FL_PUSH: @@ -144,11 +128,8 @@ case FL_KEYUP: case FL_KEYDOWN: case FL_DRAG: { - if ( lastselect != thisselect ) { // Selection changed? - UpdateSum();// update the sum - redraw(); // XXX: needed for row selection to redraw properly - lastselect = thisselect; - } + UpdateSum(); + redraw(); ret = 1; break; } @@ -167,11 +148,12 @@ G_table-UpdateSum(); } int main() { +Fl::option(Fl::OPTION_ARROW_FOCUS, 0); // disable arrow focus nav (we want arrows to control cells) Fl_Double_Window win(862, 312, table-with-keynav); win.begin(); // Create table G_table = new MyTable(10, 30, win.w()-20, win.h()-70, Times Table); - G_table-tooltip(Use mouse or arrow keys to make selections.\n + G_table-tooltip(Use mouse or Shift + Arrow Keys to make selections.\n Sum of selected values is shown.); // Row select toggle button G_rowselect = new Fl_Toggle_Button(140,10,12,12,Row selection); @@ -186,6 +168,7 @@ G_sum = new Fl_Output(140,G_table-y()+G_table-h()+10,160,25,Selection Sum:); G_sum-value((nothing selected)); G_sum-color(48); + G_sum-tooltip(This field shows the sum of the selected cells in the table); win.end(); win.resizable(G_table); win.show();
[fltk.commit] [Library] r9838 - branches/branch-1.3/examples
Author: greg.ercolano Date: 2013-03-18 13:00:04 -0700 (Mon, 18 Mar 2013) New Revision: 9838 Log: Added Fl::option() setting to allow arrow keys to navigate table. This example was written before 1.3, and was dependent on the 'old' FLTK behavior where arrow keys could be used to navigate widget focus (in addition to Tab). The 'new' FLTK behavior (1.3 and up) disables arrow key focus nav by default, which is bad for this program, so we enable the old FLTK behavior with Fl::option(). Modified: branches/branch-1.3/examples/table-spreadsheet-with-keyboard-nav.cxx Modified: branches/branch-1.3/examples/table-spreadsheet-with-keyboard-nav.cxx === --- branches/branch-1.3/examples/table-spreadsheet-with-keyboard-nav.cxx 2013-03-17 06:06:52 UTC (rev 9837) +++ branches/branch-1.3/examples/table-spreadsheet-with-keyboard-nav.cxx 2013-03-18 20:00:04 UTC (rev 9838) @@ -290,6 +290,7 @@ } int main() { + Fl::option(Fl::OPTION_ARROW_FOCUS, 1); // we want arrow keys to navigate table's widgets Fl_Double_Window *win = new Fl_Double_Window(922, 382, Fl_Table Spreadsheet with Keyboard Navigation); Spreadsheet* table = new Spreadsheet(20, 20, win-w()-80, win-h()-80); // Table rows ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9837 - branches/branch-1.3/examples
Author: greg.ercolano Date: 2013-03-16 23:06:52 -0700 (Sat, 16 Mar 2013) New Revision: 9837 Log: Small fix to column max width calculation: take into account width of header. Modified: branches/branch-1.3/examples/table-sort.cxx Modified: branches/branch-1.3/examples/table-sort.cxx === --- branches/branch-1.3/examples/table-sort.cxx 2013-03-17 05:24:58 UTC (rev 9836) +++ branches/branch-1.3/examples/table-sort.cxx 2013-03-17 06:06:52 UTC (rev 9837) @@ -39,7 +39,7 @@ #ifdef WIN32 // WINDOWS # define DIRCMD dir -# define DIRHEADER { Date, Time, Size, Filename, , , , , } +static const char *G_header[] = { Date, Time, Size, Filename, , , , , , 0 }; # ifdef _MSC_VER #define popen _popen # endif @@ -47,9 +47,15 @@ // UNIX # include ctype.h # define DIRCMD ls -l -# define DIRHEADER { Perms, #L, Own, Group, Size, Date, , , Filename } +static const char *G_header[] = { Perms, #L, Own, Group, Size, Date, , , Filename, 0 }; #endif /*WIN32*/ +// Font face/sizes for header and rows +#define HEADER_FONTFACE FL_HELVETICA_BOLD +#define HEADER_FONTSIZE 16 +#define ROW_FONTFACEFL_HELVETICA +#define ROW_FONTSIZE16 + // A single row of columns class Row { public: @@ -147,12 +153,11 @@ switch ( context ) { case CONTEXT_COL_HEADER: fl_push_clip(X,Y,W,H); { -static const char *head[] = DIRHEADER; fl_draw_box(FL_THIN_UP_BOX, X,Y,W,H, FL_BACKGROUND_COLOR); if ( C 9 ) { - fl_font(FL_HELVETICA_BOLD, 16); + fl_font(HEADER_FONTFACE, HEADER_FONTSIZE); fl_color(FL_BLACK); -fl_draw(head[C], X+2,Y,W,H, FL_ALIGN_LEFT, 0, 0); // +2=pad left +fl_draw(G_header[C], X+2,Y,W,H, FL_ALIGN_LEFT, 0, 0); // +2=pad left // Draw sort arrow if ( C == _sort_lastcol ) { draw_sort_arrow(X,Y,W,H); @@ -166,7 +171,7 @@ // Bg color Fl_Color bgcolor = row_selected(R) ? selection_color() : FL_WHITE; fl_color(bgcolor); fl_rectf(X,Y,W,H); - fl_font(FL_HELVETICA, 16); + fl_font(ROW_FONTFACE, ROW_FONTSIZE); fl_color(FL_BLACK); fl_draw(s, X+2,Y,W,H, FL_ALIGN_LEFT); // +2=pad left // Border fl_color(FL_LIGHT2); fl_rect(X,Y,W,H); @@ -181,13 +186,17 @@ // Automatically set column widths to widest data in each column void MyTable::autowidth(int pad) { -fl_font(FL_COURIER, 16); -// Initialize all column widths to lowest value -for ( int c=0; ccols(); c++ ) col_width(c, pad); +int w, h; +// Initialize all column widths to header width +fl_font(HEADER_FONTFACE, HEADER_FONTSIZE); +for ( int c=0; G_header[c]; c++ ) { + w=0; fl_measure(G_header[c], w, h, 0); // pixel width of header text +col_width(c, w+pad); +} +fl_font(ROW_FONTFACE, ROW_FONTSIZE); for ( int r=0; r(int)_rowdata.size(); r++ ) { -int w, h; for ( int c=0; c(int)_rowdata[r].cols.size(); c++ ) { -fl_measure(_rowdata[r].cols[c], w, h, 0); // get pixel width of text +w=0; fl_measure(_rowdata[r].cols[c], w, h, 0); // pixel width of row text if ( (w + pad) col_width(c)) col_width(c, w + pad); } } ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9836 - branches/branch-1.3/src
Author: greg.ercolano Date: 2013-03-16 22:24:58 -0700 (Sat, 16 Mar 2013) New Revision: 9836 Log: Added examples for Fl::option() methods Modified: branches/branch-1.3/src/Fl.cxx Modified: branches/branch-1.3/src/Fl.cxx === --- branches/branch-1.3/src/Fl.cxx 2013-03-10 15:14:03 UTC (rev 9835) +++ branches/branch-1.3/src/Fl.cxx 2013-03-17 05:24:58 UTC (rev 9836) @@ -1931,6 +1931,14 @@ There should be an application that manages options system wide, per user, and per application. + Example: + \code + if ( Fl::option(Fl::OPTION_ARROW_FOCUS) ) + { ..on.. } + else + { ..off.. } + \endcode + \note As of FLTK 1.3.0, options can be managed within fluid, using the menu iEdit/Global FLTK Settings/i. @@ -1992,6 +2000,12 @@ This function does not change any system or user settings. + Example: + \code + Fl::option(Fl::OPTION_ARROW_FOCUS, true); // on + Fl::option(Fl::OPTION_ARROW_FOCUS, false);// off + \endcode + \param opt which option \param val set to true or false \see enum Fl::Fl_Option ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9835 - branches/branch-1.3/test
Author: AlbrechtS Date: 2013-03-10 08:14:03 -0700 (Sun, 10 Mar 2013) New Revision: 9835 Log: make schemes test window resizable. Modified: branches/branch-1.3/test/unittest_schemes.cxx Modified: branches/branch-1.3/test/unittest_schemes.cxx === --- branches/branch-1.3/test/unittest_schemes.cxx 2013-03-08 20:37:00 UTC (rev 9834) +++ branches/branch-1.3/test/unittest_schemes.cxx 2013-03-10 15:14:03 UTC (rev 9835) @@ -53,11 +53,11 @@ st-window()-redraw(); // redraw window } } -public: +public: static Fl_Widget *create() { return new SchemesTest(TESTAREA_X, TESTAREA_Y, TESTAREA_W, TESTAREA_H); } - SchemesTest(int X,int Y,int W,int H) : Fl_Group(X,Y,W,H) { + SchemesTest(int X,int Y,int W,int H) : Fl_Group(X,Y,W,H) { schemechoice = new Fl_Choice(X+125,Y,140,25,FLTK Scheme); schemechoice-add(none); schemechoice-add(plastic); @@ -261,6 +261,7 @@ } // Fl_Text_Editor* o } subwin-end(); +subwin-resizable(subwin); subwin-show(); } }; ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9834 - branches/branch-1.3/test
Author: greg.ercolano Date: 2013-03-08 12:37:00 -0800 (Fri, 08 Mar 2013) New Revision: 9834 Log: Added schemes test to unittests app, to check fltk schemes for artifacts. Added: branches/branch-1.3/test/unittest_schemes.cxx Modified: branches/branch-1.3/test/Makefile branches/branch-1.3/test/unittests.cxx Modified: branches/branch-1.3/test/Makefile === --- branches/branch-1.3/test/Makefile 2013-03-06 22:17:44 UTC (rev 9833) +++ branches/branch-1.3/test/Makefile 2013-03-08 20:37:00 UTC (rev 9834) @@ -274,8 +274,9 @@ # General demos... unittests$(EXEEXT): unittests.o -unittests.cxx: unittest_about.cxx unittest_points.cxx unittest_lines.cxx unittest_circles.cxx \ - unittest_rects.cxx unittest_text.cxx unittest_viewport.cxx unittest_images.cxx +unittests.o: unittests.cxx unittest_about.cxx unittest_points.cxx unittest_lines.cxx unittest_circles.cxx \ + unittest_rects.cxx unittest_text.cxx unittest_viewport.cxx unittest_images.cxx \ + unittest_schemes.cxx adjuster$(EXEEXT): adjuster.o Added: branches/branch-1.3/test/unittest_schemes.cxx === --- branches/branch-1.3/test/unittest_schemes.cxx (rev 0) +++ branches/branch-1.3/test/unittest_schemes.cxx 2013-03-08 20:37:00 UTC (rev 9834) @@ -0,0 +1,272 @@ +// +// $Id$ +// +// Unit tests for the Fast Light Tool Kit (FLTK). +// +// Copyright 1998-2010 by Bill Spitzak and others. +// +// Nods to Edmanuel Torres for the widget layout (STR#2672) +// +// 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 FL/Fl_Choice.H + +// needed by Edmanuel's test layout +#include FL/Fl_Button.H +#include FL/Fl_Tabs.H +#include FL/Fl_Group.H +#include FL/Fl_Clock.H +#include FL/Fl_Progress.H +#include FL/Fl_Slider.H +#include FL/Fl_Scrollbar.H +#include FL/Fl_Value_Slider.H +#include FL/Fl_Value_Output.H +#include FL/Fl_Adjuster.H +#include FL/Fl_Counter.H +#include FL/Fl_Roller.H +#include FL/Fl_Value_Input.H +#include FL/Fl_Input.H +#include FL/Fl_Output.H +#include FL/Fl_Text_Editor.H +#include FL/Fl_Text_Display.H +#include FL/Fl_File_Input.H +#include FL/Fl_Box.H +#include FL/Fl_Light_Button.H +#include FL/Fl_Check_Button.H + +class SchemesTest : public Fl_Group { + Fl_Choice *schemechoice; + static void SchemeChoice_CB(Fl_Widget*,void *data) { +SchemesTest *st = (SchemesTest*)data; +const char *name = st-schemechoice-text(); +if ( name ) { + Fl::scheme(name);// change scheme + st-window()-redraw(); // redraw window +} + } +public: + static Fl_Widget *create() { +return new SchemesTest(TESTAREA_X, TESTAREA_Y, TESTAREA_W, TESTAREA_H); + } + SchemesTest(int X,int Y,int W,int H) : Fl_Group(X,Y,W,H) { +schemechoice = new Fl_Choice(X+125,Y,140,25,FLTK Scheme); +schemechoice-add(none); +schemechoice-add(plastic); +schemechoice-add(gtk+); +//schemechoice-add(gleam); +schemechoice-value(0); +schemechoice-labelfont(FL_HELVETICA_BOLD); +const char *name = Fl::scheme(); +if ( name ) { + if ( strcmp(name, plastic) == 0) { schemechoice-value(1); } + else if ( strcmp(name, gtk+)== 0) { schemechoice-value(2); } + //else if ( strcmp(name, gleam) == 0) { schemechoice-value(3); } +} +schemechoice-callback(SchemeChoice_CB, (void*)this); + +Fl_Window *subwin = new Fl_Window(X,Y+30,W,H-30); +subwin-begin(); +{ + // Pasted from Edmanuel's gleam test app + { Fl_Button* o = new Fl_Button(10, 9, 90, 25, button); + o-box(FL_UP_BOX); + o-color((Fl_Color)101); + o-labelfont(5); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(10, 36, 90, 25, button); + o-box(FL_UP_BOX); + o-color((Fl_Color)179); + o-labelfont(4); + o-labelcolor(FL_BACKGROUND2_COLOR); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(10, 63, 90, 25, button); + o-box(FL_UP_BOX); + o-color((Fl_Color)91); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(10, 90, 90, 25, button); + o-box(FL_UP_BOX); + o-color(FL_INACTIVE_COLOR); + o-labelcolor(FL_BACKGROUND2_COLOR); + } // Fl_Button* o + { Fl_Tabs* o = new Fl_Tabs(10, 120, 320, 215); + o-color(FL_DARK1); + o-selection_color(FL_DARK1); + { Fl_Group* o = new Fl_Group(14, 141, 310, 190, tab1); + //o-box(FL_THIN_UP_BOX); + o-color(FL_DARK1); + o-selection_color((Fl_Color)23); + o-hide(); + { Fl_Clock* o = new Fl_Clock(24, 166, 130, 124); +
[fltk.commit] [Library] r9832 - branches/branch-1.3/src
Author: ianmacarthur Date: 2013-03-06 14:15:01 -0800 (Wed, 06 Mar 2013) New Revision: 9832 Log: This check-in brings in the simplified version of Michael Baeuerle's patch to restore scandir like operation on *nix like hosts that do not provide a native scandir implementation, notably SunOS and some others. STR #2931 refers... These changes are tested to have no effect on OSX, Win32 or Linux systems, and indeed on any system that has a working scandir implementation that configure can detect. Michael has released these changes to the fltk project, and they are licensed under our usual conditons. Added: branches/branch-1.3/src/scandir_posix.c Modified: branches/branch-1.3/src/scandir.c Modified: branches/branch-1.3/src/scandir.c === --- branches/branch-1.3/src/scandir.c 2013-03-01 00:48:00 UTC (rev 9831) +++ branches/branch-1.3/src/scandir.c 2013-03-06 22:15:01 UTC (rev 9832) @@ -21,40 +21,10 @@ #if defined(WIN32) !defined(__CYGWIN__) # include scandir_win32.c #else - -# include flstring.h - -/* NOTE: Most (all?) modern non-WIN32 hosts DO have a usable scandir */ -# if !HAVE_SCANDIR -#include stdlib.h -#include sys/types.h -#include errno.h - -#if HAVE_DIRENT_H -# include dirent.h -# define NAMLEN(dirent) strlen((dirent)-d_name) -#else /* HAVE_DIRENT_H */ -# define dirent direct -# define NAMLEN(dirent) (dirent)-d_namlen -# if HAVE_SYS_NDIR_H -#include sys/ndir.h -# endif /* HAVE_SYS_NDIR_H */ -# if HAVE_SYS_DIR_H -#include sys/dir.h -# endif /* HAVE_SYS_DIR_H */ -# if HAVE_NDIR_H -#include ndir.h -# endif /* HAVE_NDIR_H */ -#endif - -/* This warning added to help identify any non-WIN32 hosts that actually try to use - * our private implementation of the scandir function, which was suspect... */ -#if defined(__GNUC__) -# warning Attempting to use the deprecated scandir() replacement function -#endif /*__GNUC__*/ -#error No compatible scandir implementation found (STR 2687 applies!) - -# endif /* !HAVE_SCANDIR */ +# include ../config.h +# ifndef HAVE_SCANDIR +# include scandir_posix.c +# endif /* HAVE_SCANDIR */ #endif /* Added: branches/branch-1.3/src/scandir_posix.c === --- branches/branch-1.3/src/scandir_posix.c (rev 0) +++ branches/branch-1.3/src/scandir_posix.c 2013-03-06 22:15:01 UTC (rev 9832) @@ -0,0 +1,205 @@ +/* + * $Id$ + * + * This implementation of 'scandir()' is intended to be POSIX.1-2008 compliant. + * A POSIX.1-1990 compliant system is required as minimum base. + * Note: + * The 'const' declarations were removed to match FLTK 1.3 wrapper (STR #2931) + * + * Copyright (c) 2013 by Michael Baeuerle + * + * 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 + * + * It is required that 'SIZE_MAX' is at least 'INT_MAX'. + * Don't use a C++ compiler to build this module. + * + * The build system must define 'HAVE_PTHREAD' and link against a potentially + * required library to switch this implementation into thread-safe mode. + * The POSIX.1c-1995 extension is required if 'HAVE_PTHREAD' is defined. + * + * Note: + * In theory, a system that provide threads should also provide 'readdir_r()', + * a thread-safe version of 'readdir()'. In reality this is not always the case. + * In addition there may be a race condition that can lead to a buffer overflow: + * http://womble.decadent.org.uk/readdir_r-advisory.html + */ + +#ifndef HAVE_PTHREAD + /* Switch system headers into POSIX.1-1990 mode */ +# define _POSIX_SOURCE +#else /* HAVE_PTHREAD */ + /* Switch system headers into POSIX.1c-1995 mode */ +# define _POSIX_C_SOURCE 199506L +#endif /* HAVE_PTHREAD */ + +#include sys/types.h/* XPG2 require this for '*dir()' functions */ +#include dirent.h +#include errno.h +#include stdlib.h /* For 'malloc()', 'realloc()' and 'qsort()' */ +#include stddef.h /* For 'offsetof()', 'NULL' and 'size_t' */ +#include limits.h /* For 'INT_MAX' */ +#include string.h /* For 'memcpy()' */ +#if defined(HAVE_PTHREAD) defined(HAVE_PTHREAD_H) +# include pthread.h +#endif /* HAVE_PTHREAD */ + + +/* == */ +/* At startup allocate memory for this number of result array elements */ +#define ENTRIES_MIN (size_t) 32 + + +/* == */ +#ifdef HAVE_PTHREAD +static pthread_mutex_t scandir_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif
[fltk.commit] [Library] r9833 - branches/branch-1.3/src
Author: ianmacarthur Date: 2013-03-06 14:17:44 -0800 (Wed, 06 Mar 2013) New Revision: 9833 Log: Oops! Forgot to update the copyright date. Modified: branches/branch-1.3/src/scandir.c Modified: branches/branch-1.3/src/scandir.c === --- branches/branch-1.3/src/scandir.c 2013-03-06 22:15:01 UTC (rev 9832) +++ branches/branch-1.3/src/scandir.c 2013-03-06 22:17:44 UTC (rev 9833) @@ -1,10 +1,10 @@ /* * $Id$ * - * This is a placekeeper stub that puuls in scandir implementations for host + * This is a placekeeper stub that pulls in scandir implementations for host * systems that do not provide a compatible one natively * - * Copyright 1998-2010 by Bill Spitzak and others. + * Copyright 1998-2013 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 ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9829 - branches/branch-1.3/src
Author: AlbrechtS Date: 2013-02-28 15:16:27 -0800 (Thu, 28 Feb 2013) New Revision: 9829 Log: Update version number in src/Makefile (STR #2932). Modified: branches/branch-1.3/src/Makefile Modified: branches/branch-1.3/src/Makefile === --- branches/branch-1.3/src/Makefile2013-02-25 17:29:54 UTC (rev 9828) +++ branches/branch-1.3/src/Makefile2013-02-28 23:16:27 UTC (rev 9829) @@ -245,7 +245,7 @@ echo $(DSOCOMMAND) $@ ... $(DSOCOMMAND) $@ \ -install_name $(libdir)/$@ \ - -current_version 1.3.1 \ + -current_version 1.3.2 \ -compatibility_version 1.3.0 \ $(OBJECTS) $(LDLIBS) $(RM) libfltk.dylib @@ -281,7 +281,7 @@ echo $(DSOCOMMAND) $@ ... $(DSOCOMMAND) $@ \ -install_name $(libdir)/$@ \ - -current_version 1.3.1 \ + -current_version 1.3.2 \ -compatibility_version 1.3.0 \ $(FLOBJECTS) -L. $(LDLIBS) -lfltk $(RM) libfltk_forms.dylib @@ -317,7 +317,7 @@ echo $(DSOCOMMAND) $@ ... $(DSOCOMMAND) $@ \ -install_name $(libdir)/$@ \ - -current_version 1.3.1 \ + -current_version 1.3.2 \ -compatibility_version 1.3.0 \ $(GLOBJECTS) -L. $(GLDLIBS) -lfltk $(RM) libfltk_gl.dylib @@ -353,7 +353,7 @@ echo $(DSOCOMMAND) $@ ... $(DSOCOMMAND) $@ \ -install_name $(libdir)/$@ \ - -current_version 1.3.1 \ + -current_version 1.3.2 \ -compatibility_version 1.3.0 \ $(IMGOBJECTS) -L. $(LDLIBS) $(IMAGELIBS) -lfltk $(RM) libfltk_images.dylib ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9830 - in branches/branch-1.3: . cairo
Author: AlbrechtS Date: 2013-02-28 16:40:53 -0800 (Thu, 28 Feb 2013) New Revision: 9830 Log: Update even more version numbers. Modified: branches/branch-1.3/CREDITS branches/branch-1.3/cairo/Makefile Modified: branches/branch-1.3/CREDITS === --- branches/branch-1.3/CREDITS 2013-02-28 23:16:27 UTC (rev 9829) +++ branches/branch-1.3/CREDITS 2013-03-01 00:40:53 UTC (rev 9830) @@ -1,4 +1,4 @@ -CREDITS - Fast Light Tool Kit (FLTK) Version 1.3.0 +CREDITS - Fast Light Tool Kit (FLTK) Version 1.3.2 -- This file lists the people responsible for the toolkit you Modified: branches/branch-1.3/cairo/Makefile === --- branches/branch-1.3/cairo/Makefile 2013-02-28 23:16:27 UTC (rev 9829) +++ branches/branch-1.3/cairo/Makefile 2013-03-01 00:40:53 UTC (rev 9830) @@ -53,7 +53,7 @@ echo $(DSOCOMMAND) $@ ... $(DSOCOMMAND) $@ \ -install_name $(libdir)/$@ \ - -current_version 1.3.0 \ + -current_version 1.3.2 \ -compatibility_version 1.3.0 \ $(CAIROOBJECTS) -L../src $(LDLIBS) $(CAIROLIBS) -lfltk $(RM) libfltk_cairo.dylib ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9831 - branches/branch-1.3
Author: AlbrechtS Date: 2013-02-28 16:48:00 -0800 (Thu, 28 Feb 2013) New Revision: 9831 Log: Update another, probably the last remaining old version number. Modified: branches/branch-1.3/README Modified: branches/branch-1.3/README === --- branches/branch-1.3/README 2013-03-01 00:40:53 UTC (rev 9830) +++ branches/branch-1.3/README 2013-03-01 00:48:00 UTC (rev 9831) @@ -1,4 +1,4 @@ -README - Fast Light Tool Kit (FLTK) Version 1.3.0 +README - Fast Light Tool Kit (FLTK) Version 1.3.2 - WHAT IS FLTK? @@ -18,7 +18,7 @@ FLTK comes with complete free source code. FLTK is available under the terms of the GNU Library General Public License. Contrary to popular belief, it can be used in commercial -software! (Even Bill Gates could use it.) +software! (Even Bill Gates could use it.) ON-LINE DOCUMENTATION @@ -79,7 +79,7 @@ install. This will copy the fluid executable to bindir, the header files to includedir, and the library files to libdir. - + To install additional files and icons to be used by the main desktop environments such as KDE, GNOME and XFCE, you will also need to run make install-desktop as root. @@ -87,7 +87,7 @@ BUILDING FLTK UNDER MICROSOFT WINDOWS -There are two ways to build FLTK under Microsoft Windows. +There are two ways to build FLTK under Microsoft Windows. The first is to use the Visual C++ project files under the ide/ directory. See the file ide/README.IDE for more info. @@ -145,8 +145,8 @@ COPYRIGHT -FLTK is copyright 1998-2011 by Bill Spitzak -(spit...@users.sourceforge.net) and others, +FLTK is copyright 1998-2013 by Bill Spitzak +(spit...@users.sourceforge.net) and others, see the CREDITS file for more info. This library is free software. Distribution and use rights are ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9828 - in branches/branch-3.0: include/fltk3 src/fltk3
Author: manolo Date: 2013-02-25 09:29:54 -0800 (Mon, 25 Feb 2013) New Revision: 9828 Log: Added option fltk3::NativeFileChooser::USE_FILTER_EXT as done in 1.3 Modified: branches/branch-3.0/include/fltk3/NativeFileChooser.h branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm branches/branch-3.0/src/fltk3/x11NativeFileChooser.cxx Modified: branches/branch-3.0/include/fltk3/NativeFileChooser.h === --- branches/branch-3.0/include/fltk3/NativeFileChooser.h 2013-02-20 10:27:47 UTC (rev 9827) +++ branches/branch-3.0/include/fltk3/NativeFileChooser.h 2013-02-25 17:29:54 UTC (rev 9828) @@ -125,7 +125,8 @@ NO_OPTIONS = 0x, /// no options enabled SAVEAS_CONFIRM = 0x0001, /// Show native 'Save As' overwrite confirm dialog (if supported) NEW_FOLDER = 0x0002, /// Show 'New Folder' icon (if supported) - PREVIEW= 0x0004 /// enable preview mode + PREVIEW= 0x0004, /// enable preview mode + USE_FILTER_EXT = 0x0008 /// Chooser filter pilots the output file extension }; /** Localizable message */ static const char *file_exists_message; Modified: branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm === --- branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm 2013-02-20 10:27:47 UTC (rev 9827) +++ branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm 2013-02-25 17:29:54 UTC (rev 9828) @@ -631,9 +631,11 @@ char *t = prepareMacFilter(_filt_total, _filter, _filt_patt); popup = createPopupAccessory((NSSavePanel*)_panel, t, [[(NSSavePanel*)_panel nameFieldLabel] UTF8String], _filt_value); delete[] t; - [popup setAction:@selector(changedPopup:)]; - [popup setTarget:saveDelegate]; - [saveDelegate panel:(NSSavePanel*)_panel]; + if (_options USE_FILTER_EXT) { + [popup setAction:@selector(changedPopup:)]; + [popup setTarget:saveDelegate]; + [saveDelegate panel:(NSSavePanel*)_panel]; + } [(NSSavePanel*)_panel setCanSelectHiddenExtension:YES]; } } Modified: branches/branch-3.0/src/fltk3/x11NativeFileChooser.cxx === --- branches/branch-3.0/src/fltk3/x11NativeFileChooser.cxx 2013-02-20 10:27:47 UTC (rev 9827) +++ branches/branch-3.0/src/fltk3/x11NativeFileChooser.cxx 2013-02-25 17:29:54 UTC (rev 9828) @@ -132,6 +132,7 @@ NEW_FOLDERShows the 'New Folder' button.Ignored Used Used PREVIEW Enables the 'Preview' mode by default.Ignored Ignored Used SAVEAS_CONFIRMConfirm dialog if BROWSE_SAVE_FILE file exists. Used Used Used + USE_FILTER_EXTChooser filter pilots the output file extension. Ignored Used Ignored \endcode */ void fltk3::NativeFileChooser::options(int val) { ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9827 - branches/branch-1.3/fluid
Author: ianmacarthur Date: 2013-02-20 02:27:47 -0800 (Wed, 20 Feb 2013) New Revision: 9827 Log: Typo: It turns out that when we stepped the version number up to 1.3.2, we didn't change the hard coded value in fluid's about_panel. Though: Why is this value hard-coded anyway? Should fluid not be picking that up from Enumerations.h at build time, or something? Modified: branches/branch-1.3/fluid/about_panel.cxx branches/branch-1.3/fluid/about_panel.fl branches/branch-1.3/fluid/about_panel.h Modified: branches/branch-1.3/fluid/about_panel.cxx === --- branches/branch-1.3/fluid/about_panel.cxx 2013-02-19 15:25:17 UTC (rev 9826) +++ branches/branch-1.3/fluid/about_panel.cxx 2013-02-20 10:27:47 UTC (rev 9827) @@ -16,7 +16,7 @@ // http://www.fltk.org/str.php // -// generated by Fast Light User Interface Designer (fluid) version 1.0300 +// generated by Fast Light User Interface Designer (fluid) version 1.0302 #include about_panel.h void show_help(const char *name); @@ -269,7 +269,7 @@ { Fl_Box* o = new Fl_Box(10, 10, 115, 120); o-image(image_fluid); } // Fl_Box* o -{ Fl_Box* o = new Fl_Box(135, 10, 200, 70, FLTK User\nInterface Designer\nVersion 1.3.1); +{ Fl_Box* o = new Fl_Box(135, 10, 200, 70, FLTK User\nInterface Designer\nVersion 1.3.2); o-color((Fl_Color)12); o-selection_color(FL_DARK1); o-labelfont(1); Modified: branches/branch-1.3/fluid/about_panel.fl === --- branches/branch-1.3/fluid/about_panel.fl2013-02-19 15:25:17 UTC (rev 9826) +++ branches/branch-1.3/fluid/about_panel.fl2013-02-20 10:27:47 UTC (rev 9827) @@ -1,5 +1,5 @@ # data file for the Fltk User Interface Designer (fluid) -version 1.0300 +version 1.0302 header_name {.h} code_name {.cxx} comment {// @@ -25,10 +25,11 @@ decl {void show_help(const char *name);} {public local } -Function {make_about_panel()} {} { +Function {make_about_panel()} {open +} { Fl_Window about_panel { label {About FLUID} open -xywh {419 216 345 180} type Double color 50 selection_color 47 hotspot non_modal visible +xywh {680 247 345 180} type Double color 50 selection_color 47 hotspot non_modal visible } { Fl_Box {} { image {icons/fluid-96.xpm} xywh {10 10 115 120} @@ -36,7 +37,7 @@ Fl_Box {} { label {FLTK User Interface Designer -Version 1.3.1} +Version 1.3.2} selected xywh {135 10 200 70} color 12 selection_color 47 labelfont 1 labelsize 18 align 21 } Fl_Box {} { Modified: branches/branch-1.3/fluid/about_panel.h === --- branches/branch-1.3/fluid/about_panel.h 2013-02-19 15:25:17 UTC (rev 9826) +++ branches/branch-1.3/fluid/about_panel.h 2013-02-20 10:27:47 UTC (rev 9827) @@ -16,7 +16,7 @@ // http://www.fltk.org/str.php // -// generated by Fast Light User Interface Designer (fluid) version 1.0300 +// generated by Fast Light User Interface Designer (fluid) version 1.0302 #ifndef about_panel_h #define about_panel_h ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9825 - in branches/branch-1.3: FL src
Author: manolo Date: 2013-02-19 07:19:58 -0800 (Tue, 19 Feb 2013) New Revision: 9825 Log: Introduced new Fl_Native_File_Chooser option USE_FILTER_EXT. Modified: branches/branch-1.3/FL/Fl_Native_File_Chooser.H branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm Modified: branches/branch-1.3/FL/Fl_Native_File_Chooser.H === --- branches/branch-1.3/FL/Fl_Native_File_Chooser.H 2013-02-14 18:40:04 UTC (rev 9824) +++ branches/branch-1.3/FL/Fl_Native_File_Chooser.H 2013-02-19 15:19:58 UTC (rev 9825) @@ -116,7 +116,8 @@ NO_OPTIONS = 0x, /// no options enabled SAVEAS_CONFIRM = 0x0001, /// Show native 'Save As' overwrite confirm dialog (if supported) NEW_FOLDER = 0x0002, /// Show 'New Folder' icon (if supported) -PREVIEW= 0x0004/// enable preview mode +PREVIEW= 0x0004, /// enable preview mode +USE_FILTER_EXT = 0x0008/// Chooser filter pilots the output file extension }; /** Localizable message */ static const char *file_exists_message; Modified: branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm === --- branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm 2013-02-14 18:40:04 UTC (rev 9824) +++ branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm 2013-02-19 15:19:58 UTC (rev 9825) @@ -621,9 +621,11 @@ char *t = prepareMacFilter(_filt_total, _filter, _filt_patt); popup = createPopupAccessory((NSSavePanel*)_panel, t, [[(NSSavePanel*)_panel nameFieldLabel] UTF8String], _filt_value); delete[] t; - [popup setAction:@selector(changedPopup:)]; - [popup setTarget:saveDelegate]; - [saveDelegate panel:(NSSavePanel*)_panel]; + if (_options USE_FILTER_EXT) { + [popup setAction:@selector(changedPopup:)]; + [popup setTarget:saveDelegate]; + [saveDelegate panel:(NSSavePanel*)_panel]; + } [(NSSavePanel*)_panel setCanSelectHiddenExtension:YES]; } } ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9826 - branches/branch-1.3/src
Author: manolo Date: 2013-02-19 07:25:17 -0800 (Tue, 19 Feb 2013) New Revision: 9826 Log: Introduced new Fl_Native_File_Chooser option USE_FILTER_EXT. Modified: branches/branch-1.3/src/Fl_Native_File_Chooser_FLTK.cxx Modified: branches/branch-1.3/src/Fl_Native_File_Chooser_FLTK.cxx === --- branches/branch-1.3/src/Fl_Native_File_Chooser_FLTK.cxx 2013-02-19 15:19:58 UTC (rev 9825) +++ branches/branch-1.3/src/Fl_Native_File_Chooser_FLTK.cxx 2013-02-19 15:25:17 UTC (rev 9826) @@ -123,6 +123,7 @@ NEW_FOLDERShows the 'New Folder' button.Ignored Used Used PREVIEW Enables the 'Preview' mode by default.Ignored Ignored Used SAVEAS_CONFIRMConfirm dialog if BROWSE_SAVE_FILE file exists. Used Used Used + USE_FILTER_EXTChooser filter pilots the output file extension. Ignored Used Ignored \endcode */ void Fl_Native_File_Chooser::options(int val) { ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [WWW] r686 - trunk
Author: matt Date: 2013-02-17 04:03:51 -0800 (Sun, 17 Feb 2013) New Revision: 686 Log: Temporarily removed nightly builds. I am moving, taing the servers with. It will likely take two weeks until I can go back online. Modified: trunk/index.php Modified: trunk/index.php === --- trunk/index.php 2012-12-10 12:09:50 UTC (rev 685) +++ trunk/index.php 2013-02-17 12:03:51 UTC (rev 686) @@ -56,8 +56,10 @@ . $revisions[fltk-3.0.x] . 'v3.0.x-r . $revisions[fltk-3.0.x] . /a/td/tr); ? +!-- trtd align='right' nowrapNightly Builds::/td tda href='http://evbuilder.de/jenkins'View Link/a/td/tr +-- trtd align='right' nowrapDeveloper Roadmap:/td tda href='roadmap.php'View/a/td/tr /table ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9824 - branches/branch-1.3/src
Author: greg.ercolano Date: 2013-02-14 10:40:04 -0800 (Thu, 14 Feb 2013) New Revision: 9824 Log: Fixes STR#2930: Applying Chris's patch to fix d+d of text selections from Firefox/Thunderbird - FLTK. Also applied Greg's fix for d+d of utf8 text in same use case. Modified: branches/branch-1.3/src/Fl_x.cxx Modified: branches/branch-1.3/src/Fl_x.cxx === --- branches/branch-1.3/src/Fl_x.cxx2013-02-12 14:33:48 UTC (rev 9823) +++ branches/branch-1.3/src/Fl_x.cxx2013-02-14 18:40:04 UTC (rev 9824) @@ -319,6 +319,7 @@ //Atom fl_XdndProxy; Atom fl_XdndURIList; Atom fl_Xatextplainutf; +Atom fl_Xatextplainutf2; // STR#2930 Atom fl_Xatextplain; static Atom fl_XaText; Atom fl_XaCompoundText; @@ -621,6 +622,7 @@ fl_XdndEnter = XInternAtom(d, XdndEnter, 0); fl_XdndURIList= XInternAtom(d, text/uri-list, 0); fl_Xatextplainutf = XInternAtom(d, text/plain;charset=UTF-8,0); + fl_Xatextplainutf2= XInternAtom(d, text/plain;charset=utf-8,0); // Firefox/Thunderbird needs this - See STR#2930 fl_Xatextplain= XInternAtom(d, text/plain, 0); fl_XaText = XInternAtom(d, TEXT,0); fl_XaCompoundText = XInternAtom(d, COMPOUND_TEXT, 0); @@ -1023,13 +1025,17 @@ Atom type = XA_STRING; for (unsigned i = 0; icount; i++) { Atom t = ((Atom*)portion)[i]; - if (t == fl_Xatextplainutf || - t == fl_Xatextplain || - t == fl_XaUtf8String) {type = t; break;} - // rest are only used if no utf-8 available: - if (t == fl_XaText || - t == fl_XaTextUriList || - t == fl_XaCompoundText) type = t; + if (t == fl_Xatextplainutf || + t == fl_Xatextplainutf2 || + t == fl_Xatextplain || + t == fl_XaUtf8String) { + type = t; + break; + } + // rest are only used if no utf-8 available: + if (t == fl_XaText || + t == fl_XaTextUriList || + t == fl_XaCompoundText) type = t; } XFree(portion); Atom property = xevent.xselection.property; @@ -1096,7 +1102,8 @@ e.target == fl_XaCompoundText || e.target == fl_XaText || e.target == fl_Xatextplain || -e.target == fl_Xatextplainutf) { +e.target == fl_Xatextplainutf || +e.target == fl_Xatextplainutf2) { // clobber the target type, this seems to make some applications // behave that insist on asking for XA_TEXT instead of UTF8_STRING // Does not change XA_STRING as that breaks xclipboard. @@ -1186,24 +1193,25 @@ } // Loop through the source types and pick the first text type... - int i; - - for (i = 0; fl_dnd_source_types[i]; i ++) - { -//printf(fl_dnd_source_types[%d] = %ld (%s)\n, i, -// fl_dnd_source_types[i], -// XGetAtomName(fl_display, fl_dnd_source_types[i])); - -if (!strncmp(XGetAtomName(fl_display, fl_dnd_source_types[i]), - text/, 5)) + unsigned i; + Atom type = ((Atom*)fl_dnd_source_types)[0]; + for (i = 0; fl_dnd_source_types[i]; i ++) { +Atom t = ((Atom*)fl_dnd_source_types)[i]; + //printf(fl_dnd_source_types[%d]=%ld(%s)\n,i,t,XGetAtomName(fl_display,t)); +if (t == fl_Xatextplainutf || // text/plain;charset=UTF-8 +t == fl_Xatextplainutf2 || // text/plain;charset=utf-8 -- See STR#2930 +t == fl_Xatextplain || // text/plain +t == fl_XaUtf8String) {// UTF8_STRING + type = t; break; + } +// rest are only used if no utf-8 available: +if (t == fl_XaText || // TEXT +t == fl_XaTextUriList || // text/uri-list +t == fl_XaCompoundText) type = t; // COMPOUND_TEXT } + fl_dnd_type = type; - if (fl_dnd_source_types[i]) -fl_dnd_type = fl_dnd_source_types[i]; - else -fl_dnd_type = fl_dnd_source_types[0]; - event = FL_DND_ENTER; Fl::e_text = unknown; Fl::e_length = unknown_len; ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9821 - branches/branch-1.3/src
Author: manolo Date: 2013-02-12 05:20:11 -0800 (Tue, 12 Feb 2013) New Revision: 9821 Log: Mac OS Fl_Native_File_Chooser: when saving with multiple filters, changing the file type changes the output file extension in the dialog window. Modified: branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm Modified: branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm === --- branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm 2013-02-11 12:13:59 UTC (rev 9820) +++ branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm 2013-02-12 13:20:11 UTC (rev 9821) @@ -344,8 +344,7 @@ int Fl_Native_File_Chooser::get_saveas_basename(void) { char *q = strdup( [[[(NSSavePanel*)_panel URL] path] UTF8String] ); - id delegate = [(NSSavePanel*)_panel delegate]; - if (delegate != nil) { + if ( !(_options SAVEAS_CONFIRM) ) { const char *d = (NSSavePanel*)_panel URL] path] stringByDeletingLastPathComponent] UTF8String]; int l = strlen(d) + 1; if (strcmp(d, /) == 0) l = 1; @@ -435,17 +434,53 @@ NSOpenSavePanelDelegate #endif { + NSSavePanel *dialog; + BOOL saveas_confirm; } - (NSString *)panel:(id)sender userEnteredFilename:(NSString *)filename confirmed:(BOOL)okFlag; +- (void)changedPopup:(id)sender; +- (void)panel:(NSSavePanel*)p; +- (void)option:(BOOL)o; @end @implementation FLsaveDelegate - (NSString *)panel:(id)sender userEnteredFilename:(NSString *)filename confirmed:(BOOL)okFlag { - if (! okFlag) return filename; + if ( !okFlag || saveas_confirm ) return filename; // User has clicked save, and no overwrite confirmation should occur. // To get the latter, we need to change the name we return (hence the prefix): return [@ UNLIKELYPREFIX stringByAppendingString:filename]; } +- (void)changedPopup:(id)sender +// runs when the save panel popup menu changes output file type +// correspondingly changes the extension of the output file name +{ + if (fl_mac_os_version 100600) return; // because of setNameFieldStringValue and nameFieldStringValue + char *s = strdup([[(NSPopUpButton*)sender titleOfSelectedItem] UTF8String]); + if (!s) return; + char *p = strchr(s, '('); + if (!p) p = s; + p = strchr(p, '.'); + if (!p) {free(s); return;} + p++; + while (*p == ' ') p++; + if (!p || *p == '{') {free(s); return;} + char *q = p+1; + while (*q != ' ' *q != ')' *q != 0) q++; + *q = 0; + NSString *ns = [NSString stringWithFormat:@%@.%@, + [[dialog performSelector:@selector(nameFieldStringValue)] stringByDeletingPathExtension], + [NSString stringWithUTF8String:p]]; + free(s); + [dialog performSelector:@selector(setNameFieldStringValue:) withObject:ns]; +} +- (void)panel:(NSSavePanel*)p +{ + dialog = p; +} +- (void) option:(BOOL)o +{ + saveas_confirm = o; +} @end static NSPopUpButton *createPopupAccessory(NSSavePanel *panel, const char *filter, const char *title, int rank) @@ -541,7 +576,6 @@ _panel = [NSSavePanel savePanel]; break; } - int retval; NSString *nstitle = [NSString stringWithUTF8String: (_title ? _title : No Title)]; [(NSSavePanel*)_panel setTitle:nstitle]; switch (_btype) { @@ -561,8 +595,9 @@ // SHOW THE DIALOG NSWindow *key = [NSApp keyWindow]; - if ( [(NSSavePanel*)_panel isKindOfClass:[NSOpenPanel class]] ) { -NSPopUpButton *popup = nil; + BOOL is_open_panel = [(NSSavePanel*)_panel isKindOfClass:[NSOpenPanel class]]; + NSPopUpButton *popup = nil; + if ( is_open_panel ) { if (_filt_total) { char *t = prepareMacFilter(_filt_total, _filter, _filt_patt); popup = createPopupAccessory((NSSavePanel*)_panel, t, Fl_File_Chooser::show_label, 0); @@ -571,48 +606,42 @@ [popup addItemWithTitle:[[NSString alloc] initWithUTF8String:Fl_File_Chooser::all_files_label]]; [popup setAction:@selector(validateVisibleColumns)]; [popup setTarget:(NSObject*)_panel]; - static FLopenDelegate *openDelegate = nil; - if (openDelegate == nil) { - // not to be ever freed - openDelegate = [[FLopenDelegate alloc] init]; - } + FLopenDelegate *openDelegate = [[[FLopenDelegate alloc] init] autorelease]; [openDelegate setPopup:popup filter_pattern:_filt_patt]; [(NSOpenPanel*)_panel setDelegate:openDelegate]; } -retval = runmodal(); -if (_filt_total) { - _filt_value = [popup indexOfSelectedItem]; -} -if ( retval == NSOKButton ) { - clear_pathnames(); - NSArray *array = [(NSOpenPanel*)_panel URLs]; - _tpathnames = [array count]; - _pathnames = new char*[_tpathnames]; - for(int i = 0; i _tpathnames; i++) { - _pathnames[i] = strnew([[(NSURL*)[array objectAtIndex:i] path] UTF8String]); - } -} } else { -NSPopUpButton *popup = nil; +FLsaveDelegate *saveDelegate = [[[FLsaveDelegate alloc] init] autorelease]; [(NSSavePanel*)_panel
[fltk.commit] [Library] r9822 - branches/branch-3.0/src/fltk3
Author: manolo Date: 2013-02-12 05:58:07 -0800 (Tue, 12 Feb 2013) New Revision: 9822 Log: Mac OS fltk3::NativeFileChooser: when saving with multiple filters, changing the file type changes the output file extension in the dialog window. Modified: branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm Modified: branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm === --- branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm 2013-02-12 13:20:11 UTC (rev 9821) +++ branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm 2013-02-12 13:58:07 UTC (rev 9822) @@ -353,8 +353,7 @@ int fltk3::NativeFileChooser::get_saveas_basename(void) { char *q = strdup( [[[(NSSavePanel*)_panel URL] path] UTF8String] ); - id delegate = [(NSSavePanel*)_panel delegate]; - if (delegate != nil) { + if ( !(_options SAVEAS_CONFIRM) ) { const char *d = (NSSavePanel*)_panel URL] path] stringByDeletingLastPathComponent] UTF8String]; int l = strlen(d) + 1; if (strcmp(d, /) == 0) l = 1; @@ -444,17 +443,53 @@ NSOpenSavePanelDelegate #endif { + NSSavePanel *dialog; + BOOL saveas_confirm; } - (NSString *)panel:(id)sender userEnteredFilename:(NSString *)filename confirmed:(BOOL)okFlag; +- (void)changedPopup:(id)sender; +- (void)panel:(NSSavePanel*)p; +- (void)option:(BOOL)o; @end @implementation FLsaveDelegate - (NSString *)panel:(id)sender userEnteredFilename:(NSString *)filename confirmed:(BOOL)okFlag { - if (! okFlag) return filename; + if (! okFlag || saveas_confirm ) return filename; // User has clicked save, and no overwrite confirmation should occur. // To get the latter, we need to change the name we return (hence the prefix): return [@ UNLIKELYPREFIX stringByAppendingString:filename]; } +- (void)changedPopup:(id)sender +// runs when the save panel popup menu changes output file type +// correspondingly changes the extension of the output file name +{ + if (fl_mac_os_version 100600) return; // because of setNameFieldStringValue and nameFieldStringValue + char *s = strdup([[(NSPopUpButton*)sender titleOfSelectedItem] UTF8String]); + if (!s) return; + char *p = strchr(s, '('); + if (!p) p = s; + p = strchr(p, '.'); + if (!p) {free(s); return;} + p++; + while (*p == ' ') p++; + if (!p || *p == '{') {free(s); return;} + char *q = p+1; + while (*q != ' ' *q != ')' *q != 0) q++; + *q = 0; + NSString *ns = [NSString stringWithFormat:@%@.%@, + [[dialog performSelector:@selector(nameFieldStringValue)] stringByDeletingPathExtension], + [NSString stringWithUTF8String:p]]; + free(s); + [dialog performSelector:@selector(setNameFieldStringValue:) withObject:ns]; +} +- (void)panel:(NSSavePanel*)p +{ + dialog = p; +} +- (void) option:(BOOL)o +{ + saveas_confirm = o; +} @end static NSPopUpButton *createPopupAccessory(NSSavePanel *panel, const char *filter, const char *title, int rank) @@ -550,7 +585,6 @@ _panel = [NSSavePanel savePanel]; break; } - int retval; NSString *nstitle = [NSString stringWithUTF8String: (_title ? _title : No Title)]; [(NSSavePanel*)_panel setTitle:nstitle]; switch (_btype) { @@ -570,7 +604,9 @@ // SHOW THE DIALOG NSWindow *key = [NSApp keyWindow]; - if ( [(NSSavePanel*)_panel isKindOfClass:[NSOpenPanel class]] ) { + BOOL is_open_panel = [(NSSavePanel*)_panel isKindOfClass:[NSOpenPanel class]]; + NSPopUpButton *popup = nil; + if ( is_open_panel ) { NSPopUpButton *popup = nil; if (_filt_total) { char *t = prepareMacFilter(_filt_total, _filter, _filt_patt); @@ -580,48 +616,42 @@ [popup addItemWithTitle:[[NSString alloc] initWithUTF8String:fltk3::FileChooser::all_files_label]]; [popup setAction:@selector(validateVisibleColumns)]; [popup setTarget:(NSObject*)_panel]; - static FLopenDelegate *openDelegate = nil; - if (openDelegate == nil) { - // not to be ever freed - openDelegate = [[FLopenDelegate alloc] init]; - } + FLopenDelegate *openDelegate = [[[FLopenDelegate alloc] init] autorelease]; [openDelegate setPopup:popup filter_pattern:_filt_patt]; [(NSOpenPanel*)_panel setDelegate:openDelegate]; } -retval = runmodal(); -if (_filt_total) { - _filt_value = [popup indexOfSelectedItem]; -} -if ( retval == NSOKButton ) { - clear_pathnames(); - NSArray *array = [(NSOpenPanel*)_panel URLs]; - _tpathnames = [array count]; - _pathnames = new char*[_tpathnames]; - for(int i = 0; i _tpathnames; i++) { - _pathnames[i] = strnew([[(NSURL*)[array objectAtIndex:i] path] UTF8String]); - } -} } else { -NSPopUpButton *popup = nil; +FLsaveDelegate *saveDelegate = [[[FLsaveDelegate alloc] init] autorelease]; [(NSSavePanel*)_panel setAllowsOtherFileTypes:YES]; -if ( !(_options SAVEAS_CONFIRM) ) { - static FLsaveDelegate
[fltk.commit] [Library] r9823 - branches/branch-1.3
Author: manolo Date: 2013-02-12 06:33:48 -0800 (Tue, 12 Feb 2013) New Revision: 9823 Log: Added changes in Mac version of Fl_Native_File_Chooser. Modified: branches/branch-1.3/CHANGES Modified: branches/branch-1.3/CHANGES === --- branches/branch-1.3/CHANGES 2013-02-12 13:58:07 UTC (rev 9822) +++ branches/branch-1.3/CHANGES 2013-02-12 14:33:48 UTC (rev 9823) @@ -5,6 +5,8 @@ and input of languages with large character sets (e.g., Chinese and Japanese). This implementation has been reported to work well for Chinese. Superficial testing suggests it's also operational for Japanese. In-depth testing remains needed though. + - Mac OS version of Fl_Native_File_Chooser: when using filters in a save file dialog, + the output file extension gets changed when the user modifies the output file type. CHANGES IN FLTK 1.3.2 @@ -17,7 +19,7 @@ - Documented how to make a Mac OS X FLTK application launchable by dropping files on its icon. - Fixed a Mac-specific issue appeared with OS 10.8 (Mountain Lion): long delay before opening when the application is started by dragging a file on the application icon. - - Fixed use of PNG image from im-memory data (STR #2884). + - Fixed use of PNG image from in-memory data (STR #2884). - Added static Fl_RGB_Image::max_size(size_t) to limit the maximum memory size allowed to RGB images (STR #2881). ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9819 - branches/branch-1.3/src
Author: manolo Date: 2013-02-11 04:11:30 -0800 (Mon, 11 Feb 2013) New Revision: 9819 Log: Mac OS save file dialog: display extension of preset file. Modified: branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm Modified: branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm === --- branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm 2013-02-09 14:16:47 UTC (rev 9818) +++ branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm 2013-02-11 12:11:30 UTC (rev 9819) @@ -606,6 +606,7 @@ char *t = prepareMacFilter(_filt_total, _filter, _filt_patt); popup = createPopupAccessory((NSSavePanel*)_panel, t, [[(NSSavePanel*)_panel nameFieldLabel] UTF8String], _filt_value); delete[] t; + [(NSSavePanel*)_panel setCanSelectHiddenExtension:YES]; } retval = runmodal(); if (_filt_total) { ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9820 - branches/branch-3.0/src/fltk3
Author: manolo Date: 2013-02-11 04:13:59 -0800 (Mon, 11 Feb 2013) New Revision: 9820 Log: Mac OS save file dialog: display extension of preset file. Modified: branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm Modified: branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm === --- branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm 2013-02-11 12:11:30 UTC (rev 9819) +++ branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm 2013-02-11 12:13:59 UTC (rev 9820) @@ -615,6 +615,7 @@ char *t = prepareMacFilter(_filt_total, _filter, _filt_patt); popup = createPopupAccessory((NSSavePanel*)_panel, t, [[(NSSavePanel*)_panel nameFieldLabel] UTF8String], _filt_value); delete[] t; + [(NSSavePanel*)_panel setCanSelectHiddenExtension:YES]; } retval = runmodal(); if (_filt_total) { ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9817 - branches/branch-1.3/src
Author: manolo Date: 2013-02-09 05:54:58 -0800 (Sat, 09 Feb 2013) New Revision: 9817 Log: Mac OS text input: fixed processing of dead key followed by non-text key. Modified: branches/branch-1.3/src/Fl_cocoa.mm Modified: branches/branch-1.3/src/Fl_cocoa.mm === --- branches/branch-1.3/src/Fl_cocoa.mm 2013-02-08 11:58:19 UTC (rev 9816) +++ branches/branch-1.3/src/Fl_cocoa.mm 2013-02-09 13:54:58 UTC (rev 9817) @@ -2038,8 +2038,10 @@ } - (void)doCommandBySelector:(SEL)aSelector { - //NSLog(@doCommandBySelector:%s,sel_getName(aSelector)); - [FLView prepareEtext:[[NSApp currentEvent] characters]]; + NSString *s = [[NSApp currentEvent] characters]; + //NSLog(@doCommandBySelector:%s text='%@',sel_getName(aSelector), s); + s = [s substringFromIndex:[s length] - 1]; + [FLView prepareEtext:s]; // use the last character of the event; necessary for deadkey + Tab Fl_Window *target = [(FLWindow*)[self window] getFl_Window]; Fl::handle(FL_KEYBOARD, target); } @@ -2055,7 +2057,7 @@ } else { received = (NSString*)aString; } - /*NSLog(@insertText=%@ l=%d Fl::compose_state=%d range=%d,%d, + /*NSLog(@insertText='%@' l=%d Fl::compose_state=%d range=%d,%d, received,strlen([received UTF8String]),Fl::compose_state,replacementRange.location,replacementRange.length);*/ fl_lock_function(); Fl_Window *target = [(FLWindow*)[self window] getFl_Window]; @@ -2076,7 +2078,15 @@ // Transform character palette actions to FL_PASTE events. Fl_X::next_marked_length = 0; int flevent = (in_key_event || Fl::compose_state) ? FL_KEYBOARD : FL_PASTE; - if (!in_key_event) Fl::handle( flevent, target); + // YES if key has text attached + BOOL has_text_key = Fl::e_keysym = '~' || Fl::e_keysym == FL_Iso_Key || + (Fl::e_keysym = FL_KP Fl::e_keysym = FL_KP_Last Fl::e_keysym != FL_KP_Enter); + // insertText sent during handleEvent of a key without text cannot be processed in a single FL_KEYBOARD event. + // Occurs with deadkey followed by non-text key + if (!in_key_event || !has_text_key) { +Fl::handle(flevent, target); +Fl::e_length = 0; +} else need_handle = YES; selectedRange = NSMakeRange(100, 0); // 100 is an arbitrary value // for some reason, with the palette, the window does not redraw until the next mouse move or button push ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9818 - in branches/branch-3.0: include/fltk3 src/fltk3
Author: manolo Date: 2013-02-09 06:16:47 -0800 (Sat, 09 Feb 2013) New Revision: 9818 Log: Mac OS text input: fixed processing of dead key followed by non-text key. Modified: branches/branch-3.0/include/fltk3/run.h branches/branch-3.0/src/fltk3/Input.cxx branches/branch-3.0/src/fltk3/Input_.cxx branches/branch-3.0/src/fltk3/TextDisplay.cxx branches/branch-3.0/src/fltk3/TextEditor.cxx branches/branch-3.0/src/fltk3/cocoa.mm branches/branch-3.0/src/fltk3/compose.cxx Modified: branches/branch-3.0/include/fltk3/run.h === --- branches/branch-3.0/include/fltk3/run.h 2013-02-09 13:54:58 UTC (rev 9817) +++ branches/branch-3.0/include/fltk3/run.h 2013-02-09 14:16:47 UTC (rev 9818) @@ -150,10 +150,9 @@ extern fltk3::Widget* selection_owner_; extern fltk3::Window* modal_; extern fltk3::Window* grab_; - extern int compose_state; + extern int compose_state; // used for dead keys (WIN32) or marked text (MacOS) void call_screen_init(); // recompute screen number and dimensions #ifdef __APPLE__ - int marked_text_length(); // returns length of marked text void reset_marked_text(); // resets marked text void insertion_point_location(int x, int y, int height); // sets window coordinates height of insertion point #endif Modified: branches/branch-3.0/src/fltk3/Input.cxx === --- branches/branch-3.0/src/fltk3/Input.cxx 2013-02-09 13:54:58 UTC (rev 9817) +++ branches/branch-3.0/src/fltk3/Input.cxx 2013-02-09 14:16:47 UTC (rev 9818) @@ -378,8 +378,8 @@ fltk3::event_text(), fltk3::event_length()); } #ifdef __APPLE__ -if (fltk3::marked_text_length()) { - this-mark( this-position() - fltk3::marked_text_length() ); +if (fltk3::compose_state) { + this-mark( this-position() - fltk3::compose_state ); } #endif return 1; @@ -611,7 +611,7 @@ switch (event) { #ifdef __APPLE__ case fltk3::UNFOCUS: - if (fltk3::marked_text_length()) { + if (fltk3::compose_state) { this-mark( this-position() ); fltk3::reset_marked_text(); } @@ -848,7 +848,7 @@ int fltk3::SecretInput::handle(int event) { int retval = fltk3::Input::handle(event); #ifdef __APPLE__ - if (event == fltk3::KEYBOARD fltk3::marked_text_length()) { + if (event == fltk3::KEYBOARD fltk3::compose_state) { this-mark( this-position() ); // don't underline marked text } #endif Modified: branches/branch-3.0/src/fltk3/Input_.cxx === --- branches/branch-3.0/src/fltk3/Input_.cxx2013-02-09 13:54:58 UTC (rev 9817) +++ branches/branch-3.0/src/fltk3/Input_.cxx2013-02-09 14:16:47 UTC (rev 9818) @@ -351,8 +351,8 @@ int offset2; if (pp = e) x2 = xpos + (float)expandpos(p, pp, buf, offset2); else offset2 = (int)strlen(buf); -#ifdef __APPLE__ // Mac OS: underline marked ( = selected + fltk3::marked_text_length() != 0) text - if (fltk3::marked_text_length()) { +#ifdef __APPLE__ // Mac OS: underline marked ( = selected + fltk3::compose_state != 0) text + if (fltk3::compose_state) { fltk3::color(textcolor()); } else @@ -363,8 +363,8 @@ fltk3::color(fltk3::contrast(textcolor(), selection_color())); } fltk3::draw(buf+offset1, offset2-offset1, x1, (float)(Y+ypos+desc)); -#ifdef __APPLE__ // Mac OS: underline marked ( = selected + fltk3::marked_text_length() != 0) text - if (fltk3::marked_text_length()) { +#ifdef __APPLE__ // Mac OS: underline marked ( = selected + fltk3::compose_state != 0) text + if (fltk3::compose_state) { fltk3::color( fltk3::color_average(textcolor(), color(), 0.6) ); float width = fltk3::width(buf+offset1, offset2-offset1); fltk3::line(x1, Y+ypos+height-1, x1+width, Y+ypos+height-1); @@ -386,7 +386,7 @@ // draw the cursor: if (fltk3::focus() == this ( #ifdef __APPLE__ - fltk3::marked_text_length() || + fltk3::compose_state || #endif selstart == selend) position() = p-value() position() = e-value()) { Modified: branches/branch-3.0/src/fltk3/TextDisplay.cxx === --- branches/branch-3.0/src/fltk3/TextDisplay.cxx 2013-02-09 13:54:58 UTC (rev 9817) +++ branches/branch-3.0/src/fltk3/TextDisplay.cxx 2013-02-09 14:16:47 UTC (rev 9818) @@ -1952,7 +1952,7 @@ if (style PRIMARY_MASK) { if (fltk3::focus() == (fltk3::Widget*)this) { #ifdef __APPLE__ - if (fltk3::marked_text_length()) background = color();// Mac OS: underline marked text + if (fltk3::compose_state) background = color();// Mac OS: underline marked text else #endif background = selection_color(); @@ -1988,8
[fltk.commit] [Library] r9816 - in branches/branch-1.3: FL src
Author: manolo Date: 2013-02-08 03:58:19 -0800 (Fri, 08 Feb 2013) New Revision: 9816 Log: Mac OS text input: removed the Fl::marked_text_length() function that's not necessary. Modified: branches/branch-1.3/FL/Fl.H branches/branch-1.3/src/Fl_Input.cxx branches/branch-1.3/src/Fl_Input_.cxx branches/branch-1.3/src/Fl_Text_Display.cxx branches/branch-1.3/src/Fl_Text_Editor.cxx branches/branch-1.3/src/Fl_cocoa.mm branches/branch-1.3/src/Fl_compose.cxx Modified: branches/branch-1.3/FL/Fl.H === --- branches/branch-1.3/FL/Fl.H 2013-02-05 16:04:05 UTC (rev 9815) +++ branches/branch-1.3/FL/Fl.H 2013-02-08 11:58:19 UTC (rev 9816) @@ -142,10 +142,9 @@ static Fl_Widget* selection_owner_; static Fl_Window* modal_; static Fl_Window* grab_; - static int compose_state; + static int compose_state; // used for dead keys (WIN32) or marked text (MacOS) static void call_screen_init(); // recompute screen number and dimensions #ifdef __APPLE__ - static int marked_text_length(void); // returns length of marked text static void reset_marked_text(); // resets marked text static void insertion_point_location(int x, int y, int height); // sets window coordinates height of insertion point #endif Modified: branches/branch-1.3/src/Fl_Input.cxx === --- branches/branch-1.3/src/Fl_Input.cxx2013-02-05 16:04:05 UTC (rev 9815) +++ branches/branch-1.3/src/Fl_Input.cxx2013-02-08 11:58:19 UTC (rev 9816) @@ -359,8 +359,8 @@ Fl::event_text(), Fl::event_length()); } #ifdef __APPLE__ -if (Fl::marked_text_length()) { - this-mark( this-position() - Fl::marked_text_length() ); +if (Fl::compose_state) { + this-mark( this-position() - Fl::compose_state ); } #endif return 1; @@ -592,7 +592,7 @@ switch (event) { #ifdef __APPLE__ case FL_UNFOCUS: - if (Fl::marked_text_length()) { + if (Fl::compose_state) { this-mark( this-position() ); Fl::reset_marked_text(); } @@ -818,7 +818,7 @@ int Fl_Secret_Input::handle(int event) { int retval = Fl_Input::handle(event); #ifdef __APPLE__ - if (event == FL_KEYBOARD Fl::marked_text_length()) { + if (event == FL_KEYBOARD Fl::compose_state) { this-mark( this-position() ); // don't underline marked text } #endif Modified: branches/branch-1.3/src/Fl_Input_.cxx === --- branches/branch-1.3/src/Fl_Input_.cxx 2013-02-05 16:04:05 UTC (rev 9815) +++ branches/branch-1.3/src/Fl_Input_.cxx 2013-02-08 11:58:19 UTC (rev 9816) @@ -339,8 +339,8 @@ int offset2; if (pp = e) x2 = xpos + (float)expandpos(p, pp, buf, offset2); else offset2 = (int) strlen(buf); -#ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::marked_text_length() != 0) text - if (Fl::marked_text_length()) { +#ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::compose_state != 0) text + if (Fl::compose_state) { fl_color(textcolor()); } else @@ -351,8 +351,8 @@ fl_color(fl_contrast(textcolor(), selection_color())); } fl_draw(buf+offset1, offset2-offset1, x1, (float)(Y+ypos+desc)); -#ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::marked_text_length() != 0) text - if (Fl::marked_text_length()) { +#ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::compose_state != 0) text + if (Fl::compose_state) { fl_color( fl_color_average(textcolor(), color(), 0.6) ); float width = fl_width(buf+offset1, offset2-offset1); fl_line(x1, Y+ypos+height-1, x1+width, Y+ypos+height-1); @@ -374,7 +374,7 @@ // draw the cursor: if (Fl::focus() == this ( #ifdef __APPLE__ - Fl::marked_text_length() || + Fl::compose_state || #endif selstart == selend) position() = p-value() position() = e-value()) { Modified: branches/branch-1.3/src/Fl_Text_Display.cxx === --- branches/branch-1.3/src/Fl_Text_Display.cxx 2013-02-05 16:04:05 UTC (rev 9815) +++ branches/branch-1.3/src/Fl_Text_Display.cxx 2013-02-08 11:58:19 UTC (rev 9816) @@ -1942,7 +1942,7 @@ if (style PRIMARY_MASK) { if (Fl::focus() == (Fl_Widget*)this) { #ifdef __APPLE__ - if (Fl::marked_text_length()) background = color();// Mac OS: underline marked text + if (Fl::compose_state) background = color();// Mac OS: underline marked text else #endif background = selection_color(); @@ -1978,8 +1978,8 @@ fl_push_clip(X, Y, toX - X, mMaxsize); #endif fl_draw( string, nChars, X, Y + mMaxsize - fl_descent()); -#ifdef __APPLE__ // Mac OS: underline marked (= selected +
[fltk.commit] [Library] r9814 - in branches/branch-3.0/ide/Xcode4: . Resources
Author: manolo Date: 2013-02-05 08:02:12 -0800 (Tue, 05 Feb 2013) New Revision: 9814 Log: Added directories Added: branches/branch-3.0/ide/Xcode4/Resources/ branches/branch-3.0/ide/Xcode4/Resources/English.lproj/ branches/branch-3.0/ide/Xcode4/Resources/French.lproj/ branches/branch-3.0/ide/Xcode4/Resources/German.lproj/ branches/branch-3.0/ide/Xcode4/Resources/Italian.lproj/ branches/branch-3.0/ide/Xcode4/Resources/Spanish.lproj/ ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9815 - in branches/branch-3.0/ide/Xcode4/Resources: English.lproj French.lproj German.lproj Italian.lproj Spanish.lproj
Author: manolo Date: 2013-02-05 08:04:05 -0800 (Tue, 05 Feb 2013) New Revision: 9815 Log: Added support files for internationalization of the application menu. Added: branches/branch-3.0/ide/Xcode4/Resources/English.lproj/Localizable.strings branches/branch-3.0/ide/Xcode4/Resources/French.lproj/Localizable.strings branches/branch-3.0/ide/Xcode4/Resources/German.lproj/Localizable.strings branches/branch-3.0/ide/Xcode4/Resources/Italian.lproj/Localizable.strings branches/branch-3.0/ide/Xcode4/Resources/Spanish.lproj/Localizable.strings Added: branches/branch-3.0/ide/Xcode4/Resources/English.lproj/Localizable.strings === --- branches/branch-3.0/ide/Xcode4/Resources/English.lproj/Localizable.strings (rev 0) +++ branches/branch-3.0/ide/Xcode4/Resources/English.lproj/Localizable.strings 2013-02-05 16:04:05 UTC (rev 9815) @@ -0,0 +1,7 @@ +About %@ = About %@; +Print Front Window=Print Front Window; +Services = Services; +Hide %@=Hide %@; +Hide Others=Hide Others; +Show All=Show All; +Quit %@=Quit %@; Added: branches/branch-3.0/ide/Xcode4/Resources/French.lproj/Localizable.strings === --- branches/branch-3.0/ide/Xcode4/Resources/French.lproj/Localizable.strings (rev 0) +++ branches/branch-3.0/ide/Xcode4/Resources/French.lproj/Localizable.strings 2013-02-05 16:04:05 UTC (rev 9815) @@ -0,0 +1,7 @@ +About %@ = A propos de %@; +Print Front Window=Imprimer la fenêtre; +Services = Services; +Hide %@=Masquer %@; +Hide Others=Masquer les autres; +Show All=Tout afficher; +Quit %@=Quitter %@; Added: branches/branch-3.0/ide/Xcode4/Resources/German.lproj/Localizable.strings === --- branches/branch-3.0/ide/Xcode4/Resources/German.lproj/Localizable.strings (rev 0) +++ branches/branch-3.0/ide/Xcode4/Resources/German.lproj/Localizable.strings 2013-02-05 16:04:05 UTC (rev 9815) @@ -0,0 +1,7 @@ +About %@ = Über %@; +Print Front Window=Vordergrundfenster drucken; +Services = Dienste; +Hide %@=%@ ausblenden; +Hide Others=Andere ausblenden; +Show All=Alle einblenden; +Quit %@=%@ beenden; Added: branches/branch-3.0/ide/Xcode4/Resources/Italian.lproj/Localizable.strings === --- branches/branch-3.0/ide/Xcode4/Resources/Italian.lproj/Localizable.strings (rev 0) +++ branches/branch-3.0/ide/Xcode4/Resources/Italian.lproj/Localizable.strings 2013-02-05 16:04:05 UTC (rev 9815) @@ -0,0 +1,7 @@ +About %@ = Informazioni su %@; +Print Front Window=Stampa la finestra; +Services = Servizi; +Hide %@=Nascondi %@; +Hide Others=Nascondi altre; +Show All=Mostra tutte; +Quit %@=Esci da %@; Added: branches/branch-3.0/ide/Xcode4/Resources/Spanish.lproj/Localizable.strings === --- branches/branch-3.0/ide/Xcode4/Resources/Spanish.lproj/Localizable.strings (rev 0) +++ branches/branch-3.0/ide/Xcode4/Resources/Spanish.lproj/Localizable.strings 2013-02-05 16:04:05 UTC (rev 9815) @@ -0,0 +1,7 @@ +About %@ = Acerca de %@; +Print Front Window=Imprimir la ventana; +Services = Servicios; +Hide %@=Ocultar %@; +Hide Others=Ocultar otros; +Show All=Mostrar todo; +Quit %@=Salir de %@; ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9812 - in branches/branch-1.3: FL src
Author: manolo Date: 2013-02-02 07:46:00 -0800 (Sat, 02 Feb 2013) New Revision: 9812 Log: Mac OS text input: a single FL_KEYBOARD event is now sent when processing dead keys. Modified: branches/branch-1.3/FL/mac.H branches/branch-1.3/src/Fl.cxx branches/branch-1.3/src/Fl_cocoa.mm Modified: branches/branch-1.3/FL/mac.H === --- branches/branch-1.3/FL/mac.H2013-01-28 21:05:29 UTC (rev 9811) +++ branches/branch-1.3/FL/mac.H2013-02-02 15:46:00 UTC (rev 9812) @@ -133,7 +133,6 @@ 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 int shortcut_events_since_keyDown; // to limit to one FL_SHORTCUT event per keyDown event. private: static void relink(Fl_Window*, Fl_Window*); bool subwindow; Modified: branches/branch-1.3/src/Fl.cxx === --- branches/branch-1.3/src/Fl.cxx 2013-01-28 21:05:29 UTC (rev 9811) +++ branches/branch-1.3/src/Fl.cxx 2013-02-02 15:46:00 UTC (rev 9812) @@ -1280,9 +1280,6 @@ e_number = e = FL_SHORTCUT; case FL_SHORTCUT: -#ifdef __APPLE__ - if (Fl_X::shortcut_events_since_keyDown++ 0) return 0; -#endif if (grab()) {wi = grab(); break;} // send it to grab window // Try it as shortcut, sending to mouse widget and all parents: Modified: branches/branch-1.3/src/Fl_cocoa.mm === --- branches/branch-1.3/src/Fl_cocoa.mm 2013-01-28 21:05:29 UTC (rev 9811) +++ branches/branch-1.3/src/Fl_cocoa.mm 2013-02-02 15:46:00 UTC (rev 9812) @@ -107,7 +107,6 @@ Fl_Window *Fl_Window::current_; int fl_mac_os_version = calc_mac_os_version(); // the version number of the running Mac OS X (e.g., 100604 for 10.6.4) static SEL inputContextSEL = (fl_mac_os_version = 100600 ? @selector(inputContext) : @selector(FLinputContext)); -int Fl_X::shortcut_events_since_keyDown = INT_MIN; // forward declarations of variables in this file static int got_events = 0; @@ -1633,6 +1632,13 @@ When the character palette is used to enter text, the system sends an insertText: message to myview. The code processes it as an FL_PASTE event. The in_key_event field of the FLView class allows to differentiate keyboard from palette inputs. + During processing of the handleEvent message, inserted and marked strings are concatenated in a single string + inserted in a single FL_KEYBOARD event after return from handleEvent. The need_handle member variable of FLView allows + to determine when setMarkedText or insertText strings have been sent during handleEvent processing and must trigger + an FL_KEYBOARD event. Concatenating two insertText operations or an insertText followed by a setMarkedText is possible. + In contrast, setMarkedText followed by insertText or by another setMarkedText isn't correct if concatenated in a single + string. Thus, in such case, the setMarkedText and the next operation produce each an FL_KEYBOARD event. + OS = 10.7 contains a feature where pressing and holding certain keys opens a menu window that shows a list of possible accented variants of this key. The selectedRange field of the FLView class and the selectedRange, insertText: and setMarkedText: methods of the NSTextInputClient protocol are used to support this feature. @@ -1658,15 +1664,7 @@ by sending the interpretKeyEvents: message to the FLTextView object. The system sends back doCommandBySelector: and insertText: messages to the FLTextView object that are transmitted unchanged to myview to be processed as with OS = 10.6. The system also sends setMarkedText: messages directly to myview. - - When 2 deadkeys are pressed in succession, the messages sent are [myview setMarkedText:] by the 1st keystroke and - [myview insertText:] [myview setMarkedText:] by the 2nd keystroke. Each of these messages creates an FL_KEYBOARD event, - so there are two FL_KEYBOARD events for the 2nd keystroke. If no widget in the window accepts keyboard input, FL_KEYBOARD - events are re-tried as FL_SHORTCUT events, which makes two FL_SHORTCUT events for a single keystroke. This is a problem - when these keystrokes are used as shortcuts. Such problem occurs, for example, with Alt+e on a US keyboard. - The Fl_X::shortcut_events_since_keyDown variable allows to transform only one FL_KEYBOARD event into an FL_SHORTCUT - event during processing of a keystroke, and thus fixes the double-shortcut problem. - + There is furthermore an oddity of dead key processing with OS = 10.5. It occurs when a dead key followed by a non-accented key are pressed. Say, for
[fltk.commit] [Library] r9810 - branches/branch-1.3/ide/Xcode4/Resources/German.lproj
Author: manolo Date: 2013-01-28 08:14:48 -0800 (Mon, 28 Jan 2013) New Revision: 9810 Log: Improved German translation, thanks to Albrecht. Modified: branches/branch-1.3/ide/Xcode4/Resources/German.lproj/Localizable.strings Modified: branches/branch-1.3/ide/Xcode4/Resources/German.lproj/Localizable.strings === --- branches/branch-1.3/ide/Xcode4/Resources/German.lproj/Localizable.strings 2013-01-25 16:28:49 UTC (rev 9809) +++ branches/branch-1.3/ide/Xcode4/Resources/German.lproj/Localizable.strings 2013-01-28 16:14:48 UTC (rev 9810) @@ -1,5 +1,5 @@ About %@ = Ãœber %@; -Print Front Window=Frontfenster drucken; +Print Front Window=Vordergrundfenster drucken; Services = Dienste; Hide %@=%@ ausblenden; Hide Others=Andere ausblenden; ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9811 - in branches/branch-1.3: FL src
Author: manolo Date: 2013-01-28 13:05:29 -0800 (Mon, 28 Jan 2013) New Revision: 9811 Log: Fix STR#2928: alt+e on US keyboard not processed correctly as shortcut on Mac OS. Modified: branches/branch-1.3/FL/mac.H branches/branch-1.3/src/Fl.cxx branches/branch-1.3/src/Fl_cocoa.mm Modified: branches/branch-1.3/FL/mac.H === --- branches/branch-1.3/FL/mac.H2013-01-28 16:14:48 UTC (rev 9810) +++ branches/branch-1.3/FL/mac.H2013-01-28 21:05:29 UTC (rev 9811) @@ -133,6 +133,7 @@ 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 int shortcut_events_since_keyDown; // to limit to one FL_SHORTCUT event per keyDown event. private: static void relink(Fl_Window*, Fl_Window*); bool subwindow; Modified: branches/branch-1.3/src/Fl.cxx === --- branches/branch-1.3/src/Fl.cxx 2013-01-28 16:14:48 UTC (rev 9810) +++ branches/branch-1.3/src/Fl.cxx 2013-01-28 21:05:29 UTC (rev 9811) @@ -1280,6 +1280,9 @@ e_number = e = FL_SHORTCUT; case FL_SHORTCUT: +#ifdef __APPLE__ + if (Fl_X::shortcut_events_since_keyDown++ 0) return 0; +#endif if (grab()) {wi = grab(); break;} // send it to grab window // Try it as shortcut, sending to mouse widget and all parents: Modified: branches/branch-1.3/src/Fl_cocoa.mm === --- branches/branch-1.3/src/Fl_cocoa.mm 2013-01-28 16:14:48 UTC (rev 9810) +++ branches/branch-1.3/src/Fl_cocoa.mm 2013-01-28 21:05:29 UTC (rev 9811) @@ -52,6 +52,7 @@ #include unistd.h #include stdarg.h #include math.h +#include limits.h #import Cocoa/Cocoa.h @@ -106,6 +107,7 @@ Fl_Window *Fl_Window::current_; int fl_mac_os_version = calc_mac_os_version(); // the version number of the running Mac OS X (e.g., 100604 for 10.6.4) static SEL inputContextSEL = (fl_mac_os_version = 100600 ? @selector(inputContext) : @selector(FLinputContext)); +int Fl_X::shortcut_events_since_keyDown = INT_MIN; // forward declarations of variables in this file static int got_events = 0; @@ -1656,6 +1658,14 @@ by sending the interpretKeyEvents: message to the FLTextView object. The system sends back doCommandBySelector: and insertText: messages to the FLTextView object that are transmitted unchanged to myview to be processed as with OS = 10.6. The system also sends setMarkedText: messages directly to myview. + + When 2 deadkeys are pressed in succession, the messages sent are [myview setMarkedText:] by the 1st keystroke and + [myview insertText:] [myview setMarkedText:] by the 2nd keystroke. Each of these messages creates an FL_KEYBOARD event, + so there are two FL_KEYBOARD events for the 2nd keystroke. If no widget in the window accepts keyboard input, FL_KEYBOARD + events are re-tried as FL_SHORTCUT events, which makes two FL_SHORTCUT events for a single keystroke. This is a problem + when these keystrokes are used as shortcuts. Such problem occurs, for example, with Alt+e on a US keyboard. + The Fl_X::shortcut_events_since_keyDown variable allows to transform only one FL_KEYBOARD event into an FL_SHORTCUT + event during processing of a keystroke, and thus fixes the double-shortcut problem. There is furthermore an oddity of dead key processing with OS = 10.5. It occurs when a dead key followed by a non-accented key are pressed. Say, for example, that keys '^' followed by 'p' are pressed on a French or German keyboard. Resulting @@ -1859,7 +1869,9 @@ Fl::first_window(window); cocoaKeyboardHandler(theEvent); in_key_event = YES; + Fl_X::shortcut_events_since_keyDown = 0; [[self performSelector:inputContextSEL] handleEvent:theEvent]; + Fl_X::shortcut_events_since_keyDown = INT_MIN; in_key_event = NO; fl_unlock_function(); } ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9808 - in branches/branch-1.3/ide/Xcode4: . FLTK.xcodeproj Resources Resources/English.lproj Resources/French.lproj Resources/German.lproj Resources/Italian.lproj Resources/Sp
Author: manolo Date: 2013-01-25 08:27:31 -0800 (Fri, 25 Jan 2013) New Revision: 9808 Log: added directories Added: branches/branch-1.3/ide/Xcode4/Resources/ branches/branch-1.3/ide/Xcode4/Resources/English.lproj/ branches/branch-1.3/ide/Xcode4/Resources/English.lproj/Localizable.strings branches/branch-1.3/ide/Xcode4/Resources/French.lproj/ branches/branch-1.3/ide/Xcode4/Resources/French.lproj/Localizable.strings branches/branch-1.3/ide/Xcode4/Resources/German.lproj/ branches/branch-1.3/ide/Xcode4/Resources/German.lproj/Localizable.strings branches/branch-1.3/ide/Xcode4/Resources/Italian.lproj/ branches/branch-1.3/ide/Xcode4/Resources/Italian.lproj/Localizable.strings branches/branch-1.3/ide/Xcode4/Resources/Spanish.lproj/ branches/branch-1.3/ide/Xcode4/Resources/Spanish.lproj/Localizable.strings Modified: branches/branch-1.3/ide/Xcode4/FLTK.xcodeproj/project.pbxproj Modified: branches/branch-1.3/ide/Xcode4/FLTK.xcodeproj/project.pbxproj === --- branches/branch-1.3/ide/Xcode4/FLTK.xcodeproj/project.pbxproj 2013-01-21 14:07:09 UTC (rev 9807) +++ branches/branch-1.3/ide/Xcode4/FLTK.xcodeproj/project.pbxproj 2013-01-25 16:27:31 UTC (rev 9808) @@ -327,6 +327,11 @@ 7F66B1D912BB924C00C67B59 /* Fl_cocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7F66B1D612BB924C00C67B59 /* Fl_cocoa.mm */; }; 7F66B1DA12BB924C00C67B59 /* Fl_Native_File_Chooser_MAC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7F66B1D712BB924C00C67B59 /* Fl_Native_File_Chooser_MAC.mm */; }; 7F66B1DB12BB924C00C67B59 /* Fl_Quartz_Printer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7F66B1D812BB924C00C67B59 /* Fl_Quartz_Printer.mm */; }; + 7FDBB8F416B2D1EA00AE76EF /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7F92032516B1A90A000FC50F /* Localizable.strings */; }; + 7FDBB8F516B2D1EE00AE76EF /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7F92032216B1A909000FC50F /* Localizable.strings */; }; + 7FDBB8F616B2D1FA00AE76EF /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7F92031F16B1A909000FC50F /* Localizable.strings */; }; + 7FDBB8F716B2D1FF00AE76EF /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7F92031C16B1A909000FC50F /* Localizable.strings */; }; + 7FDBB8F816B2D20A00AE76EF /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7F92031916B1A909000FC50F /* Localizable.strings */; }; 812129561A1981D6DEFBCBFB /* Fl_Positioner.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 05BBBFE4BED0452E5D6A81F7 /* Fl_Positioner.cxx */; }; 812761E94039F13357F56EE6 /* fltk_png.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 98A16A4EC098BA7DB21E13DC /* fltk_png.framework */; }; 813BAC8244B19F51594C89C4 /* pngrio.c in Sources */ = {isa = PBXBuildFile; fileRef = D33C668435685F7CCB359EE2 /* pngrio.c */; }; @@ -4321,6 +4326,11 @@ 7F66B1D712BB924C00C67B59 /* Fl_Native_File_Chooser_MAC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = Fl_Native_File_Chooser_MAC.mm; path = ../../src/Fl_Native_File_Chooser_MAC.mm; sourceTree = SOURCE_ROOT; }; 7F66B1D812BB924C00C67B59 /* Fl_Quartz_Printer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = Fl_Quartz_Printer.mm; path = ../../src/Fl_Quartz_Printer.mm; sourceTree = SOURCE_ROOT; }; 7F784151AF1B748D0F3DB1C0 /* forms.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = forms.cxx; path = ../../test/forms.cxx; sourceTree = SOURCE_ROOT; }; + 7F92031A16B1A909000FC50F /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = Localizable.strings; sourceTree = group; }; + 7F92031D16B1A909000FC50F /* French */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = French; path = Localizable.strings; sourceTree = group; }; + 7F92032016B1A909000FC50F /* German */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = German; path = Localizable.strings; sourceTree = group; }; + 7F92032316B1A90A000FC50F /* Italian */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = Italian; path = Localizable.strings; sourceTree = group; }; + 7F92032616B1A90A000FC50F /* Spanish */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = Spanish; path = Localizable.strings; sourceTree = group; }; 7FAC914955D699539F73B996 /*
[fltk.commit] [Library] r9806 - branches/branch-1.3/src
Author: manolo Date: 2013-01-21 01:25:25 -0800 (Mon, 21 Jan 2013) New Revision: 9806 Log: Fixed STR#2921 by adding 2 missing colons. Modified: branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm Modified: branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm === --- branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm 2013-01-20 16:54:23 UTC (rev 9805) +++ branches/branch-1.3/src/Fl_Native_File_Chooser_MAC.mm 2013-01-21 09:25:25 UTC (rev 9806) @@ -501,8 +501,8 @@ } if (_directory !dir) dir = [[NSString alloc] initWithUTF8String:_directory]; if (fl_mac_os_version = 100600) { -if (dir) [(NSSavePanel*)_panel performSelector:@selector(setDirectoryURL) withObject:[NSURL fileURLWithPath:dir]]; -if (fname) [(NSSavePanel*)_panel performSelector:@selector(setNameFieldStringValue) withObject:fname]; +if (dir) [(NSSavePanel*)_panel performSelector:@selector(setDirectoryURL:) withObject:[NSURL fileURLWithPath:dir]]; +if (fname) [(NSSavePanel*)_panel performSelector:@selector(setNameFieldStringValue:) withObject:fname]; retval = [(NSSavePanel*)_panel runModal]; } else { ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9807 - branches/branch-3.0/src/fltk3
Author: manolo Date: 2013-01-21 06:07:09 -0800 (Mon, 21 Jan 2013) New Revision: 9807 Log: Mac OS: - changed memory allocation style of static NSBitmapImageRep* rect_to_NSBitmapImageRep(). - fixed application menu with OS = 10.3 that was duplicated. Modified: branches/branch-3.0/src/fltk3/cocoa.mm Modified: branches/branch-3.0/src/fltk3/cocoa.mm === --- branches/branch-3.0/src/fltk3/cocoa.mm 2013-01-21 09:25:25 UTC (rev 9806) +++ branches/branch-3.0/src/fltk3/cocoa.mm 2013-01-21 14:07:09 UTC (rev 9807) @@ -1592,20 +1592,21 @@ Keyboard input sends keyDown: and performKeyEquivalent: messages to myview. The latter occurs for keys such as ForwardDelete, arrows and F1, and when the Ctrl or Cmd modifiers are used. Other key presses send keyDown: messages. - Both keyDown: and performKeyEquivalent: methods call [[myview inputContext] handleEvent:theEvent] that triggers system - processing of keyboard events. Three sorts of messages are then sent back by the system to myview: doCommandBySelector:, - setMarkedText: and insertText:. All 3 messages eventually produce Fl::handle(FL_KEYBOARD, focus-window) calls. - The handleEvent: method, however, does not send any message back to myview when both the Alt and Cmd modifiers - are pressed. In this situation, the performKeyEquivalent: method directly sends the doCommandBySelector: message to myview. - The doCommandBySelector: message allows to process events such as new-line, forward and backward delete, arrows, escape, - tab, F1 and when the Ctrl or Cmd modifiers are used. The message setMarkedText: - is sent when marked text, that is, temporary text that gets replaced later by some other text, is inserted. This happens - when a dead key is pressed, and also when entering complex scripts (e.g., Chinese). Fl_X::next_marked_length gives the byte - length of marked text before the FL_KEYBOARD event is processed. Fl::compose_state gives this length after this processing. - Message insertText: is sent to enter text in the focused widget. If there's marked text, Fl::compose_state is 0, and this + The keyDown: method calls [[myview inputContext] handleEvent:theEvent] that triggers system + processing of keyboard events. The performKeyEquivalent: method directly calls fltk3::handle(fltk3::KEYBOARD, focus-window) + when the Ctrl or Cmd modifiers are used. If not, it also calls [[myview inputContext] handleEvent:theEvent]. + The performKeyEquivalent: method returns YES when the keystroke has been handled and NO otherwise, which allows + shortcuts of the system menu to be processed. Three sorts of messages are then sent back by the system to myview: + doCommandBySelector:, setMarkedText: and insertText:. All 3 messages eventually produce fltk3::handle(fltk3::KEYBOARD, win) + calls. The doCommandBySelector: message allows to process events such as new-line, forward and backward delete, arrows, + escape, tab, F1. The message setMarkedText: is sent when marked text, that is, temporary text that gets replaced later + by some other text, is inserted. This happen when a dead key is pressed, and also + when entering complex scripts (e.g., Chinese). Fl_X::next_marked_length gives the byte + length of marked text before the fltk3::KEYBOARD event is processed. fltk3::compose_state gives this length after this processing. + Message insertText: is sent to enter text in the focused widget. If there's marked text, fltk3::compose_state is 0, and this marked text gets replaced by the inserted text. If there's no marked text, the new text is inserted at the insertion point. When the character palette is used to enter text, the system sends an insertText: message to myview. The code processes it - as an FL_PASTE event. The in_key_event field of the FLView class allows to differentiate keyboard from palette inputs. + as an fltk3::PASTE event. The in_key_event field of the FLView class allows to differentiate keyboard from palette inputs. OS = 10.7 contains a feature where pressing and holding certain keys opens a menu window that shows a list of possible accented variants of this key. The selectedRange field of the FLView class and the selectedRange, insertText: @@ -1772,12 +1773,21 @@ //NSLog(@performKeyEquivalent:); fl_lock_function(); cocoaKeyboardHandler(theEvent); - in_key_event = YES; + BOOL handled; NSUInteger mods = [theEvent modifierFlags]; - BOOL handled = YES; - if ( (mods NSAlternateKeyMask) (mods NSCommandKeyMask) ) [self doCommandBySelector:@selector(noop:)]; - else handled = [[self performSelector:inputContextSEL] handleEvent:theEvent]; - in_key_event = NO; + if ( (mods NSControlKeyMask) || (mods NSCommandKeyMask) ) { +NSString *s = [theEvent characters]; +if ( (mods NSShiftKeyMask) (mods NSCommandKeyMask) ) { + s = [s uppercaseString]; // US keyboards return lowercase letter in s if cmd-shift-key
[fltk.commit] [Library] r9805 - branches/branch-1.3/src
Author: manolo Date: 2013-01-20 08:54:23 -0800 (Sun, 20 Jan 2013) New Revision: 9805 Log: Mac OS: changed memory allocation style of static NSBitmapImageRep* rect_to_NSBitmapImageRep(). Modified: branches/branch-1.3/src/Fl_cocoa.mm Modified: branches/branch-1.3/src/Fl_cocoa.mm === --- branches/branch-1.3/src/Fl_cocoa.mm 2013-01-19 14:07:34 UTC (rev 9804) +++ branches/branch-1.3/src/Fl_cocoa.mm 2013-01-20 16:54:23 UTC (rev 9805) @@ -3466,7 +3466,7 @@ } static NSBitmapImageRep* rect_to_NSBitmapImageRep(Fl_Window *win, int x, int y, int w, int h) -// release the returned value after use +// the returned value is autoreleased { while (win-window()) { x += win-x(); @@ -3479,7 +3479,7 @@ // left pixel column are not read, and bitmap is read shifted by one pixel in both directions. // Under 10.5, we want no offset. NSRect rect = NSMakeRect(x - epsilon, y - epsilon, w, h); - return [[NSBitmapImageRep alloc] initWithFocusedViewRect:rect]; + return [[[NSBitmapImageRep alloc] initWithFocusedViewRect:rect] autorelease]; } unsigned char *Fl_X::bitmap_from_window_rect(Fl_Window *win, int x, int y, int w, int h, int *bytesPerPixel) @@ -3508,7 +3508,6 @@ q += w * *bytesPerPixel; } } - [bitmap release]; return data; } @@ -3521,11 +3520,10 @@ // CFRelease the returned CGImageRef after use { CGImageRef img; - if (fl_mac_os_version = 100600) { // crashes with 10.5 + if (fl_mac_os_version = 100500) { NSBitmapImageRep *bitmap = rect_to_NSBitmapImageRep(win, x, y, w, h); img = (CGImageRef)[bitmap performSelector:@selector(CGImage)]; // requires Mac OS 10.5 CGImageRetain(img); -[bitmap release]; } else { int bpp; ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9803 - branches/branch-1.3/src
Author: manolo Date: 2013-01-19 01:49:33 -0800 (Sat, 19 Jan 2013) New Revision: 9803 Log: Mac OS: fixed processing of system menu shortcuts that had been partly damaged in r.9799, and fixed application menu with OS = 10.3 that was duplicated. Modified: branches/branch-1.3/src/Fl_cocoa.mm Modified: branches/branch-1.3/src/Fl_cocoa.mm === --- branches/branch-1.3/src/Fl_cocoa.mm 2013-01-18 17:35:40 UTC (rev 9802) +++ branches/branch-1.3/src/Fl_cocoa.mm 2013-01-19 09:49:33 UTC (rev 9803) @@ -1615,15 +1615,16 @@ Keyboard input sends keyDown: and performKeyEquivalent: messages to myview. The latter occurs for keys such as ForwardDelete, arrows and F1, and when the Ctrl or Cmd modifiers are used. Other key presses send keyDown: messages. - Both keyDown: and performKeyEquivalent: methods call [[myview inputContext] handleEvent:theEvent] that triggers system - processing of keyboard events. Three sorts of messages are then sent back by the system to myview: doCommandBySelector:, - setMarkedText: and insertText:. All 3 messages eventually produce Fl::handle(FL_KEYBOARD, focus-window) calls. - The handleEvent: method, however, does not send any message back to myview when both the Alt and Cmd modifiers - are pressed. In this situation, the performKeyEquivalent: method directly sends the doCommandBySelector: message to myview. - The doCommandBySelector: message allows to process events such as new-line, forward and backward delete, arrows, escape, - tab, F1 and when the Ctrl or Cmd modifiers are used. The message setMarkedText: - is sent when marked text, that is, temporary text that gets replaced later by some other text, is inserted. This happens - when a dead key is pressed, and also when entering complex scripts (e.g., Chinese). Fl_X::next_marked_length gives the byte + The keyDown: method calls [[myview inputContext] handleEvent:theEvent] that triggers system + processing of keyboard events. The performKeyEquivalent: method directly calls Fl::handle(FL_KEYBOARD, focus-window) + when the Ctrl or Cmd modifiers are used. If not, it also calls [[myview inputContext] handleEvent:theEvent]. + The performKeyEquivalent: method returns YES when the keystroke has been handled and NO otherwise, which allows + shortcuts of the system menu to be processed. Three sorts of messages are then sent back by the system to myview: + doCommandBySelector:, setMarkedText: and insertText:. All 3 messages eventually produce Fl::handle(FL_KEYBOARD, win) calls. + The doCommandBySelector: message allows to process events such as new-line, forward and backward delete, arrows, + escape, tab, F1. The message setMarkedText: is sent when marked text, that is, temporary text that gets replaced later + by some other text, is inserted. This happen when a dead key is pressed, and also + when entering complex scripts (e.g., Chinese). Fl_X::next_marked_length gives the byte length of marked text before the FL_KEYBOARD event is processed. Fl::compose_state gives this length after this processing. Message insertText: is sent to enter text in the focused widget. If there's marked text, Fl::compose_state is 0, and this marked text gets replaced by the inserted text. If there's no marked text, the new text is inserted at the insertion point. @@ -1794,12 +1795,21 @@ //NSLog(@performKeyEquivalent:); fl_lock_function(); cocoaKeyboardHandler(theEvent); - in_key_event = YES; + BOOL handled; NSUInteger mods = [theEvent modifierFlags]; - BOOL handled = YES; - if ( (mods NSAlternateKeyMask) (mods NSCommandKeyMask) ) [self doCommandBySelector:@selector(noop:)]; - else handled = [[self performSelector:inputContextSEL] handleEvent:theEvent]; - in_key_event = NO; + if ( (mods NSControlKeyMask) || (mods NSCommandKeyMask) ) { +NSString *s = [theEvent characters]; +if ( (mods NSShiftKeyMask) (mods NSCommandKeyMask) ) { + s = [s uppercaseString]; // US keyboards return lowercase letter in s if cmd-shift-key is hit + } +[FLView prepareEtext:s]; +handled = Fl::handle(FL_KEYBOARD, [(FLWindow*)[theEvent window] getFl_Window]); + } + else { +in_key_event = YES; +handled = [[self performSelector:inputContextSEL] handleEvent:theEvent]; +in_key_event = NO; +} fl_unlock_function(); return handled; } @@ -2009,12 +2019,7 @@ - (void)doCommandBySelector:(SEL)aSelector { //NSLog(@doCommandBySelector:%s,sel_getName(aSelector)); - NSString *s = [[NSApp currentEvent] characters]; - NSUInteger mods = [[NSApp currentEvent] modifierFlags]; - if ( (mods NSShiftKeyMask) (mods NSCommandKeyMask) ) { -s = [s uppercaseString]; // US keyboards return lowercase letter in s if cmd-shift-key is hit - } - [FLView prepareEtext:s]; + [FLView prepareEtext:[[NSApp currentEvent] characters]]; Fl_Window *target = [(FLWindow*)[self window] getFl_Window]; Fl::handle(FL_KEYBOARD, target);
[fltk.commit] [Library] r9804 - branches/branch-1.3/src
Author: manolo Date: 2013-01-19 06:07:34 -0800 (Sat, 19 Jan 2013) New Revision: 9804 Log: Mac OS: fixed a crash when printing window with OS 10.5 Modified: branches/branch-1.3/src/Fl_cocoa.mm Modified: branches/branch-1.3/src/Fl_cocoa.mm === --- branches/branch-1.3/src/Fl_cocoa.mm 2013-01-19 09:49:33 UTC (rev 9803) +++ branches/branch-1.3/src/Fl_cocoa.mm 2013-01-19 14:07:34 UTC (rev 9804) @@ -3521,7 +3521,7 @@ // CFRelease the returned CGImageRef after use { CGImageRef img; - if (fl_mac_os_version = 100500) { + if (fl_mac_os_version = 100600) { // crashes with 10.5 NSBitmapImageRep *bitmap = rect_to_NSBitmapImageRep(win, x, y, w, h); img = (CGImageRef)[bitmap performSelector:@selector(CGImage)]; // requires Mac OS 10.5 CGImageRetain(img); ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9801 - branches/branch-1.3/src
Author: manolo Date: 2013-01-18 09:12:39 -0800 (Fri, 18 Jan 2013) New Revision: 9801 Log: r.9800 was a bad move; going back. Modified: branches/branch-1.3/src/Fl_cocoa.mm Modified: branches/branch-1.3/src/Fl_cocoa.mm === --- branches/branch-1.3/src/Fl_cocoa.mm 2013-01-18 16:34:58 UTC (rev 9800) +++ branches/branch-1.3/src/Fl_cocoa.mm 2013-01-18 17:12:39 UTC (rev 9801) @@ -1795,12 +1795,13 @@ fl_lock_function(); cocoaKeyboardHandler(theEvent); in_key_event = YES; - if (! [[self performSelector:inputContextSEL] handleEvent:theEvent] ) { -[self doCommandBySelector:@selector(noop:)]; -} + NSUInteger mods = [theEvent modifierFlags]; + BOOL handled = YES; + if ( (mods NSAlternateKeyMask) (mods NSCommandKeyMask) ) [self doCommandBySelector:@selector(noop:)]; + else handled = [[self performSelector:inputContextSEL] handleEvent:theEvent]; in_key_event = NO; fl_unlock_function(); - return YES; + return handled; } - (BOOL)acceptsFirstMouse:(NSEvent*)theEvent { ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9802 - branches/branch-3.0/src/fltk3
Author: manolo Date: 2013-01-18 09:35:40 -0800 (Fri, 18 Jan 2013) New Revision: 9802 Log: Mac OS: reorganized the text input handling code. Added a detailed description of what the code does for this rather complex issue in comments. Modified: branches/branch-3.0/src/fltk3/cocoa.mm Modified: branches/branch-3.0/src/fltk3/cocoa.mm === --- branches/branch-3.0/src/fltk3/cocoa.mm 2013-01-18 17:12:39 UTC (rev 9801) +++ branches/branch-3.0/src/fltk3/cocoa.mm 2013-01-18 17:35:40 UTC (rev 9802) @@ -101,6 +101,7 @@ Window fl_window; fltk3::Window *fltk3::Window::current_; int fl_mac_os_version = calc_mac_os_version(); // the version number of the running Mac OS X (e.g., 100604 for 10.6.4) +static SEL inputContextSEL = (fl_mac_os_version = 100600 ? @selector(inputContext) : @selector(FLinputContext)); // forward declarations of variables in this file static int got_events = 0; @@ -877,92 +878,30 @@ return; } -@interface FLTextView : NSTextView -// this subclass is needed under OS X = 10.5 but not under = 10.6 where the base class is enough +@interface FLTextView : NSTextView // this subclass is only needed under OS X 10.6 +{ + BOOL isActive; +} - (void)insertText:(id)aString; - (void)doCommandBySelector:(SEL)aSelector; -- (void)interpretKeyEvents:(NSArray *)eventArray; +- (void)setActive:(BOOL)a; @end @implementation FLTextView - (void)insertText:(id)aString { - [[[NSApp keyWindow] contentView] insertText:aString]; + if (isActive) [[[NSApp keyWindow] contentView] insertText:aString]; } - (void)doCommandBySelector:(SEL)aSelector { [[[NSApp keyWindow] contentView] doCommandBySelector:aSelector]; } -- (void)interpretKeyEvents:(NSArray *)eventArray +- (void)setActive:(BOOL)a { - if (fltk3::e_keysym == fltk3::BackSpaceKey || fltk3::e_keysym == fltk3::KPEnterKey || - fltk3::e_keysym == fltk3::EnterKey || fltk3::e_keysym == fltk3::EscapeKey || fltk3::e_keysym == fltk3::TabKey ) { -NSEvent *theEvent = (NSEvent*)[eventArray objectAtIndex:0]; -// interpretKeyEvents doesn't output anything for these 5 keys under 10.5 or below -NSString *s = [theEvent characters]; -if ([s length] = 1) { - static char utf[2] = {0, 0}; - utf[0] = [s UTF8String][0]; - fltk3::e_text = utf; - fltk3::e_length = 1; -} -fltk3::Window *window = [(FLWindow*)[theEvent window] getFl_Window]; -fltk3::handle(fltk3::KEYBOARD, window); - } - else [super interpretKeyEvents:eventArray]; + isActive = a; } @end /* -Handle cocoa keyboard events -Events during a character composition sequence: - - keydown with deadkey - [[theEvent characters] length] is 0 - - keyup - [theEvent characters] contains the deadkey - - keydown with next key - [theEvent characters] contains the composed character - - keyup - [theEvent characters] contains the standard character - */ -static void cocoaKeyboardHandler(NSEvent *theEvent) -{ - NSUInteger mods; - - // get the modifiers - mods = [theEvent modifierFlags]; - // get the key code - UInt32 keyCode = 0, maskedKeyCode = 0; - unsigned short sym = 0; - keyCode = [theEvent keyCode]; - // extended keyboards can also send sequences on key-up to generate Kanji etc. codes. - // Some observed prefixes are 0x81 to 0x83, followed by an 8 bit keycode. - // In this mode, there seem to be no key-down codes - // printf(%08x %08x %08x\n, keyCode, mods, key); - maskedKeyCode = keyCode 0x7f; - - if ([theEvent type] == NSKeyUp) { -fltk3::e_state = 0xbfff; // clear the deadkey flag - } - - mods_to_e_state( mods ); // process modifier keys - sym = macKeyLookUp[maskedKeyCode]; - if (sym 0xff00) { // a simple key -// find the result of this key without modifier -NSString *sim = [theEvent charactersIgnoringModifiers]; -UniChar one; -CFStringGetCharacters((CFStringRef)sim, CFRangeMake(0, 1), one); -// charactersIgnoringModifiers doesn't ignore shift, remove it when it's on -if(one = 'A' one = 'Z') one += 32; -if (one 0 one = 0x7f (sym'0' || sym'9') ) sym = one; - } - fltk3::e_keysym = fltk3::e_original_keysym = sym; - - //NSLog(@cocoaKeyboardHandler: keycode=%08x keysym=%08x mods=%08x symbol=%@ (%@), - // keyCode, sym, mods, [theEvent characters], [theEvent charactersIgnoringModifiers]); - - // If there is text associated with this key, it will be filled in later. - fltk3::e_length = 0; - fltk3::e_text = (char*); -} - - -/* * Open callback function to call... */ @@ -1644,7 +1583,121 @@ } } +/** How FLTK handles Mac OS text input + + Let myview be the instance of the FLView class that has the keyboard focus. FLView is an FLTK-defined NSView subclass + that implements the NSTextInputClient protocol to properly handle text input. It also implements the old NSTextInput + protocol to run with OS = 10.4. The few NSTextInput protocol methods that differ in signature from the
[fltk.commit] [Library] r9799 - branches/branch-1.3/src
Author: manolo Date: 2013-01-17 09:40:53 -0800 (Thu, 17 Jan 2013) New Revision: 9799 Log: Mac OS: reorganized the text input handling code. Added a detailed description of what the code does for this rather complex issue in comments. Modified: branches/branch-1.3/src/Fl_cocoa.mm Modified: branches/branch-1.3/src/Fl_cocoa.mm === --- branches/branch-1.3/src/Fl_cocoa.mm 2013-01-16 15:25:39 UTC (rev 9798) +++ branches/branch-1.3/src/Fl_cocoa.mm 2013-01-17 17:40:53 UTC (rev 9799) @@ -105,6 +105,7 @@ Window fl_window; Fl_Window *Fl_Window::current_; int fl_mac_os_version = calc_mac_os_version(); // the version number of the running Mac OS X (e.g., 100604 for 10.6.4) +static SEL inputContextSEL = (fl_mac_os_version = 100600 ? @selector(inputContext) : @selector(FLinputContext)); // forward declarations of variables in this file static int got_events = 0; @@ -899,92 +900,30 @@ return; } -@interface FLTextView : NSTextView -// this subclass is needed under OS X = 10.5 but not under = 10.6 where the base class is enough +@interface FLTextView : NSTextView // this subclass is only needed under OS X 10.6 { + BOOL isActive; } -- (void)interpretKeyEvents:(NSArray *)eventArray; +- (void)insertText:(id)aString; +- (void)doCommandBySelector:(SEL)aSelector; +- (void)setActive:(BOOL)a; @end @implementation FLTextView - (void)insertText:(id)aString { - [[[NSApp keyWindow] contentView] insertText:aString]; + if (isActive) [[[NSApp keyWindow] contentView] insertText:aString]; } - (void)doCommandBySelector:(SEL)aSelector { [[[NSApp keyWindow] contentView] doCommandBySelector:aSelector]; } -- (void)interpretKeyEvents:(NSArray *)eventArray +- (void)setActive:(BOOL)a { - if (Fl::e_keysym == FL_BackSpace || Fl::e_keysym == FL_KP_Enter || - Fl::e_keysym == FL_Enter || Fl::e_keysym == FL_Escape || Fl::e_keysym == FL_Tab ) { -NSEvent *theEvent = (NSEvent*)[eventArray objectAtIndex:0]; -// interpretKeyEvents doesn't output anything for these 5 keys under 10.5 or below -NSString *s = [theEvent characters]; -if ([s length] = 1) { - static char utf[2] = {0, 0}; - utf[0] = [s UTF8String][0]; - Fl::e_text = utf; - Fl::e_length = 1; - } -Fl_Window *window = [(FLWindow*)[theEvent window] getFl_Window]; -Fl::handle(FL_KEYBOARD, window); - } - else [super interpretKeyEvents:eventArray]; + isActive = a; } @end /* -Handle cocoa keyboard events -Events during a character composition sequence: - - keydown with deadkey - [[theEvent characters] length] is 0 - - keyup - [theEvent characters] contains the deadkey - - keydown with next key - [theEvent characters] contains the composed character - - keyup - [theEvent characters] contains the standard character - */ -static void cocoaKeyboardHandler(NSEvent *theEvent) -{ - NSUInteger mods; - - // get the modifiers - mods = [theEvent modifierFlags]; - // get the key code - UInt32 keyCode = 0, maskedKeyCode = 0; - unsigned short sym = 0; - keyCode = [theEvent keyCode]; - // extended keyboards can also send sequences on key-up to generate Kanji etc. codes. - // Some observed prefixes are 0x81 to 0x83, followed by an 8 bit keycode. - // In this mode, there seem to be no key-down codes - // printf(%08x %08x %08x\n, keyCode, mods, key); - maskedKeyCode = keyCode 0x7f; - - if ([theEvent type] == NSKeyUp) { -Fl::e_state = 0xbfff; // clear the deadkey flag - } - - mods_to_e_state( mods ); // process modifier keys - sym = macKeyLookUp[maskedKeyCode]; - if (sym 0xff00) { // a simple key -// find the result of this key without modifier -NSString *sim = [theEvent charactersIgnoringModifiers]; -UniChar one; -CFStringGetCharacters((CFStringRef)sim, CFRangeMake(0, 1), one); -// charactersIgnoringModifiers doesn't ignore shift, remove it when it's on -if(one = 'A' one = 'Z') one += 32; -if (one 0 one = 0x7f (sym'0' || sym'9') ) sym = one; - } - Fl::e_keysym = Fl::e_original_keysym = sym; - - /*NSLog(@cocoaKeyboardHandler: keycode=%08x keysym=%08x mods=%08x symbol=%@ (%@), -keyCode, sym, mods, [theEvent characters], [theEvent charactersIgnoringModifiers]);*/ - - // If there is text associated with this key, it will be filled in later. - Fl::e_length = 0; - Fl::e_text = (char*); -} - - -/* * Open callback function to call... */ static void(*open_cb)(const char *) = 0; @@ -1667,7 +1606,121 @@ } } +/** How FLTK handles Mac OS text input + + Let myview be the instance of the FLView class that has the keyboard focus. FLView is an FLTK-defined NSView subclass + that implements the NSTextInputClient protocol to properly handle text input. It also implements the old NSTextInput + protocol to run with OS = 10.4. The few NSTextInput protocol methods that differ in signature from the NSTextInputClient + protocol transmit the received message to the
[fltk.commit] [Library] r9796 - branches/branch-1.3
Author: ianmacarthur Date: 2013-01-16 04:48:29 -0800 (Wed, 16 Jan 2013) New Revision: 9796 Log: I just noticed that when 1.3.2 was released, the FL_PATCH_VERSION in configure.in was left at 1 rather than being bumped to 2. Though the FL_PATCH_VERSION in Enumerations.H seems to be fine, I think. Modified: branches/branch-1.3/configure.in Modified: branches/branch-1.3/configure.in === --- branches/branch-1.3/configure.in2013-01-16 08:45:35 UTC (rev 9795) +++ branches/branch-1.3/configure.in2013-01-16 12:48:29 UTC (rev 9796) @@ -38,7 +38,7 @@ dnl FLTK library versions... FL_MAJOR_VERSION=1 FL_MINOR_VERSION=3 -FL_PATCH_VERSION=1 +FL_PATCH_VERSION=2 FL_API_VERSION=${FL_MAJOR_VERSION}.${FL_MINOR_VERSION} AC_SUBST(FL_MAJOR_VERSION) ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9793 - branches/branch-1.3/src
Author: manolo Date: 2013-01-14 01:07:34 -0800 (Mon, 14 Jan 2013) New Revision: 9793 Log: Mac OS: added support for the text input feature introduced in OS 10.7 Lion where pressing and holding some key opens a window with possible accented characters: added [NSView windowLevel] useful for fullscreen windows. Modified: branches/branch-1.3/src/Fl_cocoa.mm Modified: branches/branch-1.3/src/Fl_cocoa.mm === --- branches/branch-1.3/src/Fl_cocoa.mm 2013-01-13 15:25:37 UTC (rev 9792) +++ branches/branch-1.3/src/Fl_cocoa.mm 2013-01-14 09:07:34 UTC (rev 9793) @@ -2100,6 +2100,10 @@ return 0; } +- (NSInteger)windowLevel { + return [[self window] level]; +} + - (NSInteger)conversationIdentifier { return identifier; } ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9794 - in branches/branch-3.0: include/fltk3 src/fltk3
Author: manolo Date: 2013-01-14 09:23:42 -0800 (Mon, 14 Jan 2013) New Revision: 9794 Log: Mac OS: added support for the text input feature introduced in OS 10.7 Lion where pressing and holding some key opens a window with possible accented characters. Modified: branches/branch-3.0/include/fltk3/Widget.h branches/branch-3.0/include/fltk3/osx.h branches/branch-3.0/include/fltk3/run.h branches/branch-3.0/src/fltk3/Input.cxx branches/branch-3.0/src/fltk3/Input_.cxx branches/branch-3.0/src/fltk3/TextDisplay.cxx branches/branch-3.0/src/fltk3/TextEditor.cxx branches/branch-3.0/src/fltk3/cocoa.mm branches/branch-3.0/src/fltk3/compose.cxx Modified: branches/branch-3.0/include/fltk3/Widget.h === --- branches/branch-3.0/include/fltk3/Widget.h 2013-01-14 09:07:34 UTC (rev 9793) +++ branches/branch-3.0/include/fltk3/Widget.h 2013-01-14 17:23:42 UTC (rev 9794) @@ -429,6 +429,7 @@ NO_OVERLAY = 115, /// window not using a hardware overlay plane (fltk3::MenuWindow) COPIED_TOOLTIP = 117, /// the widget tooltip is internally copied, its destruction is handled by the widget FULLSCREEN = 118, /// a fullscreen window (Fl_Window) + MAC_USE_ACCENTS_MENU = 119, /// On the Mac OS platform, pressing and holding a key on the keyboard opens an accented-character menu window (Fl_Input_, Fl_Text_Editor) // (space for more flags) USERFLAG3 = 129, /// reserved for 3rd party extensions USERFLAG2 = 130, /// reserved for 3rd party extensions @@ -1035,6 +1036,11 @@ \see fltk3::Widget::as_group(), fltk3::Widget::as_window() */ virtual fltk3::ShapedWindow* as_shaped_window() {return 0;} + +/** Returns non zero if MAC_USE_ACCENTS_MENU flag is set, 0 otherwise. + */ +int use_accents_menu() { return flags() MAC_USE_ACCENTS_MENU; } + }; Modified: branches/branch-3.0/include/fltk3/osx.h === --- branches/branch-3.0/include/fltk3/osx.h 2013-01-14 09:07:34 UTC (rev 9793) +++ branches/branch-3.0/include/fltk3/osx.h 2013-01-14 17:23:42 UTC (rev 9794) @@ -146,7 +146,7 @@ static void screen_work_area(int X, int Y, int W, int H, int n); // compute work area of a given screen static unsigned short *compute_macKeyLookUp(); 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); // computes window coordinates of insertion point + static int insertion_point_location(int *px, int *py, int *pheight); // computes window coordinates height of insertion point private: static void relink(fltk3::Window*, fltk3::Window*); bool subwindow; Modified: branches/branch-3.0/include/fltk3/run.h === --- branches/branch-3.0/include/fltk3/run.h 2013-01-14 09:07:34 UTC (rev 9793) +++ branches/branch-3.0/include/fltk3/run.h 2013-01-14 17:23:42 UTC (rev 9794) @@ -155,7 +155,7 @@ #ifdef __APPLE__ int marked_text_length(); // returns length of marked text void reset_marked_text(); // resets marked text - void insertion_point_location(int x, int y); // sets window coordinates of insertion point + void insertion_point_location(int x, int y, int height); // sets window coordinates height of insertion point #endif #endif /** Modified: branches/branch-3.0/src/fltk3/Input.cxx === --- branches/branch-3.0/src/fltk3/Input.cxx 2013-01-14 09:07:34 UTC (rev 9793) +++ branches/branch-3.0/src/fltk3/Input.cxx 2013-01-14 17:23:42 UTC (rev 9794) @@ -810,12 +810,14 @@ fltk3::FloatInput::FloatInput(int X,int Y,int W,int H,const char *l) : fltk3::NumericInput(X,Y,W,H,l) { type(fltk3::FLOAT_INPUT); + clear_flag(MAC_USE_ACCENTS_MENU); } fltk3::IntInput::IntInput(int X,int Y,int W,int H,const char *l) : fltk3::Input(X,Y,W,H,l) { type(fltk3::INT_INPUT); + clear_flag(MAC_USE_ACCENTS_MENU); } @@ -840,6 +842,7 @@ fltk3::SecretInput::SecretInput(int X,int Y,int W,int H,const char *l) : fltk3::Input(X,Y,W,H,l) { type(fltk3::SECRET_INPUT); + clear_flag(MAC_USE_ACCENTS_MENU); } int fltk3::SecretInput::handle(int event) { Modified: branches/branch-3.0/src/fltk3/Input_.cxx === --- branches/branch-3.0/src/fltk3/Input_.cxx2013-01-14 09:07:34 UTC (rev 9793) +++ branches/branch-3.0/src/fltk3/Input_.cxx2013-01-14 17:23:42 UTC (rev 9794) @@ -400,6 +400,9 @@ } else { fltk3::rectf((int)(xpos+curx+0.5), Y+ypos, 2, height); } +#ifdef __APPLE__ + fltk3::insertion_point_location(xpos+curx, Y+ypos+height, height); +#endif } CONTINUE: @@ -1149,6 +1152,7 @@
[fltk.commit] [Library] r9792 - in branches/branch-1.3: FL src
Author: manolo Date: 2013-01-13 07:25:37 -0800 (Sun, 13 Jan 2013) New Revision: 9792 Log: Mac OS: added support for the text input feature introduced in OS 10.7 Lion where pressing and holding some key opens a window with possible accented characters. This feature is used by the Fl_Input_ and Fl_Text_Editor widgets. User-defined text input widgets can optionally use this feature, but the default behavior is to not use it. Fl_Secret_Input turns it off, for example. Modified: branches/branch-1.3/FL/Fl.H branches/branch-1.3/FL/Fl_Widget.H branches/branch-1.3/FL/mac.H branches/branch-1.3/src/Fl_Input.cxx branches/branch-1.3/src/Fl_Input_.cxx branches/branch-1.3/src/Fl_Text_Display.cxx branches/branch-1.3/src/Fl_Text_Editor.cxx branches/branch-1.3/src/Fl_cocoa.mm branches/branch-1.3/src/Fl_compose.cxx Modified: branches/branch-1.3/FL/Fl.H === --- branches/branch-1.3/FL/Fl.H 2013-01-10 09:17:58 UTC (rev 9791) +++ branches/branch-1.3/FL/Fl.H 2013-01-13 15:25:37 UTC (rev 9792) @@ -147,7 +147,7 @@ #ifdef __APPLE__ static int marked_text_length(void); // returns length of marked text static void reset_marked_text(); // resets marked text - static void insertion_point_location(int x, int y); // sets window coordinates of insertion point + static void insertion_point_location(int x, int y, int height); // sets window coordinates height of insertion point #endif #endif /** Modified: branches/branch-1.3/FL/Fl_Widget.H === --- branches/branch-1.3/FL/Fl_Widget.H 2013-01-10 09:17:58 UTC (rev 9791) +++ branches/branch-1.3/FL/Fl_Widget.H 2013-01-13 15:25:37 UTC (rev 9792) @@ -171,6 +171,7 @@ GROUP_RELATIVE = 116, /// position this widget relative to the parent group, not to the window COPIED_TOOLTIP = 117, /// the widget tooltip is internally copied, its destruction is handled by the widget FULLSCREEN = 118, /// a fullscreen window (Fl_Window) +MAC_USE_ACCENTS_MENU = 119, /// On the Mac OS platform, pressing and holding a key on the keyboard opens an accented-character menu window (Fl_Input_, Fl_Text_Editor) // (space for more flags) USERFLAG3 = 129, /// reserved for 3rd party extensions USERFLAG2 = 130, /// reserved for 3rd party extensions @@ -976,6 +977,10 @@ */ virtual class Fl_Gl_Window* as_gl_window() {return 0;} + /** Returns non zero if MAC_USE_ACCENTS_MENU flag is set, 0 otherwise. + */ + int use_accents_menu() { return flags() MAC_USE_ACCENTS_MENU; } + /** For back compatibility only. \deprecated Use selection_color() instead. */ Modified: branches/branch-1.3/FL/mac.H === --- branches/branch-1.3/FL/mac.H2013-01-10 09:17:58 UTC (rev 9791) +++ branches/branch-1.3/FL/mac.H2013-01-13 15:25:37 UTC (rev 9792) @@ -132,7 +132,7 @@ 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); // computes window coordinates of insertion point + static int insertion_point_location(int *px, int *py, int *pheight); // computes window coordinates height of insertion point private: static void relink(Fl_Window*, Fl_Window*); bool subwindow; Modified: branches/branch-1.3/src/Fl_Input.cxx === --- branches/branch-1.3/src/Fl_Input.cxx2013-01-10 09:17:58 UTC (rev 9791) +++ branches/branch-1.3/src/Fl_Input.cxx2013-01-13 15:25:37 UTC (rev 9792) @@ -780,12 +780,14 @@ : Fl_Input(X,Y,W,H,l) { type(FL_FLOAT_INPUT); + clear_flag(MAC_USE_ACCENTS_MENU); } Fl_Int_Input::Fl_Int_Input(int X,int Y,int W,int H,const char *l) : Fl_Input(X,Y,W,H,l) { type(FL_INT_INPUT); + clear_flag(MAC_USE_ACCENTS_MENU); } @@ -810,6 +812,7 @@ Fl_Secret_Input::Fl_Secret_Input(int X,int Y,int W,int H,const char *l) : Fl_Input(X,Y,W,H,l) { type(FL_SECRET_INPUT); + clear_flag(MAC_USE_ACCENTS_MENU); } int Fl_Secret_Input::handle(int event) { Modified: branches/branch-1.3/src/Fl_Input_.cxx === --- branches/branch-1.3/src/Fl_Input_.cxx 2013-01-10 09:17:58 UTC (rev 9791) +++ branches/branch-1.3/src/Fl_Input_.cxx 2013-01-13 15:25:37 UTC (rev 9792) @@ -388,6 +388,9 @@ } else { fl_rectf((int)(xpos+curx+0.5), Y+ypos, 2, height); } +#ifdef __APPLE__ + Fl::insertion_point_location(xpos+curx, Y+ypos+height, height); +#endif } CONTINUE: @@ -1119,6 +1122,7 @@ maximum_size_ = 32767; shortcut_
[fltk.commit] [Library] r9790 - branches/branch-1.3/src
Author: manolo Date: 2013-01-10 00:57:19 -0800 (Thu, 10 Jan 2013) New Revision: 9790 Log: About the fix for a problem apparent with the cube test program: if the cube window is moved around rapidly, the GL pixels leak away from where they should be. This problem no longer occurs with Mac OS 10.7 and above. The fix is thus made effective only when OS 10.7. Modified: branches/branch-1.3/src/Fl_cocoa.mm Modified: branches/branch-1.3/src/Fl_cocoa.mm === --- branches/branch-1.3/src/Fl_cocoa.mm 2013-01-09 09:03:47 UTC (rev 9789) +++ branches/branch-1.3/src/Fl_cocoa.mm 2013-01-10 08:57:19 UTC (rev 9790) @@ -629,8 +629,13 @@ contentRect:(NSRect)rect styleMask:(NSUInteger)windowStyle; - (Fl_Window *)getFl_Window; +/* These two functions allow to check if a window contains OpenGL-subwindows. + This is useful only for Mac OS 10.7 to repair a problem apparent with the cube test program: + if the cube window is moved around rapidly (with OS 10.7), the GL pixels leak away from where they should be. + The repair is performed by [FLWindowDelegate windowDidMove:], only if OS 10.7. + */ - (BOOL)containsGLsubwindow; -- (void)setContainsGLsubwindow:(BOOL)contains; +- (void)containsGLsubwindow:(BOOL)contains; @end @implementation FLWindow @@ -653,7 +658,7 @@ { return containsGLsubwindow; } -- (void)setContainsGLsubwindow:(BOOL)contains +- (void)containsGLsubwindow:(BOOL)contains { containsGLsubwindow = contains; } @@ -1030,8 +1035,8 @@ update_e_xy_and_e_xy_root(nsw); resize_from_system = window; window-position((int)pt2.x, (int)(main_screen_height - pt2.y)); - if ([nsw containsGLsubwindow] ) { -[nsw display];// redraw window after moving if it contains OpenGL subwindows + if ([nsw containsGLsubwindow] fl_mac_os_version 100700) { +[nsw display];// with OS 10.7, redraw window after moving if it contains OpenGL subwindows } fl_unlock_function(); } @@ -2123,7 +2128,7 @@ } if (w-as_gl_window()) { // if creating a sub-GL-window while (win-window()) win = win-window(); - [Fl_X::i(win)-xid setContainsGLsubwindow:YES]; + [Fl_X::i(win)-xid containsGLsubwindow:YES]; } fl_show_iconic = 0; } ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9791 - branches/branch-3.0/src/fltk3
Author: manolo Date: 2013-01-10 01:17:58 -0800 (Thu, 10 Jan 2013) New Revision: 9791 Log: About the fix for a problem apparent with the cube test program: if the cube window is moved around rapidly, the GL pixels leak away from where they should be. This problem no longer occurs with Mac OS 10.7 and above. The fix is thus made effective only when OS 10.7. Modified: branches/branch-3.0/src/fltk3/cocoa.mm Modified: branches/branch-3.0/src/fltk3/cocoa.mm === --- branches/branch-3.0/src/fltk3/cocoa.mm 2013-01-10 08:57:19 UTC (rev 9790) +++ branches/branch-3.0/src/fltk3/cocoa.mm 2013-01-10 09:17:58 UTC (rev 9791) @@ -626,8 +626,13 @@ contentRect:(NSRect)rect styleMask:(NSUInteger)windowStyle; - (fltk3::Window *)getFl_Window; +/* These two functions allow to check if a window contains OpenGL-subwindows. + This is useful only for Mac OS 10.7 to repair a problem apparent with the cube test program: + if the cube window is moved around rapidly (with OS 10.7), the GL pixels leak away from where they should be. + The repair is performed by [FLWindowDelegate windowDidMove:], only if OS 10.7. + */ - (BOOL)containsGLsubwindow; -- (void)setContainsGLsubwindow:(BOOL)contains; +- (void)containsGLsubwindow:(BOOL)contains; @end @implementation FLWindow @@ -650,7 +655,7 @@ { return containsGLsubwindow; } -- (void)setContainsGLsubwindow:(BOOL)contains +- (void)containsGLsubwindow:(BOOL)contains { containsGLsubwindow = contains; } @@ -1009,8 +1014,8 @@ update_e_xy_and_e_xy_root(nsw); resize_from_system = window; window-position((int)pt2.x, (int)(main_screen_height - pt2.y)); - if ([nsw containsGLsubwindow] ) { -[nsw display];// redraw window after moving if it contains OpenGL subwindows + if ([nsw containsGLsubwindow] fl_mac_os_version 100700) { +[nsw display];// with OS 10.7, redraw window after moving if it contains OpenGL subwindows } fl_unlock_function(); } @@ -2094,7 +2099,7 @@ } if (w-as_gl_window()) { // if creating a sub-GL-window while (win-window()) win = win-window(); - [Fl_X::i(win)-xid setContainsGLsubwindow:YES]; + [Fl_X::i(win)-xid containsGLsubwindow:YES]; } fl_show_iconic = 0; } ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9789 - branches/branch-3.0/src/fltk3
Author: manolo Date: 2013-01-09 01:03:47 -0800 (Wed, 09 Jan 2013) New Revision: 9789 Log: Fix STR#2915 where subwindow stayed hidden after hide() and then show(). Modified: branches/branch-3.0/src/fltk3/cocoa.mm Modified: branches/branch-3.0/src/fltk3/cocoa.mm === --- branches/branch-3.0/src/fltk3/cocoa.mm 2013-01-08 21:06:29 UTC (rev 9788) +++ branches/branch-3.0/src/fltk3/cocoa.mm 2013-01-09 09:03:47 UTC (rev 9789) @@ -2072,6 +2072,7 @@ x-subRegion = 0; x-cursor = fl_default_cursor; x-gc = 0; // stay 0 for Quickdraw; fill with CGContext for Quartz +w-set_visible(); fltk3::Window *win = w-window(); Fl_X *xo = Fl_X::i(win); if (xo) { ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9788 - branches/branch-1.3/src
Author: manolo Date: 2013-01-08 13:06:29 -0800 (Tue, 08 Jan 2013) New Revision: 9788 Log: Fix STR#2915 where subwindow stayed hidden after hide() and then show(). Modified: branches/branch-1.3/src/Fl_cocoa.mm Modified: branches/branch-1.3/src/Fl_cocoa.mm === --- branches/branch-1.3/src/Fl_cocoa.mm 2013-01-07 16:16:45 UTC (rev 9787) +++ branches/branch-1.3/src/Fl_cocoa.mm 2013-01-08 21:06:29 UTC (rev 9788) @@ -2101,6 +2101,7 @@ x-subRegion = 0; x-cursor = fl_default_cursor; x-gc = 0; // stay 0 for Quickdraw; fill with CGContext for Quartz +w-set_visible(); Fl_Window *win = w-window(); Fl_X *xo = Fl_X::i(win); if (xo) { ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9786 - branches/branch-1.3/src
Author: manolo Date: 2013-01-07 07:56:14 -0800 (Mon, 07 Jan 2013) New Revision: 9786 Log: Mac OS: divided the FLDelegate object in two objects, FLWindowDelegate and FLAppDelegate. This might help mixing FLTK and other window-creating systems. Modified: branches/branch-1.3/src/Fl_cocoa.mm Modified: branches/branch-1.3/src/Fl_cocoa.mm === --- branches/branch-1.3/src/Fl_cocoa.mm 2013-01-05 22:24:34 UTC (rev 9785) +++ branches/branch-1.3/src/Fl_cocoa.mm 2013-01-07 15:56:14 UTC (rev 9786) @@ -993,13 +993,11 @@ } -@interface FLDelegate : NSObject +@interface FLWindowDelegate : NSObject #if MAC_OS_X_VERSION_MAX_ALLOWED = MAC_OS_X_VERSION_10_6 -NSWindowDelegate, NSApplicationDelegate +NSWindowDelegate #endif -{ - BOOL seen_open_file; -} ++ (FLWindowDelegate*)createOnce; - (void)windowDidMove:(NSNotification *)notif; - (void)windowDidResize:(NSNotification *)notif; - (void)windowDidResignKey:(NSNotification *)notif; @@ -1008,18 +1006,18 @@ - (void)windowDidDeminiaturize:(NSNotification *)notif; - (void)windowDidMiniaturize:(NSNotification *)notif; - (BOOL)windowShouldClose:(id)fl; +- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client; - (void)anyWindowWillClose:(NSNotification *)notif; -- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender; -- (void)applicationDidBecomeActive:(NSNotification *)notify; -- (void)applicationDidChangeScreenParameters:(NSNotification *)aNotification; -- (void)applicationWillResignActive:(NSNotification *)notify; -- (void)applicationWillHide:(NSNotification *)notify; -- (void)applicationWillUnhide:(NSNotification *)notify; -- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client; -- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename; -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification; @end -@implementation FLDelegate +@implementation FLWindowDelegate ++ (FLWindowDelegate*)createOnce +{ + static FLWindowDelegate* delegate = nil; + if (!delegate) { +delegate = [[FLWindowDelegate alloc] init]; +} + return delegate; +} - (void)windowDidMove:(NSNotification *)notif { fl_lock_function(); @@ -1061,7 +1059,7 @@ FLWindow *nsw = (FLWindow*)[notif object]; Fl_Window *window = [nsw getFl_Window]; /* Fullscreen windows obscure all other windows so we need to return - to a normal level when the user switches to another window */ + to a normal level when the user switches to another window */ if (window-fullscreen_active()) [nsw setLevel:NSNormalWindowLevel]; Fl::handle( FL_UNFOCUS, window); @@ -1112,6 +1110,18 @@ // the system doesn't need to send [fl close] because FLTK does it when needed return NO; } +- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client +{ + if (fl_mac_os_version 100600) { +static FLTextView *view = nil; +if (!view) { + NSRect rect={{0,0},{20,20}}; + view = [[FLTextView alloc] initWithFrame:rect]; +} +return view; + } + return nil; +} - (void)anyWindowWillClose:(NSNotification *)notif { fl_lock_function(); @@ -1121,13 +1131,32 @@ Fl_Window *w = Fl::first_window(); while (w (w-parent() || !w-border() || !w-visible())) { w = Fl::next_window(w); - } +} if (w) { [Fl_X::i(w)-xid makeKeyWindow]; } } fl_unlock_function(); } +@end + +@interface FLAppDelegate : NSObject +#if MAC_OS_X_VERSION_MAX_ALLOWED = MAC_OS_X_VERSION_10_6 +NSApplicationDelegate +#endif +{ + BOOL seen_open_file; +} +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender; +- (void)applicationDidBecomeActive:(NSNotification *)notify; +- (void)applicationDidChangeScreenParameters:(NSNotification *)aNotification; +- (void)applicationWillResignActive:(NSNotification *)notify; +- (void)applicationWillHide:(NSNotification *)notify; +- (void)applicationWillUnhide:(NSNotification *)notify; +- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename; +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification; +@end +@implementation FLAppDelegate - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender { fl_lock_function(); @@ -1259,18 +1288,6 @@ } fl_unlock_function(); } -- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client -{ - if (fl_mac_os_version 100600) { -static FLTextView *view = nil; -if (!view) { - NSRect rect={{0,0},{20,20}}; - view = [[FLTextView alloc] initWithFrame:rect]; -} -return view; - } - return nil; -} - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename { seen_open_file = YES; @@ -1338,7 +1355,7 @@ if (need_new_nsapp) [NSApplication sharedApplication]; NSAutoreleasePool *localPool; localPool = [[NSAutoreleasePool alloc] init]; // never released -[NSApp
[fltk.commit] [Library] r9787 - branches/branch-3.0/src/fltk3
Author: manolo Date: 2013-01-07 08:16:45 -0800 (Mon, 07 Jan 2013) New Revision: 9787 Log: Mac OS: divided the FLDelegate object in two objects, FLWindowDelegate and FLAppDelegate. This might help mixing FLTK and other window-creating systems. Modified: branches/branch-3.0/src/fltk3/cocoa.mm Modified: branches/branch-3.0/src/fltk3/cocoa.mm === --- branches/branch-3.0/src/fltk3/cocoa.mm 2013-01-07 15:56:14 UTC (rev 9786) +++ branches/branch-3.0/src/fltk3/cocoa.mm 2013-01-07 16:16:45 UTC (rev 9787) @@ -972,13 +972,11 @@ } -@interface FLDelegate : NSObject +@interface FLWindowDelegate : NSObject #if MAC_OS_X_VERSION_MAX_ALLOWED = MAC_OS_X_VERSION_10_6 -NSWindowDelegate, NSApplicationDelegate +NSWindowDelegate #endif -{ - BOOL seen_open_file; -} ++ (FLWindowDelegate*)createOnce; - (void)windowDidMove:(NSNotification *)notif; - (void)windowDidResize:(NSNotification *)notif; - (void)windowDidResignKey:(NSNotification *)notif; @@ -987,18 +985,18 @@ - (void)windowDidDeminiaturize:(NSNotification *)notif; - (void)windowDidMiniaturize:(NSNotification *)notif; - (BOOL)windowShouldClose:(id)fl; +- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client; - (void)anyWindowWillClose:(NSNotification *)notif; -- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender; -- (void)applicationDidBecomeActive:(NSNotification *)notify; -- (void)applicationDidChangeScreenParameters:(NSNotification *)aNotification; -- (void)applicationWillResignActive:(NSNotification *)notify; -- (void)applicationWillHide:(NSNotification *)notify; -- (void)applicationWillUnhide:(NSNotification *)notify; -- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client; -- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename; -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification; @end -@implementation FLDelegate +@implementation FLWindowDelegate ++ (FLWindowDelegate*)createOnce +{ + static FLWindowDelegate* delegate = nil; + if (!delegate) { +delegate = [[FLWindowDelegate alloc] init]; + } + return delegate; +} - (void)windowDidMove:(NSNotification *)notif { fl_lock_function(); @@ -1090,6 +1088,18 @@ fl_unlock_function(); return NO; // the system doesn't need to send [fl close] because FLTK does it when needed } +- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client +{ + if (fl_mac_os_version 100600) { +static FLTextView *view = nil; +if (!view) { + NSRect rect={{0,0},{20,20}}; + view = [[FLTextView alloc] initWithFrame:rect]; +} +return view; + } + return nil; +} - (void)anyWindowWillClose:(NSNotification *)notif { fl_lock_function(); @@ -1106,6 +1116,25 @@ } fl_unlock_function(); } +@end + +@interface FLAppDelegate : NSObject +#if MAC_OS_X_VERSION_MAX_ALLOWED = MAC_OS_X_VERSION_10_6 +NSApplicationDelegate +#endif +{ + BOOL seen_open_file; +} +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender; +- (void)applicationDidBecomeActive:(NSNotification *)notify; +- (void)applicationDidChangeScreenParameters:(NSNotification *)aNotification; +- (void)applicationWillResignActive:(NSNotification *)notify; +- (void)applicationWillHide:(NSNotification *)notify; +- (void)applicationWillUnhide:(NSNotification *)notify; +- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename; +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification; +@end +@implementation FLAppDelegate - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender { fl_lock_function(); @@ -1237,18 +1266,6 @@ } fl_unlock_function(); } -- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client -{ - if (fl_mac_os_version 100600) { -static FLTextView *view = nil; -if (!view) { - NSRect rect={{0,0},{20,20}}; - view = [[FLTextView alloc] initWithFrame:rect]; -} -return view; - } - return nil; -} - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename { seen_open_file = YES; @@ -1316,7 +1333,7 @@ if (need_new_nsapp) [NSApplication sharedApplication]; NSAutoreleasePool *localPool; localPool = [[NSAutoreleasePool alloc] init]; // never released -[NSApp setDelegate:[[FLDelegate alloc] init]]; +[NSApp setDelegate:[[FLAppDelegate alloc] init]]; if (need_new_nsapp) [NSApp finishLaunching]; // empty the event queue but keep system events for dragdrop of files at launch @@ -1363,7 +1380,7 @@ } if (![NSApp servicesMenu]) createAppleMenu(); main_screen_height = [[[NSScreen screens] objectAtIndex:0] frame].size.height; -[[NSNotificationCenter defaultCenter] addObserver:[NSApp delegate] +[[NSNotificationCenter defaultCenter] addObserver:[FLWindowDelegate createOnce]
[fltk.commit] [Library] r9785 - in branches/branch-3.0: include/fltk3 src/fltk3
Author: manolo Date: 2013-01-05 14:24:34 -0800 (Sat, 05 Jan 2013) New Revision: 9785 Log: Removed fltk3::Widget::dragimage(fltk3::Image*) that had been introduced at r.9783. Instead, added an optional, Mac OS-specific argument to fltk3::dnd() to control the image used as a cursor when dragging from a widget on the Mac OS platform. Modified: branches/branch-3.0/include/fltk3/Widget.h branches/branch-3.0/include/fltk3/run.h branches/branch-3.0/src/fltk3/cocoa.mm Modified: branches/branch-3.0/include/fltk3/Widget.h === --- branches/branch-3.0/include/fltk3/Widget.h 2013-01-04 08:15:12 UTC (rev 9784) +++ branches/branch-3.0/include/fltk3/Widget.h 2013-01-05 22:24:34 UTC (rev 9785) @@ -370,18 +370,7 @@ \param[in] img the new image for the deactivated widget */ void deimage(fltk3::Image img) {deimage_=img;} - -/** Sets the image to use when dragging from the widget. - This image is used on the Mac OS platform as a cursor when dragging from - the widget. If no (or a NULL) dragging image is assigned to a widget, the text - data in the selection buffer is used to build an image. - \param[in] img the image used when dragging from the widget - */ -void dragimage(fltk3::Image* img) {dragimage_=img;} -/** Gets the image that is used when dragging from the widget. - */ -fltk3::Image* dragimage() {return dragimage_;} - + }; Modified: branches/branch-3.0/include/fltk3/run.h === --- branches/branch-3.0/include/fltk3/run.h 2013-01-04 08:15:12 UTC (rev 9784) +++ branches/branch-3.0/include/fltk3/run.h 2013-01-05 22:24:34 UTC (rev 9785) @@ -770,8 +770,17 @@ Create a selection first using: fltk3::copy(const char *stuff, int len, 0) + + On the Mac OS platform, the \p dragimage optional argument + sets the image to use as a cursor when dragging. + If no (or a NULL) dragging image is used, the text + data in the selection buffer is used to build the cursor. */ - int dnd(); // platform dependent + int dnd( +#if defined(__APPLE__) || defined(FL_DOXYGEN) + fltk3::Image* dragimage = NULL +#endif + ); // platform dependent // These are for back-compatibility only: /** back-compatibility only: Gets the widget owning the current selection Modified: branches/branch-3.0/src/fltk3/cocoa.mm === --- branches/branch-3.0/src/fltk3/cocoa.mm 2013-01-04 08:15:12 UTC (rev 9784) +++ branches/branch-3.0/src/fltk3/cocoa.mm 2013-01-05 22:24:34 UTC (rev 9785) @@ -3027,7 +3027,7 @@ return image; } -static NSImage *defaultDragImage(int *pwidth, int *pheight, fltk3::Image* img) +static NSImage *makeDragImage(int *pwidth, int *pheight, fltk3::Image* img) { *pwidth = img-w(); *pheight = img-h(); @@ -3035,12 +3035,12 @@ fl_begin_offscreen(off); img-draw(0,0); fl_end_offscreen(); - NSImage* image = CGBitmapContextToNSImage( (CGContextRef)off ); - fl_delete_offscreen( off ); + NSImage* image = CGBitmapContextToNSImage(off); + fl_delete_offscreen(off); return image; } -int fltk3::dnd(void) +int fltk3::dnd(fltk3::Image* dragimage) { CFDataRef text = CFDataCreate(kCFAllocatorDefault, (UInt8*)fl_selection_buffer[0], fl_selection_length[0]); if (text==NULL) return false; @@ -3062,11 +3062,11 @@ int width, height; NSImage *image; - if ( !w-dragimage() ) { + if ( !dragimage ) { fl_selection_buffer[0][ fl_selection_length[0] ] = 0; image = imageFromText(fl_selection_buffer[0], width, height); } else { -image = defaultDragImage(width, height, w-dragimage()); +image = makeDragImage(width, height, dragimage); } static NSSize offset={0,0}; ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9784 - branches/branch-1.3/documentation/src
Author: greg.ercolano Date: 2013-01-04 00:15:12 -0800 (Fri, 04 Jan 2013) New Revision: 9784 Log: Added Fl::run() to list of things not to call in child thread.. Modified: branches/branch-1.3/documentation/src/advanced.dox Modified: branches/branch-1.3/documentation/src/advanced.dox === --- branches/branch-1.3/documentation/src/advanced.dox 2012-12-29 15:54:35 UTC (rev 9783) +++ branches/branch-1.3/documentation/src/advanced.dox 2013-01-04 08:15:12 UTC (rev 9784) @@ -84,7 +84,7 @@ widgets derived from Fl_Window, including dialogs, file choosers, subwindows or those using Fl_Gl_Window. -\li Don't call Fl::wait(), Fl::flush() or any +\li Don't call Fl::run(), Fl::wait(), Fl::flush() or any related methods that will handle system messages \li Don't start or cancel timers ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9781 - branches/branch-1.3/src
Author: manolo Date: 2012-12-29 03:58:49 -0800 (Sat, 29 Dec 2012) New Revision: 9781 Log: Display the moving insertion point when doing dragdrop to an Fl_Text_Display widget from the widget itself. Modified: branches/branch-1.3/src/Fl_Text_Display.cxx Modified: branches/branch-1.3/src/Fl_Text_Display.cxx === --- branches/branch-1.3/src/Fl_Text_Display.cxx 2012-12-26 19:58:31 UTC (rev 9780) +++ branches/branch-1.3/src/Fl_Text_Display.cxx 2012-12-29 11:58:49 UTC (rev 9781) @@ -3468,12 +3468,14 @@ } // draw the text cursor + int start, end; + int has_selection = buffer()-selection_position(start, end); if (damage() (FL_DAMAGE_ALL | FL_DAMAGE_SCROLL | FL_DAMAGE_EXPOSE) ( #ifdef __APPLE__ Fl::marked_text_length() || #endif - !buffer()-primary_selection()-selected()) + !has_selection || mCursorPos start || mCursorPos end) mCursorOn Fl::focus() == (Fl_Widget*)this ) { fl_push_clip(text_area.x-LEFT_MARGIN, text_area.y, ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9782 - branches/branch-3.0/src/fltk3
Author: manolo Date: 2012-12-29 06:14:41 -0800 (Sat, 29 Dec 2012) New Revision: 9782 Log: Display the moving insertion point when doing dragdrop to an fltk3::TextDisplay widget from the widget itself. Modified: branches/branch-3.0/src/fltk3/TextDisplay.cxx Modified: branches/branch-3.0/src/fltk3/TextDisplay.cxx === --- branches/branch-3.0/src/fltk3/TextDisplay.cxx 2012-12-29 11:58:49 UTC (rev 9781) +++ branches/branch-3.0/src/fltk3/TextDisplay.cxx 2012-12-29 14:14:41 UTC (rev 9782) @@ -3478,12 +3478,14 @@ } // draw the text cursor + int start, end; + int has_selection = buffer()-selection_position(start, end); if (damage() (fltk3::DAMAGE_ALL | fltk3::DAMAGE_SCROLL | fltk3::DAMAGE_EXPOSE) ( #ifdef __APPLE__ fltk3::marked_text_length() || #endif - !buffer()-primary_selection()-selected()) + !has_selection || mCursorPos start || mCursorPos end) mCursorOn fltk3::focus() == (fltk3::Widget*)this ) { fltk3::push_clip(text_area.x-LEFT_MARGIN, text_area.y, ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
[fltk.commit] [Library] r9783 - in branches/branch-3.0: include/fltk3 src/fltk3
Author: manolo Date: 2012-12-29 07:54:35 -0800 (Sat, 29 Dec 2012) New Revision: 9783 Log: Added fltk3::Widget::dragimage(fltk3::Image*) to control the image used as a cursor when dragging from a widget on the Mac OS platform. The default image is built from the text present in the selection buffer when dragging starts. This also removes any use of dynamic_cast. Modified: branches/branch-3.0/include/fltk3/Widget.h branches/branch-3.0/src/fltk3/Widget.cxx branches/branch-3.0/src/fltk3/cocoa.mm Modified: branches/branch-3.0/include/fltk3/Widget.h === --- branches/branch-3.0/include/fltk3/Widget.h 2012-12-29 14:14:41 UTC (rev 9782) +++ branches/branch-3.0/include/fltk3/Widget.h 2012-12-29 15:54:35 UTC (rev 9783) @@ -90,6 +90,8 @@ fltk3::Image* image_; /** optional image for a deactivated label */ fltk3::Image* deimage_; +/** optional image when dragging */ +fltk3::Image* dragimage_; public: @@ -369,6 +371,17 @@ */ void deimage(fltk3::Image img) {deimage_=img;} +/** Sets the image to use when dragging from the widget. + This image is used on the Mac OS platform as a cursor when dragging from + the widget. If no (or a NULL) dragging image is assigned to a widget, the text + data in the selection buffer is used to build an image. + \param[in] img the image used when dragging from the widget + */ +void dragimage(fltk3::Image* img) {dragimage_=img;} +/** Gets the image that is used when dragging from the widget. + */ +fltk3::Image* dragimage() {return dragimage_;} + }; Modified: branches/branch-3.0/src/fltk3/Widget.cxx === --- branches/branch-3.0/src/fltk3/Widget.cxx2012-12-29 14:14:41 UTC (rev 9782) +++ branches/branch-3.0/src/fltk3/Widget.cxx2012-12-29 15:54:35 UTC (rev 9783) @@ -110,7 +110,8 @@ labeltext_(L), flags_(0), image_(0), - deimage_(0) + deimage_(0), + dragimage_(0) { } Modified: branches/branch-3.0/src/fltk3/cocoa.mm === --- branches/branch-3.0/src/fltk3/cocoa.mm 2012-12-29 14:14:41 UTC (rev 9782) +++ branches/branch-3.0/src/fltk3/cocoa.mm 2012-12-29 15:54:35 UTC (rev 9783) @@ -3027,21 +3027,16 @@ return image; } -static NSImage *defaultDragImage(int *pwidth, int *pheight) +static NSImage *defaultDragImage(int *pwidth, int *pheight, fltk3::Image* img) { - const int width = 16, height = 16; - fltk3::Offscreen off = fltk3::QuartzGraphicsDriver::create_offscreen_with_alpha(width, height); + *pwidth = img-w(); + *pheight = img-h(); + fltk3::Offscreen off = fltk3::QuartzGraphicsDriver::create_offscreen_with_alpha(*pwidth, *pheight); fl_begin_offscreen(off); - CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); - fltk3::rectf(0,0,width,height); - CGContextSetRGBStrokeColor( (CGContextRef)off, 0,0,0,0.6); - fltk3::rect(0,0,width,height); - fltk3::rect(2,2,width-4,height-4); + img-draw(0,0); fl_end_offscreen(); NSImage* image = CGBitmapContextToNSImage( (CGContextRef)off ); fl_delete_offscreen( off ); - *pwidth = width; - *pheight = height; return image; } @@ -3064,19 +3059,18 @@ } NSView *myview = [Fl_X::i(win)-xid contentView]; NSEvent *theEvent = [NSApp currentEvent]; - + int width, height; NSImage *image; - if ( dynamic_castfltk3::Input_*(w) != NULL || dynamic_castfltk3::TextDisplay*(w) != NULL) { + if ( !w-dragimage() ) { fl_selection_buffer[0][ fl_selection_length[0] ] = 0; image = imageFromText(fl_selection_buffer[0], width, height); } else { -image = defaultDragImage(width, height); +image = defaultDragImage(width, height, w-dragimage()); } static NSSize offset={0,0}; NSPoint pt = [theEvent locationInWindow]; - pt.x -= width/2; pt.y -= height/2; [myview dragImage:image at:pt offset:offset event:theEvent pasteboard:mypasteboard ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit