comparison src/gui_mac.c @ 501:ce2181d14aa0 v7.0139

updated for version 7.0139
author vimboss
date Tue, 30 Aug 2005 21:55:26 +0000
parents d0d15b184c56
children 52e76e2b5b65
comparison
equal deleted inserted replaced
500:4772a5e3f9fa 501:ce2181d14aa0
92 #endif 92 #endif
93 93
94 #if defined(USE_CARBONIZED) && defined(FEAT_MBYTE) 94 #if defined(USE_CARBONIZED) && defined(FEAT_MBYTE)
95 # define USE_CARBONKEYHANDLER 95 # define USE_CARBONKEYHANDLER
96 static EventHandlerUPP keyEventHandlerUPP = NULL; 96 static EventHandlerUPP keyEventHandlerUPP = NULL;
97 /* Defined in os_mac_conv.c */
98 extern char_u *mac_utf16_to_enc __ARGS((UniChar *from, size_t fromLen, size_t *actualLen));
99 extern UniChar *mac_enc_to_utf16 __ARGS((char_u *from, size_t fromLen, size_t *actualLen));
100 extern CFStringRef mac_enc_to_cfstring __ARGS((char_u *from, size_t fromLen));
101 #endif 97 #endif
102 98
103 #ifdef MACOS_X 99 #ifdef MACOS_X
104 SInt32 gMacSystemVersion; 100 SInt32 gMacSystemVersion;
105 #endif 101 #endif
1616 * Fill the buffer pointed to by outName with the name and size 1612 * Fill the buffer pointed to by outName with the name and size
1617 * of the font currently selected in the Font Panel. 1613 * of the font currently selected in the Font Panel.
1618 */ 1614 */
1619 #define FONT_STYLE_BUFFER_SIZE 32 1615 #define FONT_STYLE_BUFFER_SIZE 32
1620 static void 1616 static void
1621 GetFontPanelSelection(char_u* outName) 1617 GetFontPanelSelection(char_u *outName)
1622 { 1618 {
1623 Str255 buf; 1619 Str255 buf;
1624 ByteCount fontNameLen = 0; 1620 ByteCount fontNameLen = 0;
1625 ATSUFontID fid; 1621 ATSUFontID fid;
1626 char_u styleString[FONT_STYLE_BUFFER_SIZE]; 1622 char_u styleString[FONT_STYLE_BUFFER_SIZE];
1637 1633
1638 /* Request font name with Mac encoding (otherwise we could 1634 /* Request font name with Mac encoding (otherwise we could
1639 * get an unwanted utf-16 name) */ 1635 * get an unwanted utf-16 name) */
1640 if (ATSUFindFontName(fid, kFontFullName, kFontMacintoshPlatform, 1636 if (ATSUFindFontName(fid, kFontFullName, kFontMacintoshPlatform,
1641 kFontNoScriptCode, kFontNoLanguageCode, 1637 kFontNoScriptCode, kFontNoLanguageCode,
1642 255, outName, &fontNameLen, NULL) != noErr) 1638 255, (char *)outName, &fontNameLen, NULL) != noErr)
1643 return; 1639 return;
1644 1640
1645 /* Only encode font size, because style (bold, italic, etc) is 1641 /* Only encode font size, because style (bold, italic, etc) is
1646 * already part of the font full name */ 1642 * already part of the font full name */
1647 vim_snprintf(styleString, FONT_STYLE_BUFFER_SIZE, ":h%d", 1643 vim_snprintf((char *)styleString, FONT_STYLE_BUFFER_SIZE, ":h%d",
1648 gFontPanelInfo.size/*, 1644 gFontPanelInfo.size/*,
1649 ((gFontPanelInfo.style & bold)!=0 ? ":b" : ""), 1645 ((gFontPanelInfo.style & bold)!=0 ? ":b" : ""),
1650 ((gFontPanelInfo.style & italic)!=0 ? ":i" : ""), 1646 ((gFontPanelInfo.style & italic)!=0 ? ":i" : ""),
1651 ((gFontPanelInfo.style & underline)!=0 ? ":u" : "")*/); 1647 ((gFontPanelInfo.style & underline)!=0 ? ":u" : "")*/);
1652 1648
1653 if ((fontNameLen + STRLEN(styleString)) < 255) 1649 if ((fontNameLen + STRLEN(styleString)) < 255)
1654 STRCPY(outName + fontNameLen, styleString); 1650 STRCPY(outName + fontNameLen, styleString);
1655 } 1651 }
1656 else 1652 else
1657 { 1653 {
1658 *outName = NULL; 1654 *outName = NUL;
1659 } 1655 }
1660 } 1656 }
1661 #endif 1657 #endif
1662 1658
1663 1659