DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR Pending]

Link: http://www.fltk.org/str.php?L2221
Version: 1.3-feature
Fix Version: 1.3.0 (r6951)


Correct, this & character is displayed. I attach an svn diff Fl_cocoa.mm
that repairs that. I want to stress that, as written in the file,
Fl_Sys_Menu_Bar.cxx is not a complete implementation of the Fl_Menu
class. Some of the things that do work are shortcuts and FL_MENU_TOGGLE.

Last login: Tue Dec  8 15:30:07 on ttys000
[biomp2:~] mgouy% cd /Users/mgouy/Documents/fltk/COCOA/branch-1.3/src 
[biomp2:COCOA/branch-1.3/src] mgouy% svn diff Fl_cocoa.mm
Index: Fl_cocoa.mm
===================================================================
--- Fl_cocoa.mm (revision 6958)
+++ Fl_cocoa.mm (working copy)
@@ -61,19 +61,17 @@
 #include <stdarg.h>
 
 #import <Cocoa/Cocoa.h>
-#include <AvailabilityMacros.h>
+
+#ifndef NSINTEGER_DEFINED //appears with 10.5 in NSObjCRuntime.h
 #if defined(__LP64__) && __LP64__
-typedef double CGFloat;
-#else
-typedef float CGFloat;
-#endif
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
 typedef long NSInteger;
 typedef unsigned long NSUInteger;
+#else
+typedef int NSInteger;
+typedef unsigned int NSUInteger;
 #endif
+#endif
 
-
 // #define DEBUG_SELECT                // UNCOMMENT FOR SELECT()/THREAD 
DEBUGGING
 #ifdef DEBUG_SELECT
 #include <stdio.h>             // testing
@@ -1255,7 +1253,11 @@
                                             UInt32 _arg3, UInt32 _arg4,
UInt32 _arg5);
 }
 
-...@interface FLDelegate : NSObject {
+...@interface FLDelegate : NSObject 
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+<NSWindowDelegate, NSApplicationDelegate>
+#endif
+{
 }
 - (void)windowDidMove:(NSNotification *)notif;
 - (void)windowDidResize:(NSNotification *)notif;
@@ -2746,6 +2748,22 @@
   return num_screens;
 }
 
+...@interface FLaboutItemTarget : NSObject 
+{
+}
+- (void)showPanel;
+...@end
+...@implementation FLaboutItemTarget
+- (void)showPanel
+{
+  NSDictionary *options;
+  options = [NSDictionary dictionaryWithObjectsAndKeys:
+            [NSString stringWithFormat:@" FLTK %d.%d Cocoa", FL_MAJOR_VERSION,
FL_MINOR_VERSION ], @"Copyright",
+            nil];
+  [NSApp  orderFrontStandardAboutPanelWithOptions:options];
+}
+...@end
+
 static NSMenu *appleMenu;
 static void createAppleMenu(void)
 {
@@ -2763,7 +2781,9 @@
   appleMenu = [[NSMenu alloc] initWithTitle:@""];
   /* Add menu items */
   title = [@"About " stringByAppendingString:(NSString*)nsappname];
-  [appleMenu addItemWithTitle:title
action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
+  [appleMenu addItemWithTitle:title action:@selector(showPanel)
keyEquivalent:@""];
+  FLaboutItemTarget *about = [[FLaboutItemTarget alloc] init];
+  [[appleMenu itemAtIndex:0] setTarget:about];
   [appleMenu addItem:[NSMenuItem separatorItem]];
   // Services Menu
   services = [[[NSMenu alloc] init] autorelease];
@@ -2818,7 +2838,7 @@
 }
 - (void) doCallback:(id)obj
 {
-  cb((Fl_Widget*)obj, data);
+  if(cb) cb((Fl_Widget*)obj, data);
 }
 - (void*)getItemData
 {
@@ -2960,10 +2980,21 @@
     //upon return, puts the rank of the new item in *prank unless prank
is NULL
     menu = va_arg(ap, NSMenu*);
     const char *name = va_arg(ap, const char*);
+    char *name2 = strdup(name);
+    const char *p;
+    char *q;
+    p = name;
+    q = name2;
+    while(*p != 0) {
+      if(*p != '&') *q++ = *p;
+      p++;
+      }
+    *q = 0;
     Fl_Callback *cb = va_arg(ap, Fl_Callback*);
     pter = va_arg(ap, void *);
     int *prank = va_arg(ap, int*);
-    CFStringRef cfname = CFStringCreateWithCString(NULL, name,
kCFStringEncodingUTF8);
+    CFStringRef cfname = CFStringCreateWithCString(NULL, name2,
kCFStringEncodingUTF8);
+    free(name2);
     FLMenuItem *item = [FLMenuItem alloc];
     [item initWithTitle:(NSString*)cfname action:@selector(doCallback:)
keyEquivalent:@""];
     [item putData:cb pter:pter];


Link: http://www.fltk.org/str.php?L2221
Version: 1.3-feature
Fix Version: 1.3.0 (r6951)

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to