========================================================================== */
-/*
- Handle arrow/function/control keys and copy/paste/cut in file dialogs.
- Return YES if handled, NO if not.
- */
-static BOOL
-handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent)
-{
- NSString *s;
- int i;
- BOOL ret = NO;
-
- if ([theEvent type] != NSEventTypeKeyDown) return NO;
- s = [theEvent characters];
-
- for (i = 0; i < [s length]; ++i)
- {
- int ch = (int) [s characterAtIndex: i];
- switch (ch)
- {
- case NSHomeFunctionKey:
- case NSDownArrowFunctionKey:
- case NSUpArrowFunctionKey:
- case NSLeftArrowFunctionKey:
- case NSRightArrowFunctionKey:
- case NSPageUpFunctionKey:
- case NSPageDownFunctionKey:
- case NSEndFunctionKey:
- /* Don't send command modified keys, as those are handled in the
- performKeyEquivalent method of the super class. */
- if (! ([theEvent modifierFlags] & NSEventModifierFlagCommand))
- {
- [panel sendEvent: theEvent];
- ret = YES;
- }
- break;
- /* As we don't have the standard key commands for
- copy/paste/cut/select-all in our edit menu, we must handle
- them here. TODO: handle Emacs key bindings for copy/cut/select-all
- here, paste works, because we have that in our Edit menu.
- I.e. refactor out code in nsterm.m, keyDown: to figure out the
- correct modifier. */
- case 'x': // Cut
- case 'c': // Copy
- case 'v': // Paste
- case 'a': // Select all
- if ([theEvent modifierFlags] & NSEventModifierFlagCommand)
- {
- [NSApp sendAction:
- (ch == 'x'
- ? @selector(cut:)
- : (ch == 'c'
- ? @selector(copy:)
- : (ch == 'v'
- ? @selector(paste:)
- : @selector(selectAll:))))
- to:nil from:panel];
- ret = YES;
- }
- default:
- // Send all control keys, as the text field supports C-a, C-f, C-e
- // C-b and more.
- if ([theEvent modifierFlags] & NSEventModifierFlagControl)
- {
- [panel sendEvent: theEvent];
- ret = YES;
- }
- break;
- }
- }
-
-
- return ret;
-}
-
@implementation EmacsFileDelegate
/* --------------------------------------------------------------------------
Delegate methods for Open/Save panels
}
-static void
-ns_clip_to_row (struct window *w, struct glyph_row *row,
- enum glyph_row_area area, BOOL gc)
-/* --------------------------------------------------------------------------
- Internal (but parallels other terms): Focus drawing on given row
- -------------------------------------------------------------------------- */
-{
- struct frame *f = XFRAME (WINDOW_FRAME (w));
- NSRect clip_rect = ns_row_rect (w, row, area);
-
- ns_focus (f, &clip_rect, 1);
-}
-
-
/* ==========================================================================
Visible bell and beep.
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f);
- NSWindow *window = [view window];
+ EmacsWindow *window = (EmacsWindow *)[view window];
NSTRACE ("ns_set_appearance");
id view;
NSPoint view_position;
Lisp_Object frame, tail;
- struct frame *f;
+ struct frame *f = NULL;
struct ns_display_info *dpyinfo;
NSTRACE ("ns_mouse_position");
{
NSRect r[2];
NSRect glyphRect;
- int n, i;
+ int n;
struct face *face;
NSColor *fgCol, *bgCol;
}
/* FIXME: Report any errors writing the color file below. */
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101100
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101100
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101100
if ([cl respondsToSelector:@selector(writeToURL:error:)])
#endif
{
NSRect r, wr;
Lisp_Object tem;
- NSWindow *win;
+ EmacsWindow *win;
NSColor *col;
NSString *name;
- (void)setAppearance
{
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
struct frame *f = ((EmacsView *)[self delegate])->emacsframe;
NSAppearance *appearance = nil;