|
From: <set...@us...> - 2006-04-22 20:56:32
|
Revision: 1324 Author: sethdill Date: 2006-04-22 13:56:10 -0700 (Sat, 22 Apr 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1324&view=rev Log Message: ----------- Merged trunk changes r1297:1323 into the Conversant branch. Only includes changes in Common/ Modified Paths: -------------- Frontier/branches/Conversant/Common/headers/icon.h Frontier/branches/Conversant/Common/headers/stringdefs.h Frontier/branches/Conversant/Common/headers/strings.h Frontier/branches/Conversant/Common/headers/tablestructure.h Frontier/branches/Conversant/Common/resources/Mac/kernelverbs.r Frontier/branches/Conversant/Common/source/about.c Frontier/branches/Conversant/Common/source/claylinelayout.c Frontier/branches/Conversant/Common/source/icon.c Frontier/branches/Conversant/Common/source/langhash.c Frontier/branches/Conversant/Common/source/langpack.c Frontier/branches/Conversant/Common/source/langstartup.c Frontier/branches/Conversant/Common/source/opicons.c Frontier/branches/Conversant/Common/source/strings.c Frontier/branches/Conversant/Common/source/stringverbs.c Frontier/branches/Conversant/Common/source/tabledisplay.c Frontier/branches/Conversant/Common/source/tablestructure.c Modified: Frontier/branches/Conversant/Common/headers/icon.h =================================================================== --- Frontier/branches/Conversant/Common/headers/icon.h 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/headers/icon.h 2006-04-22 20:56:10 UTC (rev 1324) @@ -32,6 +32,7 @@ #define atVerticalCenter 0x01 #define atHorizontalCenter 0x02 #define kTransformSelected 0x04 + #define kAlignAbsoluteCenter (atVerticalCenter | atHorizontalCenter) #endif #ifdef MACVERSION /*7.0b9 PBS: tycustomicontypeinfo is for Mac custom icons*/ Modified: Frontier/branches/Conversant/Common/headers/stringdefs.h =================================================================== --- Frontier/branches/Conversant/Common/headers/stringdefs.h 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/headers/stringdefs.h 2006-04-22 20:56:10 UTC (rev 1324) @@ -78,6 +78,7 @@ #define STR_this BIGSTRING ("\x04" "this") #define STR_temp "\x04" "temp" #define STR_environment "\x0b" "environment" + #define STR_charsets "\x08" "charsets" #define STR_Stack_overflow BIGSTRING ("\x0f" "Stack overflow!") Modified: Frontier/branches/Conversant/Common/headers/strings.h =================================================================== --- Frontier/branches/Conversant/Common/headers/strings.h 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/headers/strings.h 2006-04-22 20:56:10 UTC (rev 1324) @@ -266,7 +266,9 @@ extern boolean utf8tomacroman (Handle, Handle); /* 2006-02-25 creedon */ -extern boolean converttextencoding (Handle, Handle, long, long); +extern boolean gettextencodingid (const Handle, long *); /* 2006-04-20 smd */ +extern boolean converttextencoding (Handle, Handle, long, long); /* 2006-04-14 smd */ + #endif Modified: Frontier/branches/Conversant/Common/headers/tablestructure.h =================================================================== --- Frontier/branches/Conversant/Common/headers/tablestructure.h 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/headers/tablestructure.h 2006-04-22 20:56:10 UTC (rev 1324) @@ -180,7 +180,9 @@ extern hdlhashtable environmenttable; +extern hdlhashtable charsetstable; + extern byte nameinternaltable []; extern byte namemenubar []; @@ -227,7 +229,9 @@ extern byte nameenvironmenttable []; +extern byte namecharsetstable []; + /*prototypes*/ extern boolean linksystemtablestructure (hdlhashtable); /*tablestructure.c*/ Modified: Frontier/branches/Conversant/Common/resources/Mac/kernelverbs.r =================================================================== --- Frontier/branches/Conversant/Common/resources/Mac/kernelverbs.r 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/resources/Mac/kernelverbs.r 2006-04-22 20:56:10 UTC (rev 1324) @@ -601,7 +601,7 @@ "multipleReplaceAll", "macromantoutf8", // 2006-02-25 creedon "utf8tomacroman", // 2006-02-25 creedon - "convertcharset" /* 2006-04-13 */ + "convertcharset" /* 2006-04-13 smd */ } } }; Modified: Frontier/branches/Conversant/Common/source/about.c =================================================================== --- Frontier/branches/Conversant/Common/source/about.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/about.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -279,7 +279,7 @@ if (GetIconRefFromFile (&programfspec, &iconref, &label) == noErr) { - ec = PlotIconRef (&r, atVerticalCenter + atHorizontalCenter, flpressed? kTransformSelected : 0, kIconServicesNormalUsageFlag, iconref); + ec = PlotIconRef (&r, kAlignAbsoluteCenter, flpressed? kTransformSelected : 0, kIconServicesNormalUsageFlag, iconref); ReleaseIconRef (iconref); @@ -288,7 +288,7 @@ } /*if*/ #endif - ploticonresource (&rcicn, atVerticalCenter + atHorizontalCenter, flpressed? kTransformSelected : 0, idfrontiericon); + ploticonresource (&rcicn, kAlignAbsoluteCenter, flpressed? kTransformSelected : 0, idfrontiericon); } /*ccdrawfrontiericon*/ Modified: Frontier/branches/Conversant/Common/source/claylinelayout.c =================================================================== --- Frontier/branches/Conversant/Common/source/claylinelayout.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/claylinelayout.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -931,7 +931,7 @@ transform = 0x4000; #ifdef MACVERSION - ploticonresource ((Rect *) iconrect, atVerticalCenter + atHorizontalCenter, transform, iconnum); + ploticonresource ((Rect *) iconrect, kAlignAbsoluteCenter, transform, iconnum); #endif #ifdef WIN95VERSION Modified: Frontier/branches/Conversant/Common/source/icon.c =================================================================== --- Frontier/branches/Conversant/Common/source/icon.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/icon.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -41,6 +41,8 @@ #include "resources.h" /*7.0b9 PBS*/ #include "launch.h" /*7.0b9 PBS*/ +#include "byteorder.h" + /* #define macicon 128 #define bugicon 129 @@ -74,15 +76,26 @@ 1.0b21 dmb: try geting normal b&w icon if all else fails 5.0a8 dmb: use srccopy, not srcand for win blits + + Note that the Windows version does NOT use the transform parameter */ #ifdef MACVERSION OSErr ec; CIconHandle hcicon; Handle hicon; + Rect rlocal = *r; - ec = PlotIconID (r, align, transform, resid); +#ifdef SWAP_BYTE_ORDER + /* For some unknown reason the Intel OS X builds shift the icon displays */ + rlocal.top += 3; + rlocal.bottom += 3; + rlocal.left += 6; + rlocal.right += 6; +#endif + ec = PlotIconID (&rlocal, align, transform, resid); + if (ec == noErr) return (true); @@ -90,7 +103,7 @@ if (hcicon != nil) { - PlotCIcon (r, hcicon); + PlotCIcon (&rlocal, hcicon); DisposeCIcon (hcicon); @@ -101,7 +114,7 @@ if (hicon != nil) { - PlotIcon (r, hicon); + PlotIcon (&rlocal, hicon); /*ReleaseResource (hicon);*/ /*dmb 1.0b21 - don't need to*/ Modified: Frontier/branches/Conversant/Common/source/langhash.c =================================================================== --- Frontier/branches/Conversant/Common/source/langhash.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/langhash.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -2924,6 +2924,8 @@ 2002-11-11 AR: Added assert to make sure the C compiler chose the proper byte alignment for the tydisktablerecord struct. If it did not, we would end up corrupting any database files we saved. + + 2006-04-20 sethdill & aradke: convert rgb values to native byte order */ boolean fl; @@ -3122,6 +3124,25 @@ break; } + case rgbvaluetype: { /* 2006-04-20 sethdill & aradke */ + diskrgb **rgbdisk; + RGBColor rgb; + + if (!hashunpackbinary (hstrings, (Handle *) &rgbdisk, ixstrings)) + goto L1; + + diskrgbtorgb (*rgbdisk, &rgb); + + disposehandle ((Handle) rgbdisk); + + if (!newheapvalue (&rgb, sizeof (rgb), rgbvaluetype, &val)) + goto L1; + + exemptfromtmpstack (&val); + + break; + } + #if noextended case doublevaluetype: { @@ -3159,7 +3180,6 @@ case stringvaluetype: case passwordvaluetype: case patternvaluetype: - case rgbvaluetype: #ifndef oplanglists case listvaluetype: case recordvaluetype: Modified: Frontier/branches/Conversant/Common/source/langpack.c =================================================================== --- Frontier/branches/Conversant/Common/source/langpack.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/langpack.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -105,6 +105,8 @@ 4/8/93 dmb: save/restore hdlpackedvalue to allow reentrancy needed for code values 5.0.2b10 dmb: don't disable langerror when getting an address path. + + 2006-04-20 sethdill & aradke: convert rgb values from native byte order to big-endian */ register boolean fl; @@ -213,6 +215,16 @@ break; } + case rgbvaluetype: { /* 2006-04-20 sethdill & aradke */ + diskrgb rgbdiskk; + + rgbtodiskrgb (*val.data.rgbvalue, &rgbdiskk); + + fl = langpackdata (sizeof (rgbdiskk), &rgbdiskk, hpackedvalue); + + break; + } + #if noextended case doublevaluetype: { @@ -239,7 +251,6 @@ case passwordvaluetype: case patternvaluetype: case objspecvaluetype: - case rgbvaluetype: #ifndef version5orgreater case filespecvaluetype: case aliasvaluetype: @@ -494,6 +505,8 @@ 4/8/93 dmb: save/restore hdlpackedvalue to allow reentrancy needed for code values 5.0.2b3 dmb: unpacking addresses, if stringtoaddress fails, set valuetype to string + + 2006-04-20 sethdill & aradke: convert rgb values to native byte order */ tyvaluerecord v; @@ -622,6 +635,25 @@ break; } + case rgbvaluetype: { /* 2006-04-20 sethdill & aradke */ + RGBColor rgb; + diskrgb rgbdisk; + + fl = langunpackdata (sizeof (rgbdisk), &rgbdisk, h, &ixunpack); + + if (fl) { + + diskrgbtorgb (&rgbdisk, &rgb); + + fl = newheapvalue (&rgb, sizeof (rgb), rgbvaluetype, &v); + + if (fl) + exemptfromtmpstack (&v); + } + + break; + } + #if noextended case doublevaluetype: { @@ -655,7 +687,6 @@ case stringvaluetype: case passwordvaluetype: case patternvaluetype: - case rgbvaluetype: case binaryvaluetype: #ifndef version5orgreater case objspecvaluetype: Modified: Frontier/branches/Conversant/Common/source/langstartup.c =================================================================== --- Frontier/branches/Conversant/Common/source/langstartup.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/langstartup.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -424,6 +424,98 @@ } /*initenvironment*/ +static boolean initCharsetsTable (hdlhashtable cSetsTable) +{ +#if MACVERSION + OSStatus err; + ItemCount ct, actual_ct, i; + + err = TECCountAvailableTextEncodings( &ct ); + if ( err != noErr ) { + pophashtable(); + + return (true); // don't kill the whole startup + } + + TextEncoding enc; + TextEncoding availEncodings[ ct ]; + bigstring ianaName; + + err = TECGetAvailableTextEncodings ( availEncodings, ct, &actual_ct ); + if ( err != noErr ) + return (true); // we don't want to kill the whole startup here + + for ( i = 0; i < actual_ct; i++ ) { + enc = availEncodings[ i ]; + + /* + get the internet "iana" name for the encoding + */ + err = TECGetTextEncodingInternetName( enc, ianaName ); + if ( err != noErr ) + continue; + + /* + now convert the "iana" name back into the canonical encoding value + (more than one encoding will point to the same iana name, + this makes sure that we use the right one) + */ + err = TECGetTextEncodingFromInternetName( &enc, ianaName ); + if ( err != noErr ) + continue; + + langassignlongvalue( cSetsTable, ianaName, (long) enc ); + } +#endif + +#if WIN95VERSION + langassignlongvalue( cSetsTable, "\x05" "ASCII", 20127 ); + langassignlongvalue( cSetsTable, "\x08" "US-ASCII", 20127 ); /* alias for ASCII */ + + langassignlongvalue( cSetsTable, "\x09" "MACINTOSH", 10000 ); + langassignlongvalue( cSetsTable, "\x08" "MacRoman", 10000 ); /* alias for MACINTOSH */ + + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-1", 28591 ); + langassignlongvalue( cSetsTable, "\x0b" "iso-latin-1", 28591 ); /* alias for iso-8859-1 */ + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-2", 28592 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-3", 28593 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-4", 28594 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-5", 28595 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-6", 28596 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-7", 28597 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-8", 28598 ); + langassignlongvalue( cSetsTable, "\x0a" "iso-8859-9", 28599 ); + langassignlongvalue( cSetsTable, "\x0b" "iso-8859-10", 28592 ); + + langassignlongvalue( cSetsTable, "\x0c" "windows-1250", 1250 ); + langassignlongvalue( cSetsTable, "\x0f" "windows-latin-2", 1250 ); /* code page 1250, Central Europe */ + + langassignlongvalue( cSetsTable, "\x0c" "windows-1251", 1251 ); /* code page 1251, Slavic Cyrillic */ + + langassignlongvalue( cSetsTable, "\x0c" "windows-1252", 1252 ); + langassignlongvalue( cSetsTable, "\x0f" "windows-latin-1", 1252 ); + + langassignlongvalue( cSetsTable, "\x0c" "windows-1253", 1253 ); /* code page 1253 */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1254", 1254 ); /* code page 1254, Turkish */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1255", 1255 ); /* code page 1255 */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1256", 1256 ); /* code page 1256 */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1257", 1257 ); /* code page 1257 */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1258", 1258 ); /* code page 1258 */ + langassignlongvalue( cSetsTable, "\x0c" "windows-1361", 1361 ); /* code page 1361, for Windows NT */ + + langassignlongvalue( cSetsTable, "\x05" "UTF-7", 65000 ); + langassignlongvalue( cSetsTable, "\x05" "UTF-8", 65001 ); + + langassignlongvalue( cSetsTable, "\x06" "UTF-16", 0 ); /* not a real code page. 0 for special case handling in Frontier */ + + langassignlongvalue( cSetsTable, "\x08" "UTF-16le", 1200 ); + langassignlongvalue( cSetsTable, "\x08" "UTF-16be", 1201 ); +#endif + + return (true); + } /* initCharsetsTable */ + + boolean inittablestructure (void) { /* @@ -476,6 +568,13 @@ if (!initenvironment (environmenttable)) goto error; + // and now the charsets table + + if (!tablenewsystemtable (htable, namecharsetstable, &charsetstable)) + goto error; + + initCharsetsTable (charsetstable); /* don't die if the charsets can't be initialized */ + pophashtable (); return (true); @@ -588,123 +687,6 @@ #define addstring(x,y) if (!langaddstringconst ((ptrstring) x, y)) return (false) -static boolean langinit_charset_consttable (void) { - - /* - First pass at a way to populate a table with many of - the known charsets. Key is the MIME charset name (the - IANA-registered name), value is the platform-dependent - value that identifies that character set. (Constants on - Mac, code page id numbers on Windows.) - - There may be a one-hit memory leak here, because nothing is done - to release the table... but maybe it can't be released, because - it needs to stick around? - - A better approach on both platforms would be some routine that - asks the OS for a list of the character sets it supports. - I couldn't find anything like that on the Mac, and on Windows - it requires COM which I couldn't get to work! - */ - - hdlhashtable hcharsetconsttable; - - if (!tablenewsystemtable (langtable, (ptrstring) "\x08" "charsets", &hcharsetconsttable)) - return (false); - - pushhashtable (hcharsetconsttable); - -#if MACVERSION - addlong( "ASCII", kCFStringEncodingASCII ); - addlong( "MacRoman", kCFStringEncodingMacRoman ); - addlong( "MACINTOSH", kCFStringEncodingMacRoman ); - - addlong( "iso-8859-1", kCFStringEncodingISOLatin1 ); - addlong( "iso-latin-1", kCFStringEncodingISOLatin1 ); - addlong( "iso-8859-2", kCFStringEncodingISOLatin2 ); - addlong( "iso-8859-3", kCFStringEncodingISOLatin3 ); - addlong( "iso-8859-4", kCFStringEncodingISOLatin4 ); - addlong( "iso-8859-5", kCFStringEncodingISOLatin5 ); - addlong( "iso-8859-6", kCFStringEncodingISOLatin6 ); - addlong( "iso-8859-7", kCFStringEncodingISOLatin7 ); - addlong( "iso-8859-8", kCFStringEncodingISOLatin8 ); - addlong( "iso-8859-9", kCFStringEncodingISOLatin9 ); - - #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - addlong( "iso-8859-10", kCFStringEncodingISOLatin10 ); - #endif - - addlong( "windows-1250", kCFStringEncodingWindowsLatin2 ); - addlong( "windows-latin-2", kCFStringEncodingWindowsLatin2 ); /* code page 1250, Central Europe */ - - addlong( "windows-1251", kCFStringEncodingWindowsCyrillic ); /* code page 1251, Slavic Cyrillic */ - - addlong( "windows-1252", kCFStringEncodingWindowsLatin1 ); - addlong( "windows-latin-1", kCFStringEncodingWindowsLatin1 ); /* ANSI 1252 */ - - addlong( "windows-1253", kCFStringEncodingWindowsLatin5 ); /* code page 1253 */ - addlong( "windows-1254", kCFStringEncodingWindowsLatin5 ); /* code page 1254, Turkish */ - addlong( "windows-1255", kCFStringEncodingWindowsHebrew ); /* code page 1255 */ - addlong( "windows-1256", kCFStringEncodingWindowsArabic ); /* code page 1256 */ - addlong( "windows-1257", kCFStringEncodingWindowsBalticRim ); /* code page 1257 */ - addlong( "windows-1258", kCFStringEncodingWindowsVietnamese ); /* code page 1258 */ - addlong( "windows-1361", kCFStringEncodingWindowsKoreanJohab ); /* code page 1361, for Windows NT */ - - addlong( "UTF-7", kCFStringEncodingNonLossyASCII ); - addlong( "UTF-8", kCFStringEncodingUTF8 ); - addlong( "UTF-16", kCFStringEncodingUnicode ); - - #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 - addlong( "UTF-16le", kCFStringEncodingUTF16LE ); - addlong( "UTF-16be", kCFStringEncodingUTF16BE ); - #endif -#endif - -#if WIN95VERSION - addlong( "ASCII", 20127 ); - addlong( "MacRoman", 10000 ); - addlong( "MACINTOSH", 10000 ); - - addlong( "iso-8859-1", 28591 ); - addlong( "iso-latin-1", 28591 ); - addlong( "iso-8859-2", 28592 ); - addlong( "iso-8859-3", 28593 ); - addlong( "iso-8859-4", 28594 ); - addlong( "iso-8859-5", 28595 ); - addlong( "iso-8859-6", 28596 ); - addlong( "iso-8859-7", 28597 ); - addlong( "iso-8859-8", 28598 ); - addlong( "iso-8859-9", 28599 ); - addlong( "iso-8859-10", 28592 ); - - addlong( "windows-1250", 1250 ); - addlong( "windows-latin-2", 1250 ); /* code page 1250, Central Europe */ - - addlong( "windows-1251", 1251 ); /* code page 1251, Slavic Cyrillic */ - - addlong( "windows-1252", 1252 ); - addlong( "windows-latin-1", 1252 ); - - addlong( "windows-1253", 1253 ); /* code page 1253 */ - addlong( "windows-1254", 1254 ); /* code page 1254, Turkish */ - addlong( "windows-1255", 1255 ); /* code page 1255 */ - addlong( "windows-1256", 1256 ); /* code page 1256 */ - addlong( "windows-1257", 1257 ); /* code page 1257 */ - addlong( "windows-1258", 1258 ); /* code page 1258 */ - addlong( "windows-1361", 1361 ); /* code page 1361, for Windows NT */ - - addlong( "UTF-7", 65000 ); - addlong( "UTF-8", 65001 ); - addlong( "UTF-16", 0 ); - addlong( "UTF-16le", 1200 ); - addlong( "UTF-16be", 1201 ); -#endif - - pophashtable(); - - return (true); - } /* langinit_charset_consttable */ - static boolean langinitconsttable (void) { /* @@ -803,7 +785,7 @@ static boolean langinitbuiltintable (void) { - if (!tablenewsystemtable (langtable, (ptrstring) BIGSTRING ("\x08" "builtins"), &hbuiltinfunctions)) + if (!tablenewsystemtable (langtable, (ptrstring) "\x08" "builtins", &hbuiltinfunctions)) return (false); pushhashtable (hbuiltinfunctions); /*converted to function ops by the parser*/ @@ -858,7 +840,7 @@ 3/6/92 dmb: added "with" token */ - if (!tablenewsystemtable (langtable, (ptrstring) BIGSTRING ("\x08" "keywords"), &hkeywordtable)) + if (!tablenewsystemtable (langtable, (ptrstring) "\x08" "keywords", &hkeywordtable)) return (false); pushhashtable (hkeywordtable); /*converted to tokens by the scanner*/ @@ -934,9 +916,6 @@ if (!langinitconsttable ()) return (false); - if (!langinit_charset_consttable ()) - return (false); - if (!langinitbuiltintable ()) return (false); Modified: Frontier/branches/Conversant/Common/source/opicons.c =================================================================== --- Frontier/branches/Conversant/Common/source/opicons.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/opicons.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -92,20 +92,24 @@ void opdrawheadicon (short iconnum, const Rect *r, boolean flselected) { + /* + This function draws the triangle icons inside outlines (but not root tables). + Root table triangles are in tabledisplay.c, browserdrawnodeicon() + */ - short transform = 0; + operaserect (*r); +#ifdef MACVERSION + short transform = kTransformNone; + if (flselected) - transform = 0x4000; + transform = kTransformSelected; - operaserect (*r); - -#ifdef MACVERSION - ploticonresource ((Rect *) r, atVerticalCenter + atHorizontalCenter, transform, iconnum); + ploticonresource ((Rect *) r, kAlignAbsoluteCenter, transform, iconnum); #endif #ifdef WIN95VERSION - ploticonresource (r, 0, transform, iconnum); + ploticonresource (r, 0, 0, iconnum); #endif } /*opdrawheadicon*/ @@ -115,7 +119,7 @@ short transform = 0; if (flselected) - transform = 0x4000; + transform = kTransformSelected; operaserect (*r); @@ -189,16 +193,16 @@ boolean opdefaultgeticonrect (hdlheadrecord hnode, const Rect *linerect, Rect *iconrect) { hdloutlinerecord ho = outlinedata; - Rect r = *linerect; - Rect rcontains; + Rect r; + Rect rcontains = *linerect; - r.bottom = r.top + (**ho).iconheight; + rcontains.bottom = rcontains.top + (**ho).iconheight; - r.left += opnodeindent (hnode); + rcontains.left += opnodeindent (hnode); - r.right = r.left + (**ho).iconwidth; + rcontains.right = rcontains.left + (**ho).iconwidth; - rcontains = r; + r = rcontains; if (opisfatheadlines (ho)) rcontains.bottom = rcontains.top + textvertinset + (**ho).defaultlineheight + textvertinset; @@ -208,7 +212,7 @@ centerrect (&r, rcontains); /*center it vertically within the linerect*/ *iconrect = r; - + return (true); } /*opdefaultgeticonrect*/ Modified: Frontier/branches/Conversant/Common/source/strings.c =================================================================== --- Frontier/branches/Conversant/Common/source/strings.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/strings.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -35,6 +35,7 @@ #include "ops.h" #include "resources.h" #include "shell.rsrc.h" +#include "tablestructure.h" #include "timedate.h" #include "langinternal.h" /* 2006-02-26 creedon */ #include "byteorder.h" /* 2006-04-08 aradke: endianness conversion macros */ @@ -2338,6 +2339,34 @@ #endif /*end Windows character conversion routines*/ +/* convert an "internet name" for an encoding into a platform-specific id for the character set */ + +boolean gettextencodingid (const Handle h, long * encodingId) { + +#ifdef MACVERSION + + OSStatus err; + TextEncoding oneEncoding; + bigstring ianaName; + long ct, ix = 0; + + ct = gethandlesize (h); + ianaName [0] = (byte) ct; + loadfromhandle (h, &ix, ct, ianaName + 1); + + err = TECGetTextEncodingFromInternetName( &oneEncoding, ianaName ); + + if ( err != noErr ) + return (false); + + *encodingId = (long) oneEncoding; + +#endif + + return (true); +} + + boolean converttextencoding (Handle h, Handle hresult, long inputcharset, long outputcharset) { #ifdef MACVERSION /*Mac character conversion common routine*/ @@ -2353,18 +2382,25 @@ // (*h) [lentext] = '\0'; - TECCreateConverter (&converter, inputcharset, outputcharset); + status = TECCreateConverter (&converter, inputcharset, outputcharset); + if ( status != noErr ) { + TECDisposeConverter (converter); + return (false); + } - sizeoutputbuffer = lentext * 2; + sizeoutputbuffer = lentext * 4; if (sizeoutputbuffer < 32) /*docs say use 32 minimum*/ sizeoutputbuffer = 32; - sethandlesize (hresult, sizeoutputbuffer); + if (!sethandlesize (hresult, sizeoutputbuffer)) { // out of memory + TECDisposeConverter (converter); + return (false); + } // 2005-08-26 --- kw better bytemark detecting // see http://en.wikipedia.org/wiki/Byte_Order_Mark - if (inputcharset == 0x08000100) // we handle utf-8 input + if (inputcharset == kCFStringEncodingUTF8) // we handle utf-8 input { if ( (*h) [0] == '\xEF' && (*h) [1] == '\xBB' @@ -2387,15 +2423,19 @@ // if (((*h) [0] == '\xFF') || ((*h) [0] == '\xEF')) /*pop byte order mark*/ // pullfromhandle (h, 0, 3, NULL); + /* if (pullBytes > 0) pullfromhandle (h, 0, pullBytes, NULL); + */ + + lentext = gethandlesize (h) - pullBytes; - lentext = gethandlesize (h); - - status = TECConvertText (converter, (ConstTextPtr)(*h), lentext, &ctorigbytes, (TextPtr)(*hresult), sizeoutputbuffer, &ctoutputbytes); + status = TECConvertText (converter, (ConstTextPtr)(*h + pullBytes), lentext, &ctorigbytes, (TextPtr)(*hresult), sizeoutputbuffer, &ctoutputbytes); - if (status != noErr) + if (status != noErr) { + TECDisposeConverter (converter); return (false); + } TECFlushText (converter, (TextPtr)(*hresult), sizeoutputbuffer, &ctflushedbytes); Modified: Frontier/branches/Conversant/Common/source/stringverbs.c =================================================================== --- Frontier/branches/Conversant/Common/source/stringverbs.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/stringverbs.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -2282,8 +2282,6 @@ if (!macromantoutf8 (h, hresult)) goto error; - disposehandle (h); - return (setheapvalue (hresult, stringvaluetype, v)); } @@ -2301,8 +2299,6 @@ if (!utf8tomacroman (h, hresult)) goto error; - disposehandle (h); - return (setheapvalue (hresult, stringvaluetype, v)); } @@ -2327,11 +2323,11 @@ if (! converttextencoding (h, hresult, charsetIn, charsetOut)) goto error; - disposehandle(h); + // disposehandle(h); return (setheapvalue (hresult, stringvaluetype, v)); } - + default: errornum = notimplementederror; Modified: Frontier/branches/Conversant/Common/source/tabledisplay.c =================================================================== --- Frontier/branches/Conversant/Common/source/tabledisplay.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/tabledisplay.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -1083,22 +1083,27 @@ void browserdrawnodeicon (const Rect *r, boolean flhighlighted, hdlheadrecord hnode) { + /* + This function draws the triangle icons inside tables (but not outlines). + Outline triangles are in opicons.c, opdrawheadicon() + */ + tybrowserinfo browserinfo; + browsergetrefcon (hnode, &browserinfo); + +#ifdef MACVERSION + short transform = kTransformNone; - tybrowserinfo browserinfo; - short transform = 0; - long align = 0; - if (flhighlighted) - transform = 0x4000; + transform = kTransformSelected; -#ifdef MACVERSION - align = atVerticalCenter + atHorizontalCenter; + ploticonresource (r, kAlignAbsoluteCenter, transform, opgetheadicon (hnode)); #endif + +#ifdef WIN95VERSION + ploticonresource (r, 0, 0, opgetheadicon (hnode)); +#endif - browsergetrefcon (hnode, &browserinfo); - ploticonresource (r, align, transform, opgetheadicon (hnode)); - #if 0 transform += ttLabel [browserinfo.ixlabel]; /*color it according to the file's label*/ Modified: Frontier/branches/Conversant/Common/source/tablestructure.c =================================================================== --- Frontier/branches/Conversant/Common/source/tablestructure.c 2006-04-22 20:44:25 UTC (rev 1323) +++ Frontier/branches/Conversant/Common/source/tablestructure.c 2006-04-22 20:56:10 UTC (rev 1324) @@ -100,8 +100,10 @@ byte nameenvironmenttable [] = STR_environment; +byte namecharsetstable [] = STR_charsets; + Handle rootvariable = nil; hdlhashtable roottable = nil; @@ -146,8 +148,10 @@ hdlhashtable environmenttable = nil; +hdlhashtable charsetstable = nil; + boolean getsystemtablescript (short idscript, bigstring bsscript) { return (getstringlist (idsystemtablescripts, idscript, bsscript)); @@ -259,6 +263,10 @@ if (!linksystemtable (hsystem, nameenvironmenttable, environmenttable)) return (false); + // link in the charsets table, not part of saved structure + if (!linksystemtable (hsystem, namecharsetstable, charsetstable)) + return (false); + // create the temp table, not part of saved structure if (checktable (hsystem, nametemptable, true, &htemp)) langexternaldontsave (hsystem, nametemptable); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |