diff options
| author | Stefan Monnier | 2008-07-17 03:33:59 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-07-17 03:33:59 +0000 |
| commit | facfbbbdad272decb23553d827fbc2c0fabaf078 (patch) | |
| tree | 14d37d409d30bdec0cbfc0ed79593021e1e88ab2 /src/nsmenu.m | |
| parent | d377ef4a3f6c77c451b647305436d1e8bf914b07 (diff) | |
| download | emacs-facfbbbdad272decb23553d827fbc2c0fabaf078.tar.gz emacs-facfbbbdad272decb23553d827fbc2c0fabaf078.zip | |
* Makefile.in: Undef LIB_STANDARD before defining it to silence warning
in case it was defined already.
USE @GNUSTEP_MAKEFILES@ rather than envvars.
* nsterm.m (ns_term_init): Pass Qt and Qnil rather than YES/NO to
ns_default.
(applicationShouldTerminate, setValuesFromPanel): Use EQ to compare
Lisp_Objects.
* nsterm.h (Fx_display_grayscale_p, Fx_display_planes)
(ns_defined_color, ns_color_to_lisp): Declare.
* nsselect.m (ns_handle_selection_request, ns_handle_selection_clear)
(Fns_own_selection_internal): Make the big ugly hack more explicit, so
it's accepted even with USE_LISP_UNION_TYPE.
* nsmenu.m (ns_update_menubar): Use EQ to compare Lisp_Objects.
(update_frame_tool_bar): Remove apparently obsolete tests for
non-integerness of f->tool_bar_lines.
(windowShouldClose, addButton, clicked, runDialogAt): Make the big ugly
hack more explicit, so it's accepted even with USE_LISP_UNION_TYPE.
* nsfont.m (nsfont_driver): Use just 0 rather than an invalid cast.
(nsfont_open): Don't confuse NULL for Qnil.
* nsfns.m (ns_implicitly_set_icon_type): Use EQ to compare Lisp_Objects.
* menu.h (find_and_call_menu_selection):
* menu.c (find_and_call_menu_selection): Use just int for vector size.
(find_and_return_menu_selection): Always return something.
* frame.h: Include dispextern.h for Display_Info.
(display_x_get_resource): Declare.
* configure.in: Extract and substitute GNUSTEP_MAKEFILES.
Diffstat (limited to 'src/nsmenu.m')
| -rw-r--r-- | src/nsmenu.m | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/src/nsmenu.m b/src/nsmenu.m index e48a82b7d2d..7fbc1b10c0a 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -401,9 +401,9 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 401 | { | 401 | { |
| 402 | for (i = 0; i<n; i++) | 402 | for (i = 0; i<n; i++) |
| 403 | { | 403 | { |
| 404 | string = XVECTOR (items)->contents[4*i+1]; | 404 | string = AREF (items, 4*i+1); |
| 405 | 405 | ||
| 406 | if (!string) | 406 | if (EQ (string, make_number (0))) // FIXME: Why??? --Stef |
| 407 | continue; | 407 | continue; |
| 408 | if (NILP (string)) | 408 | if (NILP (string)) |
| 409 | if (previous_strings[i][0]) | 409 | if (previous_strings[i][0]) |
| @@ -691,10 +691,10 @@ name_is_separator (name) | |||
| 691 | - (EmacsMenu *)addSubmenuWithTitle: (char *)title forFrame: (struct frame *)f | 691 | - (EmacsMenu *)addSubmenuWithTitle: (char *)title forFrame: (struct frame *)f |
| 692 | { | 692 | { |
| 693 | NSString *titleStr = [NSString stringWithUTF8String: title]; | 693 | NSString *titleStr = [NSString stringWithUTF8String: title]; |
| 694 | id <NSMenuItem> item = | 694 | id <NSMenuItem> item |
| 695 | [self addItemWithTitle: titleStr | 695 | = [self addItemWithTitle: titleStr |
| 696 | action: nil /*@selector (menuDown:) */ | 696 | action: nil /*@selector (menuDown:) */ |
| 697 | keyEquivalent: @""]; | 697 | keyEquivalent: @""]; |
| 698 | EmacsMenu *submenu = [[EmacsMenu alloc] initWithTitle: titleStr frame: f]; | 698 | EmacsMenu *submenu = [[EmacsMenu alloc] initWithTitle: titleStr frame: f]; |
| 699 | [self setSubmenu: submenu forItem: item]; | 699 | [self setSubmenu: submenu forItem: item]; |
| 700 | [submenu release]; | 700 | [submenu release]; |
| @@ -724,8 +724,9 @@ name_is_separator (name) | |||
| 724 | [NSMenu popUpContextMenu: self withEvent: event forView: view]; | 724 | [NSMenu popUpContextMenu: self withEvent: event forView: view]; |
| 725 | retVal = context_menu_value; | 725 | retVal = context_menu_value; |
| 726 | context_menu_value = 0; | 726 | context_menu_value = 0; |
| 727 | return retVal > 0 ? | 727 | return retVal > 0 |
| 728 | find_and_return_menu_selection (f, keymaps, (void *)retVal) : Qnil; | 728 | ? find_and_return_menu_selection (f, keymaps, (void *)retVal) |
| 729 | : Qnil; | ||
| 729 | } | 730 | } |
| 730 | 731 | ||
| 731 | @end /* EmacsMenu */ | 732 | @end /* EmacsMenu */ |
| @@ -1061,8 +1062,8 @@ ns_popup_menu (Lisp_Object position, Lisp_Object menu) | |||
| 1061 | /* If this item has a null value, | 1062 | /* If this item has a null value, |
| 1062 | make the call_data null so that it won't display a box | 1063 | make the call_data null so that it won't display a box |
| 1063 | when the mouse is on it. */ | 1064 | when the mouse is on it. */ |
| 1064 | wv->call_data = | 1065 | wv->call_data |
| 1065 | !NILP (def) ? (void *) &XVECTOR (menu_items)->contents[i] : 0; | 1066 | = !NILP (def) ? (void *) &XVECTOR (menu_items)->contents[i] : 0; |
| 1066 | wv->enabled = !NILP (enable); | 1067 | wv->enabled = !NILP (enable); |
| 1067 | 1068 | ||
| 1068 | if (NILP (type)) | 1069 | if (NILP (type)) |
| @@ -1157,9 +1158,6 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1157 | int i; | 1158 | int i; |
| 1158 | EmacsToolbar *toolbar = [FRAME_NS_VIEW (f) toolbar]; | 1159 | EmacsToolbar *toolbar = [FRAME_NS_VIEW (f) toolbar]; |
| 1159 | 1160 | ||
| 1160 | if (NILP (f->tool_bar_lines) || !INTEGERP (f->tool_bar_lines)) | ||
| 1161 | return; | ||
| 1162 | |||
| 1163 | [toolbar clearActive]; | 1161 | [toolbar clearActive]; |
| 1164 | 1162 | ||
| 1165 | /* update EmacsToolbar as in GtkUtils, build items list */ | 1163 | /* update EmacsToolbar as in GtkUtils, build items list */ |
| @@ -1294,8 +1292,8 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1294 | helpText: (char *)help enabled: (BOOL)enabled | 1292 | helpText: (char *)help enabled: (BOOL)enabled |
| 1295 | { | 1293 | { |
| 1296 | /* 1) come up w/identifier */ | 1294 | /* 1) come up w/identifier */ |
| 1297 | NSString *identifier = | 1295 | NSString *identifier |
| 1298 | [NSString stringWithFormat: @"%u", [img hash]]; | 1296 | = [NSString stringWithFormat: @"%u", [img hash]]; |
| 1299 | 1297 | ||
| 1300 | /* 2) create / reuse item */ | 1298 | /* 2) create / reuse item */ |
| 1301 | NSToolbarItem *item = [identifierToItem objectForKey: identifier]; | 1299 | NSToolbarItem *item = [identifierToItem objectForKey: identifier]; |
| @@ -1557,7 +1555,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1557 | NSSize spacing = {SPACER, SPACER}; | 1555 | NSSize spacing = {SPACER, SPACER}; |
| 1558 | NSRect area; | 1556 | NSRect area; |
| 1559 | char this_cmd_name[80]; | 1557 | char this_cmd_name[80]; |
| 1560 | id cell, tem; | 1558 | id cell; |
| 1561 | static NSImageView *imgView; | 1559 | static NSImageView *imgView; |
| 1562 | static FlippedView *contentView; | 1560 | static FlippedView *contentView; |
| 1563 | 1561 | ||
| @@ -1649,7 +1647,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1649 | 1647 | ||
| 1650 | - (BOOL)windowShouldClose: (id)sender | 1648 | - (BOOL)windowShouldClose: (id)sender |
| 1651 | { | 1649 | { |
| 1652 | [NSApp stopModalWithCode: Qnil]; | 1650 | [NSApp stopModalWithCode: XHASH (Qnil)]; // FIXME: BIG UGLY HACK!! |
| 1653 | return NO; | 1651 | return NO; |
| 1654 | } | 1652 | } |
| 1655 | 1653 | ||
| @@ -1693,7 +1691,7 @@ void process_dialog (id window, Lisp_Object list) | |||
| 1693 | [cell setTarget: self]; | 1691 | [cell setTarget: self]; |
| 1694 | [cell setAction: @selector (clicked: )]; | 1692 | [cell setAction: @selector (clicked: )]; |
| 1695 | [cell setTitle: [NSString stringWithUTF8String: str]]; | 1693 | [cell setTitle: [NSString stringWithUTF8String: str]]; |
| 1696 | [cell setTag: (int)val]; | 1694 | [cell setTag: XHASH (val)]; // FIXME: BIG UGLY HACK!! |
| 1697 | [cell setBordered: YES]; | 1695 | [cell setBordered: YES]; |
| 1698 | [cell setEnabled: YES]; | 1696 | [cell setEnabled: YES]; |
| 1699 | 1697 | ||
| @@ -1730,14 +1728,14 @@ void process_dialog (id window, Lisp_Object list) | |||
| 1730 | - clicked: sender | 1728 | - clicked: sender |
| 1731 | { | 1729 | { |
| 1732 | NSArray *sellist = nil; | 1730 | NSArray *sellist = nil; |
| 1733 | Lisp_Object seltag; | 1731 | EMACS_INT seltag; |
| 1734 | 1732 | ||
| 1735 | sellist = [sender selectedCells]; | 1733 | sellist = [sender selectedCells]; |
| 1736 | if ([sellist count]<1) | 1734 | if ([sellist count]<1) |
| 1737 | return self; | 1735 | return self; |
| 1738 | 1736 | ||
| 1739 | seltag = (Lisp_Object)[[sellist objectAtIndex: 0] tag]; | 1737 | seltag = [[sellist objectAtIndex: 0] tag]; |
| 1740 | if (! EQ (seltag, Qundefined)) | 1738 | if (seltag == XHASH (Qundefined)) // FIXME: BIG UGLY HACK!! |
| 1741 | [NSApp stopModalWithCode: seltag]; | 1739 | [NSApp stopModalWithCode: seltag]; |
| 1742 | return self; | 1740 | return self; |
| 1743 | } | 1741 | } |
| @@ -1844,7 +1842,11 @@ void process_dialog (id window, Lisp_Object list) | |||
| 1844 | } | 1842 | } |
| 1845 | [NSApp endModalSession: session]; | 1843 | [NSApp endModalSession: session]; |
| 1846 | 1844 | ||
| 1847 | return (Lisp_Object)ret; | 1845 | { // FIXME: BIG UGLY HACK!!! |
| 1846 | Lisp_Object tmp; | ||
| 1847 | *(EMACS_INT*)(&tmp) = ret; | ||
| 1848 | return tmp; | ||
| 1849 | } | ||
| 1848 | } | 1850 | } |
| 1849 | 1851 | ||
| 1850 | @end | 1852 | @end |