Commit Graph

4797 Commits

Author SHA1 Message Date
Manolo Gouy
f7c2061f0c Improved the accuracy of clipping when printing on Mac OS.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8586 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-13 20:50:41 +00:00
Ian MacArthur
be6df55717 More attempts to clean up WIN32 handling of UTF16 surrogate pairs.
In particular, I have added a new function to src/fl_utf.c called fl_ucs_to_Utf16() which
converts a single 32-bit Unicode value into one (or more) UTF16 cells.

This is needed in the win32 char-by-char text width() logic, and I suspect may also be useful in the OSX code in some places.



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8585 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-13 15:43:22 +00:00
Manolo Gouy
639ee4fbab Now sends FL_HIDE/FL_SHOW events when window is iconized/un-iconized.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8584 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-13 09:03:19 +00:00
Manolo Gouy
404a7c1bad Restores change made in r.8557 that blocked system menu shortcuts.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8583 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-12 20:15:10 +00:00
Ian MacArthur
1d988db2db Under win32, text_extents() is not handling surrogate pairs either, at least on XP.
The problem seems to be in GetGlyphIndicesW() which is returning invalid indices for the surrogate pairs.
This causes subsequent measurements of the glyphs to fail, of course.

This patch does not fix the problem, it only makes sure it fails cleanly, causing a fallback to the default fl_measure like behaviour.
This is not nice, nor what I want, but at least it is consistent for now...



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8582 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-12 16:18:42 +00:00
Manolo Gouy
8b026342dd Following STR #2583, the behaviour of fl_draw_image() with d = 4 on Mac OS is here
made consistent with other platforms, that is, the 4th byte of each pixel is ignored
instead of treated as transparency data.
In the future, the fl_draw_image() signature may be extended with another argument
that would describe if and how transparency information is available.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8581 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-12 11:38:43 +00:00
Ian MacArthur
38a3c21ffd Modify win32 text width(ucs) function to handle surrogate pairs.
This now correctly measures glyphs whose codepoint requires a surrogate pair to represent it in UTF16.

NOTE 1: This code makes any UCS point > 0xFFFF a "special case" and measures it explicitly, rather than using the lookup table. This "explicit measure" may be slow, but actually seems OK in my tests, so far.
The lookup table still covers the basic multilingual plane and is used for any glyph <= 0xFFFF as before, so the behaviour for most existing bodies of text is unchanged.

This code also retains the historical behaviour under Win32 whereby strings are measured char-by-char rather than as a whole string - again this is intended to retain compatability with existing implementations.

It is proposed that we should move towards measuring entire strings in the future as this is conceivably more efficient and certainly more consistent - rendering is now largely done "string as a whole" so we ought to measure in that way too; though to date the differences seem tiny, as evdienced by the text rendering page of the unittest example.

NOTE 2: This does not fix the *rendering* of surrogate pairs under XP, which still seems to be broken. I suspect that TextOutW() may genuinely broken under XP, as it works fine on Vista, and it is not just my code that seems broken, other non-fltk programs exhibit the same aberrant behaviour. Measuring of surrogate pairs appears to work correctly though...
Maybe we are using TextOutW() wrongly?




git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8580 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-12 10:08:58 +00:00
Ian MacArthur
d065ca89fe modify the win32 text ::draw() function to do "string at once" rather than "char by char" rendering, as advised by Bill and Manolo.
This seems to be good so far, though does not resolve the XP surrogate pairs issues.
If this fix is bad, we need to revert to r8577, which is good...

And I still haven't fixed the handling of width in win32 code, so it is still inconsistent with draw for high Ubicode points.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8579 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-11 22:00:19 +00:00
Ian MacArthur
924ed100d6 Minor rework of code to make ::rtl_draw() and ::draw(int angle,...) more consistent in coding terms. Behaviour of output unchanged.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8578 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-11 21:49:05 +00:00
Manolo Gouy
87b998ed1f Fixed crash on Mac OS when Fl::focus() called before show().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8577 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-11 20:10:02 +00:00
Manolo Gouy
8d084cb4bc Added missing fl_lock_function() / fl_unlock_function() pairs of calls.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8576 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-11 19:52:41 +00:00
Ian MacArthur
4710a67670 Remove use of the MS API call MultiByteToWideChar(...) and re-instate use of fl_utf8toUtf16(...) now that I have fixed a slight off-by-one in handling the ends of the input strings.
This makes string handling much more consistent across variants.
Doh!. I am such an idiot...

NOTE: This still does not fix aberrant handling of surrogate pairs under WinXP, and I still haven't resolved the issues with the win32 ::width() functions not handling surrogate pairs at all...




git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8575 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-11 13:13:08 +00:00
Manolo Gouy
3d9eeb2d44 r. 8537 had by error introduced a compilation error with ppc architecture.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8573 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-10 09:10:40 +00:00
Manolo Gouy
7ce87f5102 Mac OS: fl_rect(), fl_rectf(), and fl_point() now have exact same output to display and printer.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8572 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-10 09:01:13 +00:00
Manolo Gouy
0937913a7c Added missing test of necessity of fl_open_display() call.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8571 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-08 16:14:05 +00:00
Ian MacArthur
016219f4a2 Replace a few instances of fl_utf8toUtf16() with the near-equivalent MS API call MultiByteToWideChar() as this seems to fix the regression I introduced in the rendering of rotated text on WinXP.
However... It does not cause the "high" Unicode code points to render correctly on XP, even though they do work on Vista (and I assume later variants like Win7...)
So there's still something I am missing here. Maybe XP is just broken? That'll be a problem...



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8570 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-07 09:28:45 +00:00
Manolo Gouy
fc3ef2b0ea Modified Fl_Quartz_Graphics_Driver::width(unsigned int wc) so it handles properly
cases with wc > 0xFFFF.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8569 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-07 07:51:26 +00:00
Ian MacArthur
8a830853bc Further work to fix win32 handling of surrogate pairs for "high" Unicode points... Now fixed handling of rotated text version of win32 draw method.
Fixes to the various ::width() methods for win32 and OSX still TBD.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8568 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-06 21:37:13 +00:00
Ian MacArthur
f7e251e69b Initial work to fix handling of surrogate pairs on win32 - draw() was not handling any Unicode char above U+FFFF as we did not handle the case where more than one UTF16 cell was required to hold the full glyph.
This change works, but is incomplete, other sections of the win32 code (and possibly OSX code) are making the same invalid assumptions about UTF16 chars.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8567 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-06 21:02:35 +00:00
Greg Ercolano
f76a1522e8 Fixed problem with void function trying to return a value.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8566 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-06 18:32:45 +00:00
Manolo Gouy
0c02f2dabd Added Fl_Printer::driver(void) function that can be useful.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8565 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-06 13:43:09 +00:00
Manolo Gouy
80d6099c45 Window title bars are now printed with their rounded angles.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8564 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-06 12:33:34 +00:00
Manolo Gouy
265f213d23 Added function Fl_Printer::set_current() that may be useful.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8563 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-06 12:11:26 +00:00
Manolo Gouy
b149f786d7 Mac OS: Fl_Window::resize() shd not modify the maximum window size if it is 0.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8562 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-05 17:16:35 +00:00
Manolo Gouy
7931fe1047 Removed an NSAutoreleasePool allocation/release.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8561 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-05 16:41:31 +00:00
Manolo Gouy
b197f40781 Mac OS: the "Print Front Window" item of the application menu now prints also the title bar.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8560 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-05 16:20:02 +00:00
Manolo Gouy
b5ab77d07d Removed usage of NSMainMenuWindowLevel to use only 3 window levels.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8559 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-05 12:41:32 +00:00
Manolo Gouy
cd2b8ed399 Fix error that can happen with some 3rd party fonts lacking certain size information.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8558 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-04 12:28:20 +00:00
Manolo Gouy
a86df5ede6 Mac OS: removed duplicate FL_KEYBOARDS events with function and modifier keys.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8557 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-03 17:31:07 +00:00
Manolo Gouy
32df4755c4 about STR #2599: - fix the synchro between key presses and key events
- implement character palette input by FL_PASTE events

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8555 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-01 17:19:34 +00:00
Albrecht Schlosser
cc3606b097 Updated dependencies.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8554 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-01 13:43:07 +00:00
Albrecht Schlosser
75294d3e24 Fixed dependencies of bundled libs, corrected a typo.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8553 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-01 13:40:41 +00:00
Manolo Gouy
8cd8a67b04 Fix STR #2598 with OP patch.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8552 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-01 09:00:07 +00:00
Manolo Gouy
f4c12d46d6 Mac OS: fixes in STR #2588 the warning message "_createMenuRef called with existing
principal MenuRef already associated with menu".

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8551 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-04-01 08:32:57 +00:00
Albrecht Schlosser
885c5fe16d Fixed documentation typo.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8550 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-31 16:06:59 +00:00
Manolo Gouy
bd36f0dd31 Mac OS: Make the Fl::event_key() function distinguish between left and right modifier keys.
Also, don't rebuild the application menu if one is already there.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8549 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-30 22:15:17 +00:00
Albrecht Schlosser
281489f849 Documentation updates and typos.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8548 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-30 12:07:52 +00:00
Manolo Gouy
45dba50515 Removed global variable appleMenu.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8547 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-30 08:53:07 +00:00
Manolo Gouy
03d531cd16 Fix STR #2588. FLTK was subclassing a very important system-defined class NSApplication.
This created conflict with other libraries that do the same. This STR reports that Tcl/Tk is one
such library. The fix removes any NSApplication subclass usage in FLTK, and requires
to initialize the NSApplication-subclassing library before calling fl_open_display(). In this 
condition an FLTK application can also use an NSApplication-subclassing library such as Tk.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8546 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-29 20:26:51 +00:00
Manolo Gouy
c64fa4863e Added info about where to find Mac OS virtual keycodes.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8545 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-29 14:22:48 +00:00
Manolo Gouy
5cda7e7232 Set svn properties.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8544 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-29 11:19:51 +00:00
Manolo Gouy
d4f284d73c Minor change.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8543 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-29 08:39:40 +00:00
Manolo Gouy
c4e554ff6b Mac OS: simplified the handling of text input:
use the FLTextView subclass of NSTextView only for Mac OS < 10.5 because it's not
necessary for Mac OS >= 10.5

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8542 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-28 21:52:56 +00:00
Manolo Gouy
3fdbcbe82f Corrected typos.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8541 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-28 11:40:39 +00:00
Manolo Gouy
c6fb27e56d Mac OS: added field subwindow to Fl_X class that is true if this is a subwindow.
Useful when deleting a window because subwindows share their xid with their parent
window (unlike under MSWIn or Xlib), so subwindows should not delete their xid.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8540 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-28 09:28:05 +00:00
Matthias Melcher
23f78899bb Added Xcode 4 IDE support.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8539 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-27 15:18:54 +00:00
Albrecht Schlosser
409d4976c2 Enhanced documentation of Fl::event_inside() to mention the restrictions
WRT subwindows and when using the window itself as the widget argument.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8538 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-27 00:34:55 +00:00
Manolo Gouy
8d7c246676 Mac OS: added gl_texture_reset() function to be called when deleting an Fl_Gl_Window
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8537 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-26 21:56:24 +00:00
Manolo Gouy
a58a2ed9fb Mac OS: Fixed bug where gl_draw() would fail after deletion of an Fl_GL_Window.
The fix invalidates the pile of string textures after each Fl_Gl_Window deletion.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8536 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-26 14:37:28 +00:00
Manolo Gouy
3b7ff83e04 Fix STR #2595. Mac OS. When deleting a subwindow, don't delete the Cocoa window
(xid) attached to it because it is in fact the Cocoa window of its parent window.
I check that by making sure that none of the windows in the window list uses
this Cocoa window. Is there a better algorithm ?

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8534 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2011-03-25 23:17:16 +00:00