Author: manolo
Date: 2010-11-25 10:21:21 -0800 (Thu, 25 Nov 2010)
New Revision: 7892
Log:
Mac OS X: introduced global variable fl_mac_os_version and cleaned a few unused
variables.
Modified:
branches/branch-1.3/FL/mac.H
branches/branch-1.3/documentation/src/osissues.dox
branches/branch-1.3/src/Fl_cocoa.mm
branches/branch-1.3/src/fl_dnd_mac.cxx
branches/branch-1.3/src/fl_font_mac.cxx
branches/branch-1.3/src/fl_set_fonts_mac.cxx
Modified: branches/branch-1.3/FL/mac.H
===================================================================
--- branches/branch-1.3/FL/mac.H 2010-11-24 13:31:43 UTC (rev 7891)
+++ branches/branch-1.3/FL/mac.H 2010-11-25 18:21:21 UTC (rev 7892)
@@ -185,6 +185,11 @@
* \param shortcut optional shortcut to attach to the "About myprog" menu
item (e.g., FL_META+'a')
*/
extern void fl_mac_set_about( Fl_Callback *cb, void *user_data, int shortcut =
0);
+
+/** The version number of the running Mac OS X (e.g., 0x1064 for 10.6.4)
+ */
+extern int fl_mac_os_version;
+
/** @} */
//
Modified: branches/branch-1.3/documentation/src/osissues.dox
===================================================================
--- branches/branch-1.3/documentation/src/osissues.dox 2010-11-24 13:31:43 UTC
(rev 7891)
+++ branches/branch-1.3/documentation/src/osissues.dox 2010-11-25 18:21:21 UTC
(rev 7892)
@@ -687,7 +687,7 @@
or \c NULL if not found. FLTK windows that are children of top-level
windows share the \c Window of the top-level window.
-void fl_open_callback(void (*cb)(const char *))
+void \ref fl_open_callback(void (*cb)(const char *))
\par
\c cb will be called with a single Unix-style file name and path.
@@ -749,9 +749,11 @@
\par Mac File Paths
-FLTK uses UNIX-style filenames and paths.
+FLTK uses UTF-8-encoded UNIX-style filenames and paths.
+\sa group_macosx
+
\htmlonly
<hr>
<table summary="navigation bar" width="100%" border="0">
Modified: branches/branch-1.3/src/Fl_cocoa.mm
===================================================================
--- branches/branch-1.3/src/Fl_cocoa.mm 2010-11-24 13:31:43 UTC (rev 7891)
+++ branches/branch-1.3/src/Fl_cocoa.mm 2010-11-25 18:21:21 UTC (rev 7892)
@@ -130,19 +130,16 @@
Fl_Sys_Menu_Bar *fl_sys_menu_bar = 0;
void *fl_default_cursor; // this is really a NSCursor*
void *fl_capture = 0; // (NSWindow*) we need this to
compensate for a missing(?) mouse capture
-//ulong fl_event_time; // the last timestamp from an x event
char fl_key_vector[32]; // used by Fl::get_key()
bool fl_show_iconic; // true if called from iconize() -
shows the next created window in collapsed state
int fl_disable_transient_for; // secret method of removing
TRANSIENT_FOR
-//const Fl_Window* fl_modal_for; // parent of modal() window
Window fl_window;
Fl_Window *Fl_Window::current_;
-//EventRef fl_os_event; // last (mouse) event
+int fl_mac_os_version = 0; // the version number of the running
Mac OS X (e.g., 0x1064 for 10.6.4)
// forward declarations of variables in this file
static int got_events = 0;
static Fl_Window* resize_from_system;
-static SInt32 MACsystemVersion;
#if CONSOLIDATE_MOTION
static Fl_Window* send_motion;
@@ -1371,8 +1368,10 @@
while (ign_event);
fl_default_cursor = [NSCursor arrowCursor];
- Gestalt(gestaltSystemVersion, &MACsystemVersion);
-
+ SInt32 version;
+ Gestalt(gestaltSystemVersion, &version);
+ fl_mac_os_version = (int)version;
+
// bring the application into foreground without a 'CARB' resource
Boolean same_psn;
ProcessSerialNumber cur_psn, front_psn;
@@ -2757,7 +2756,7 @@
{
NSDictionary *options;
options = [NSDictionary dictionaryWithObjectsAndKeys:
- [NSString stringWithFormat:@" FLTK %d.%d Cocoa",
FL_MAJOR_VERSION,
+ [NSString stringWithFormat:@" GUI with FLTK
%d.%d", FL_MAJOR_VERSION,
FL_MINOR_VERSION ], @"Copyright",
nil];
[NSApp orderFrontStandardAboutPanelWithOptions:options];
@@ -2815,13 +2814,12 @@
FLaboutItemTarget *about = [[FLaboutItemTarget alloc] init];
[menuItem setTarget:about];
[appleMenu addItem:[NSMenuItem separatorItem]];
-// temporary for testing Fl_Printer. Contains also printPanel of class
FLaboutItemTarget.
+ // Print front window
menuItem = [appleMenu addItemWithTitle:@"Print front window"
action:@selector(printPanel) keyEquivalent:@""];
[menuItem setTarget:about];
[appleMenu setAutoenablesItems:NO];
[menuItem setEnabled:YES];
[appleMenu addItem:[NSMenuItem separatorItem]];
-// end of temporary for testing Fl_Printer
// Services Menu
services = [[NSMenu alloc] init];
[appleMenu addItemWithTitle:@"Services" action:nil keyEquivalent:@""];
@@ -2844,7 +2842,7 @@
[menuItem setSubmenu:appleMenu];
mainmenu = [[NSMenu alloc] initWithTitle:@""];
[mainmenu addItem:menuItem];
- if (MACsystemVersion < 0x1060) {
+ if (fl_mac_os_version < 0x1060) {
// [NSApp setAppleMenu:appleMenu];
// to avoid compiler warning raised by use of undocumented setAppleMenu
:
[NSApp performSelector:@selector(setAppleMenu:) withObject:appleMenu];
@@ -3208,7 +3206,7 @@
win = win->window();
}
CGFloat epsilon = 0;
- if (MACsystemVersion >= 0x1060) epsilon = 0.001;
+ if (fl_mac_os_version >= 0x1060) epsilon = 0.001;
// The epsilon offset is absolutely necessary under 10.6. Without it, the
top pixel row and
// left pixel column are not read, and bitmap is read shifted by one pixel
in both directions.
// Under 10.5, we want no offset.
Modified: branches/branch-1.3/src/fl_dnd_mac.cxx
===================================================================
--- branches/branch-1.3/src/fl_dnd_mac.cxx 2010-11-24 13:31:43 UTC (rev
7891)
+++ branches/branch-1.3/src/fl_dnd_mac.cxx 2010-11-25 18:21:21 UTC (rev
7892)
@@ -33,10 +33,6 @@
#include <FL/x.H>
#include <FL/Fl_Window.H>
-// warning: this function is only implemented in Quickdraw. The function
-// below may not work if FLTK is compiled with Quartz enabled
-
-extern EventRef fl_os_event;
extern char *fl_selection_buffer;
extern int fl_selection_length;
Modified: branches/branch-1.3/src/fl_font_mac.cxx
===================================================================
--- branches/branch-1.3/src/fl_font_mac.cxx 2010-11-24 13:31:43 UTC (rev
7891)
+++ branches/branch-1.3/src/fl_font_mac.cxx 2010-11-25 18:21:21 UTC (rev
7892)
@@ -34,9 +34,6 @@
#define check_default_font() {if (!fl_fontsize) fl_font(0, 12);}
static const CGAffineTransform font_mx = { 1, 0, 0, -1, 0, 0 };
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-static SInt32 MACsystemVersion = 0;
-#endif
Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize Size) {
next = 0;
@@ -50,9 +47,8 @@
size = Size;
minsize = maxsize = Size;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- if(MACsystemVersion == 0) Gestalt(gestaltSystemVersion, &MACsystemVersion);
-
-if(MACsystemVersion >= 0x1050) {//unfortunately, CTFontCreateWithName != NULL
on 10.4 also!
+if(fl_mac_os_version == 0) fl_open_display();
+if(fl_mac_os_version >= 0x1050) {//unfortunately, CTFontCreateWithName != NULL
on 10.4 also!
CFStringRef str = CFStringCreateWithCString(NULL, name,
kCFStringEncodingUTF8);
fontref = CTFontCreateWithName(str, size, NULL);
CGGlyph glyph[2];
@@ -170,7 +166,7 @@
*/
if (this == fl_fontsize) fl_fontsize = 0;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- if(MACsystemVersion >= 0x1050) CFRelease(fontref);
+ if(fl_mac_os_version >= 0x1050) CFRelease(fontref);
#else
/* ATSUDisposeTextLayout(layout);
ATSUDisposeStyle(style); */
@@ -273,7 +269,7 @@
return 8*n; // user must select a font first!
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-if(MACsystemVersion >= 0x1050) {
+if(fl_mac_os_version >= 0x1050) {
CTFontRef fontref = fl_fontsize->fontref;
CFStringRef str = CFStringCreateWithBytes(NULL, (const UInt8*)txt, n *
sizeof(UniChar), kCFStringEncodingUTF16, false);
CFAttributedStringRef astr = CFAttributedStringCreate(NULL, str, NULL);
@@ -342,7 +338,7 @@
return;
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-if(MACsystemVersion >= 0x1050) {
+if(fl_mac_os_version >= 0x1050) {
CTFontRef fontref = fl_fontsize->fontref;
CFStringRef str16 = CFStringCreateWithBytes(NULL, (const UInt8*)txt, n
*sizeof(UniChar), kCFStringEncodingUTF16, false);
CFAttributedStringRef astr = CFAttributedStringCreate(NULL, str16, NULL);
@@ -435,7 +431,7 @@
// convert to UTF-16 first
UniChar *uniStr = mac_Utf8_to_Utf16(str, n, &n);
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- if(MACsystemVersion >= 0x1050) {
+ if(fl_mac_os_version >= 0x1050) {
CFStringRef keys[2];
CFTypeRef values[2];
CFStringRef str16 = CFStringCreateWithBytes(NULL, (const UInt8*)uniStr, n
* sizeof(UniChar), kCFStringEncodingUTF16, false);
Modified: branches/branch-1.3/src/fl_set_fonts_mac.cxx
===================================================================
--- branches/branch-1.3/src/fl_set_fonts_mac.cxx 2010-11-24 13:31:43 UTC
(rev 7891)
+++ branches/branch-1.3/src/fl_set_fonts_mac.cxx 2010-11-25 18:21:21 UTC
(rev 7892)
@@ -63,9 +63,8 @@
if (fl_free_font > FL_FREE_FONT) return (Fl_Font)fl_free_font; // if already
called
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-static SInt32 MACsystemVersion = 0;
-if(MACsystemVersion == 0) Gestalt(gestaltSystemVersion, &MACsystemVersion);
-if(MACsystemVersion >= 0x1050) {
+ if(fl_mac_os_version == 0) fl_open_display();
+if(fl_mac_os_version >= 0x1050) {
//if(CTFontCreateWithFontDescriptor != NULL) {//
CTFontCreateWithFontDescriptor != NULL on 10.4 also!
int value[1] = {1};
CFDictionaryRef dict = CFDictionaryCreate(NULL,
@@ -131,7 +130,7 @@
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
}
#endif
- return 0; // FIXME: I do not understand the shuffeling of the above ifdef's
and why they are here!
+ return 0;
}
static int array[128];
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit