comparison src/nsfns.m @ 102509:85392f94785a

* nsfns.m (Fx_close_connection): Doc fix. (Fns_do_applescript): Reflow docstring. (Fns_hide_others, Fns_hide_emacs, Fns_convert_utf8_nfd_to_nfc) (Fx_display_pixel_width, Fx_display_pixel_height) (Fns_display_usable_bounds, Fx_display_planes, Fx_show_tip): Fix typos in docstrings. (Fns_set_alpha): Fix typos in error messages.
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 12 Mar 2009 14:14:35 +0000
parents bb6b744158ee
children 291f6c889881
comparison
equal deleted inserted replaced
102508:13b4ea6830b5 102509:85392f94785a
1414 [fm orderFrontFontPanel: NSApp]; 1414 [fm orderFrontFontPanel: NSApp];
1415 return Qnil; 1415 return Qnil;
1416 } 1416 }
1417 1417
1418 1418
1419 DEFUN ("ns-popup-color-panel", Fns_popup_color_panel, Sns_popup_color_panel, 1419 DEFUN ("ns-popup-color-panel", Fns_popup_color_panel, Sns_popup_color_panel,
1420 0, 1, "", 1420 0, 1, "",
1421 doc: /* Pop up the color panel. */) 1421 doc: /* Pop up the color panel. */)
1422 (frame) 1422 (frame)
1423 Lisp_Object frame; 1423 Lisp_Object frame;
1424 { 1424 {
1495 1495
1496 ret = (ret == NSOKButton) || panelOK; 1496 ret = (ret == NSOKButton) || panelOK;
1497 1497
1498 if (ret) 1498 if (ret)
1499 fname = build_string ([[panel filename] UTF8String]); 1499 fname = build_string ([[panel filename] UTF8String]);
1500 1500
1501 [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow]; 1501 [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow];
1502 UNBLOCK_INPUT; 1502 UNBLOCK_INPUT;
1503 1503
1504 return ret ? fname : Qnil; 1504 return ret ? fname : Qnil;
1505 } 1505 }
1575 1575
1576 CHECK_STRING (color); 1576 CHECK_STRING (color);
1577 CHECK_NUMBER_OR_FLOAT (alpha); 1577 CHECK_NUMBER_OR_FLOAT (alpha);
1578 1578
1579 if (ns_lisp_to_color (color, &col)) 1579 if (ns_lisp_to_color (color, &col))
1580 error ("Unknown color."); 1580 error ("Unknown color");
1581 1581
1582 a = XFLOATINT (alpha); 1582 a = XFLOATINT (alpha);
1583 if (a < 0.0 || a > 1.0) 1583 if (a < 0.0 || a > 1.0)
1584 error ("Alpha value should be between 0 and 1 inclusive."); 1584 error ("Alpha value should be between 0 and 1 inclusive");
1585 1585
1586 col = [col colorWithAlphaComponent: a]; 1586 col = [col colorWithAlphaComponent: a];
1587 return ns_color_to_lisp (col); 1587 return ns_color_to_lisp (col);
1588 } 1588 }
1589 1589
1807 1807
1808 1808
1809 DEFUN ("x-close-connection", Fx_close_connection, Sx_close_connection, 1809 DEFUN ("x-close-connection", Fx_close_connection, Sx_close_connection,
1810 1, 1, 0, 1810 1, 1, 0,
1811 doc: /* Close the connection to the current Nextstep display server. 1811 doc: /* Close the connection to the current Nextstep display server.
1812 The second argument DISPLAY is currently ignored. */) 1812 The argument DISPLAY is currently ignored. */)
1813 (display) 1813 (display)
1814 Lisp_Object display; 1814 Lisp_Object display;
1815 { 1815 {
1816 check_ns (); 1816 check_ns ();
1817 #ifdef NS_IMPL_COCOA 1817 #ifdef NS_IMPL_COCOA
1837 } 1837 }
1838 1838
1839 1839
1840 DEFUN ("ns-hide-others", Fns_hide_others, Sns_hide_others, 1840 DEFUN ("ns-hide-others", Fns_hide_others, Sns_hide_others,
1841 0, 0, 0, 1841 0, 0, 0,
1842 doc: /* Hides all applications other than emacs. */) 1842 doc: /* Hides all applications other than Emacs. */)
1843 () 1843 ()
1844 { 1844 {
1845 check_ns (); 1845 check_ns ();
1846 [NSApp hideOtherApplications: NSApp]; 1846 [NSApp hideOtherApplications: NSApp];
1847 return Qnil; 1847 return Qnil;
1848 } 1848 }
1849 1849
1850 DEFUN ("ns-hide-emacs", Fns_hide_emacs, Sns_hide_emacs, 1850 DEFUN ("ns-hide-emacs", Fns_hide_emacs, Sns_hide_emacs,
1851 1, 1, 0, 1851 1, 1, 0,
1852 doc: /* If ON is non-nil, the entire emacs application is hidden. 1852 doc: /* If ON is non-nil, the entire Emacs application is hidden.
1853 Otherwise if emacs is hidden, it is unhidden. 1853 Otherwise if Emacs is hidden, it is unhidden.
1854 If ON is equal to `activate', emacs is unhidden and becomes 1854 If ON is equal to `activate', Emacs is unhidden and becomes
1855 the active application. */) 1855 the active application. */)
1856 (on) 1856 (on)
1857 Lisp_Object on; 1857 Lisp_Object on;
1858 { 1858 {
1859 check_ns (); 1859 check_ns ();
2025 } 2025 }
2026 2026
2027 2027
2028 DEFUN ("ns-convert-utf8-nfd-to-nfc", Fns_convert_utf8_nfd_to_nfc, 2028 DEFUN ("ns-convert-utf8-nfd-to-nfc", Fns_convert_utf8_nfd_to_nfc,
2029 Sns_convert_utf8_nfd_to_nfc, 1, 1, 0, 2029 Sns_convert_utf8_nfd_to_nfc, 1, 1, 0,
2030 doc: /* Return an NFC string that matches the UTF-8 NFD string STR. */) 2030 doc: /* Return an NFC string that matches the UTF-8 NFD string STR. */)
2031 (str) 2031 (str)
2032 Lisp_Object str; 2032 Lisp_Object str;
2033 { 2033 {
2034 /* TODO: If GNUstep ever implements precomposedStringWithCanonicalMapping, 2034 /* TODO: If GNUstep ever implements precomposedStringWithCanonicalMapping,
2035 remove this. */ 2035 remove this. */
2069 [[NSAppleScript alloc] initWithSource: 2069 [[NSAppleScript alloc] initWithSource:
2070 [NSString stringWithUTF8String: SDATA (script)]]; 2070 [NSString stringWithUTF8String: SDATA (script)]];
2071 2071
2072 returnDescriptor = [scriptObject executeAndReturnError: &errorDict]; 2072 returnDescriptor = [scriptObject executeAndReturnError: &errorDict];
2073 [scriptObject release]; 2073 [scriptObject release];
2074 2074
2075 *result = Qnil; 2075 *result = Qnil;
2076 2076
2077 if (returnDescriptor != NULL) 2077 if (returnDescriptor != NULL)
2078 { 2078 {
2079 // successful execution 2079 // successful execution
2080 if (kAENullEvent != [returnDescriptor descriptorType]) 2080 if (kAENullEvent != [returnDescriptor descriptorType])
2081 { 2081 {
2082 *result = Qt; 2082 *result = Qt;
2083 // script returned an AppleScript result 2083 // script returned an AppleScript result
2084 if ((typeUnicodeText == [returnDescriptor descriptorType]) || 2084 if ((typeUnicodeText == [returnDescriptor descriptorType]) ||
2085 #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 2085 #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
2086 (typeUTF16ExternalRepresentation 2086 (typeUTF16ExternalRepresentation
2087 == [returnDescriptor descriptorType]) || 2087 == [returnDescriptor descriptorType]) ||
2088 #endif 2088 #endif
2089 (typeUTF8Text == [returnDescriptor descriptorType]) || 2089 (typeUTF8Text == [returnDescriptor descriptorType]) ||
2090 (typeCString == [returnDescriptor descriptorType])) 2090 (typeCString == [returnDescriptor descriptorType]))
2091 { 2091 {
2110 } 2110 }
2111 return 0; 2111 return 0;
2112 } 2112 }
2113 2113
2114 DEFUN ("ns-do-applescript", Fns_do_applescript, Sns_do_applescript, 1, 1, 0, 2114 DEFUN ("ns-do-applescript", Fns_do_applescript, Sns_do_applescript, 1, 1, 0,
2115 doc: /* Execute AppleScript SCRIPT and return the result. If 2115 doc: /* Execute AppleScript SCRIPT and return the result.
2116 compilation and execution are successful, the resulting script value 2116 If compilation and execution are successful, the resulting script value
2117 is returned as a string, a number or, in the case of other constructs, 2117 is returned as a string, a number or, in the case of other constructs, t.
2118 t. In case the execution fails, an error is signaled. */) 2118 In case the execution fails, an error is signaled. */)
2119 (script) 2119 (script)
2120 Lisp_Object script; 2120 Lisp_Object script;
2121 { 2121 {
2122 Lisp_Object result; 2122 Lisp_Object result;
2123 long status; 2123 long status;
2341 } 2341 }
2342 2342
2343 2343
2344 DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width, 2344 DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width,
2345 0, 1, 0, 2345 0, 1, 0,
2346 doc: /* Returns the width in pixels of the Nextstep display DISPLAY. 2346 doc: /* Return the width in pixels of the Nextstep display DISPLAY.
2347 The optional argument DISPLAY specifies which display to ask about. 2347 The optional argument DISPLAY specifies which display to ask about.
2348 DISPLAY should be either a frame, a display name (a string), or terminal ID. 2348 DISPLAY should be either a frame, a display name (a string), or terminal ID.
2349 If omitted or nil, that stands for the selected frame's display. */) 2349 If omitted or nil, that stands for the selected frame's display. */)
2350 (display) 2350 (display)
2351 Lisp_Object display; 2351 Lisp_Object display;
2355 } 2355 }
2356 2356
2357 2357
2358 DEFUN ("x-display-pixel-height", Fx_display_pixel_height, 2358 DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
2359 Sx_display_pixel_height, 0, 1, 0, 2359 Sx_display_pixel_height, 0, 1, 0,
2360 doc: /* Returns the height in pixels of the Nextstep display DISPLAY. 2360 doc: /* Return the height in pixels of the Nextstep display DISPLAY.
2361 The optional argument DISPLAY specifies which display to ask about. 2361 The optional argument DISPLAY specifies which display to ask about.
2362 DISPLAY should be either a frame, a display name (a string), or terminal ID. 2362 DISPLAY should be either a frame, a display name (a string), or terminal ID.
2363 If omitted or nil, that stands for the selected frame's display. */) 2363 If omitted or nil, that stands for the selected frame's display. */)
2364 (display) 2364 (display)
2365 Lisp_Object display; 2365 Lisp_Object display;
2369 } 2369 }
2370 2370
2371 2371
2372 DEFUN ("display-usable-bounds", Fns_display_usable_bounds, 2372 DEFUN ("display-usable-bounds", Fns_display_usable_bounds,
2373 Sns_display_usable_bounds, 0, 1, 0, 2373 Sns_display_usable_bounds, 0, 1, 0,
2374 doc: /*Return the bounds of the usable part of the screen. 2374 doc: /* Return the bounds of the usable part of the screen.
2375 The return value is a list of integers (LEFT TOP WIDTH HEIGHT), which 2375 The return value is a list of integers (LEFT TOP WIDTH HEIGHT), which
2376 are the boundaries of the usable part of the screen, excluding areas 2376 are the boundaries of the usable part of the screen, excluding areas
2377 reserved for the Mac menu, dock, and so forth. 2377 reserved for the Mac menu, dock, and so forth.
2378 2378
2379 The screen queried corresponds to DISPLAY, which should be either a 2379 The screen queried corresponds to DISPLAY, which should be either a
2397 } 2397 }
2398 2398
2399 2399
2400 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes, 2400 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
2401 0, 1, 0, 2401 0, 1, 0,
2402 doc: /* Returns the number of bitplanes of the Nextstep display DISPLAY. 2402 doc: /* Return the number of bitplanes of the Nextstep display DISPLAY.
2403 The optional argument DISPLAY specifies which display to ask about. 2403 The optional argument DISPLAY specifies which display to ask about.
2404 DISPLAY should be either a frame, a display name (a string), or terminal ID. 2404 DISPLAY should be either a frame, a display name (a string), or terminal ID.
2405 If omitted or nil, that stands for the selected frame's display. */) 2405 If omitted or nil, that stands for the selected frame's display. */)
2406 (display) 2406 (display)
2407 Lisp_Object display; 2407 Lisp_Object display;
2441 int *root_x, *root_y; 2441 int *root_x, *root_y;
2442 { 2442 {
2443 Lisp_Object left, top; 2443 Lisp_Object left, top;
2444 EmacsView *view = FRAME_NS_VIEW (f); 2444 EmacsView *view = FRAME_NS_VIEW (f);
2445 NSPoint pt; 2445 NSPoint pt;
2446 2446
2447 /* Start with user-specified or mouse position. */ 2447 /* Start with user-specified or mouse position. */
2448 left = Fcdr (Fassq (Qleft, parms)); 2448 left = Fcdr (Fassq (Qleft, parms));
2449 if (INTEGERP (left)) 2449 if (INTEGERP (left))
2450 pt.x = XINT (left); 2450 pt.x = XINT (left);
2451 else 2451 else
2486 *root_y = x_display_pixel_height (FRAME_NS_DISPLAY_INFO (f)) - height; 2486 *root_y = x_display_pixel_height (FRAME_NS_DISPLAY_INFO (f)) - height;
2487 } 2487 }
2488 2488
2489 2489
2490 DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, 2490 DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
2491 doc: /* Show STRING in a "tooltip" window on frame FRAME. 2491 doc: /* Show STRING in a \"tooltip\" window on frame FRAME.
2492 A tooltip window is a small window displaying a string. 2492 A tooltip window is a small window displaying a string.
2493 2493
2494 FRAME nil or omitted means use the selected frame. 2494 FRAME nil or omitted means use the selected frame.
2495 2495
2496 PARMS is an optional list of frame parameters which can be used to 2496 PARMS is an optional list of frame parameters which can be used to