From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Dmitry Vukolov To: community@altlinux.ru Subject: Re: [Comm] Color HPLaserJet 4550+hpoj Date: Mon, 12 Apr 2004 07:53:05 +0400 User-Agent: KMail/1.6.2 References: <20040406183440.1467378a.rud_ras@tut.by> <200404071833.27236.dvukol@rosmail.ru> <20040407175925.0417cdc7.rud_ras@tut.by> In-Reply-To: <20040407175925.0417cdc7.rud_ras@tut.by> MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Boundary-03=_uKheAC3cUs5e+3Y"; charset="koi8-r" Content-Transfer-Encoding: 7bit Message-Id: <200404120753.19027.dvukol@rosmail.ru> X-Virus-Scanned: clamd / ClamAV version 0.70rc, clamav-milter version 0.70 Cc: =?koi8-r?b?4NLJyg==?= X-BeenThere: community@altlinux.ru X-Mailman-Version: 2.1.4 Precedence: list Reply-To: community@altlinux.ru List-Id: Mailing list for ALT Linux users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Apr 2004 03:53:23 -0000 Archived-At: List-Archive: List-Post: --Boundary-03=_uKheAC3cUs5e+3Y Content-Type: multipart/mixed; boundary="Boundary-01=_hKheA/2HL5qwg+8" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_hKheA/2HL5qwg+8 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: base64 Content-Disposition: inline T24gV2VkbmVzZGF5IDA3IEFwcmlsIDIwMDQgMTg6NTksIODSycogd3JvdGU6Cj4gT24gV2VkLCA3 IEFwciAyMDA0IDE4OjMzOjE2ICswNDAwCj4KPiBEbWl0cnkgVnVrb2xvdiA8ZHZ1a29sQHJvc21h aWwucnU+IHdyb3RlOgo+ID4gT24gVHVlc2RheSAwNiBBcHJpbCAyMDA0IDIwOjU5LCDg0snKIHdy b3RlOgo8c2tpcHBlZD4KPiA+ID4g18TPx8/Oy9UKPiA+ID4KPiA+ID4gJCBwdGFsLWhwIGhwamQ6 MTkyLjE2OC4xLjMgZGlzcGxheQo+ID4gPiBQT1dFUlNBVkUgsrq7Lgo+ID4gPgo+ID4gPiDUz9bF INDPINLV09PLySDOxSDQz8vB2tnXwcXUIDotKAo+ID4KPiA+ICQgZWNobyBQT1dFUlNBVkUgsrq7 LiB8IGljb252IC1mIGlzbzg4NTktNSAtdCBrb2k4LXIKPiA+IFBPV0VSU0FWRSD36+wuCj4gPgo+ ID4g7c/Wzs8g09fB0dTYINDB1N7Jyy4g8SDHzNHO1S4KPgo+IPPQwdPJws8sIMLZzM8gwtkgzsUg 0MzPyM8uCgrg0snKLCDC1cTY1MUgxM/C0tksINDSz9fF0tjUxSB4b2pwYW5lbCDTINDSyczP1sXO ztnNINDB1N7FzS4g9SDNxc7RLCDLIArTz9bBzMXOycAsIM7F1CDS1dPTy8/Hz9fP0tHdycgg0NLJ ztTF0s/XIDotKQrl08zJINfToyDC1cTF1CDOz9LNwczYzs8sINTPIM7BIMTO0cgg19nMz9bVIM7P 19XAINPCz9LL1SBocG9qINcg88naycYuCgotLSAKRG1pdHJ5IFZ1a29sb3YK --Boundary-01=_hKheA/2HL5qwg+8 Content-Type: text/x-diff; charset="koi8-r"; name="hpoj-0.91-alt-xojpanel-enc.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="hpoj-0.91-alt-xojpanel-enc.patch" diff -Nur hpoj-0.91.orig/apps/xojpanel/xojpanel.cpp hpoj-0.91/apps/xojpanel= /xojpanel.cpp =2D-- hpoj-0.91.orig/apps/xojpanel/xojpanel.cpp 2002-07-25 13:01:24 +0400 +++ hpoj-0.91/apps/xojpanel/xojpanel.cpp 2004-04-10 21:53:36 +0400 @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include @@ -96,6 +97,10 @@ // Prints the contents of the character map to stdout. // #define DISPLAY_CHARACTER_MAP // +// Default encoding used by device for LCD messages +//#define DEFAULT_DEVICE_ENCODING "ISO8859-1" +#define DEFAULT_DEVICE_ENCODING "ISO8859-5" +// // In a case where you are using KDE2 and you built xojpanel // with qt-2.0.x, you may see a message like this: // "XError: BadValue(...)2". If so, try uncommenting the next line. @@ -127,6 +132,7 @@ caption =3D ""; useCaption =3D false; ptalDeviceName =3D ""; + deviceEncoding =3D DEFAULT_DEVICE_ENCODING; bool deviceNameInTitle =3D true; bool displayHelp =3D false; bool isTranslationEnabled =3D true; @@ -157,6 +163,11 @@ useCaption =3D true; i++; =09 } + =20 + else if(qstrcmp(argv[i], "-devenc") =3D=3D 0) { + deviceEncoding =3D argv[i+1]; + i++; =09 + } =09 else if( (!possibleDeviceNameFound) && argv[i][0] !=3D '-' ) { // Assume first unidentified argument is ptalDeviceName @@ -188,14 +199,16 @@ "\nOptions:\n\n" =09 =20 =2D "\t-help\t\tPrint this information and exit.\n" + "\t-help\t\t\tPrint this information and exit.\n" + + "\t-caption \t\tOptional text to be displayed in titlebar.\n" =20 =2D "\t-caption Optional text to be displayed in titlebar.\n" + "\t-notrans\t\tDisables 'special character' translation.\n" =20 =2D "\t-notrans\tDisables 'special character' translation.\n" + "\t-devenc \tEncoding used by device for LCD messages.\n" =20 =2D "\t-hidedevname\tPrevents PTAL device name from\n" =2D "\t\t\tbeing displayed in the titlebar.\n\n" + "\t-hidedevname\t\tPrevents PTAL device name from\n" + "\t\t\t\tbeing displayed in the titlebar.\n\n" =20 "\tThe first option *not* prefixed with a dash ('-')\n" "\twill be be used as the PTAL device name. If a default\n" @@ -317,6 +330,7 @@ characterMap[0x11] =3D 0xbb; // Right arrow to '>>' characterMap[0x12] =3D 0xa3; // Large pound(?) to small pound characterMap[0x13] =3D 0xbb; // Right hollow triangle to '>>' + characterMap[0x15] =3D 0xbb; // Right hollow triangle to '>>' characterMap[0x80] =3D 0xab; // Left hollow triangle to '<<' characterMap[0x81] =3D 0xbb; // Right black triangle to '>>' characterMap[0x82] =3D 0x2a; // Hollow circle to '*' @@ -529,8 +543,10 @@ =20 int length =3D strlen(string); int i =3D 0; =2D int spaces =3D 0; + int encFrom =3D 0; + unsigned int spaces =3D 0; QString tmpString; + QTextCodec *codec; =20 #ifdef SHOW_LCD_MESSAGE_ASCII_CODES // Show contents of original string as sent from device. @@ -546,28 +562,40 @@ if ( string[0] !=3D 0 ) printf("\nNew message:\n"); #endif =20 + // Initialize the codec + codec =3D QTextCodec::codecForName(deviceEncoding); + if ( ! codec ) + codec =3D QTextCodec::codecForName(DEFAULT_DEVICE_ENCODING); +=09 // Convert each character in string[] to corresponding =2D // character in characterTranslationMap[] =2D for ( int i =3D 0; i < length; i++ ) { =2D string[i] =3D characterTranslationMap[ (unsigned char)string[i] ]; + // character in characterTranslationMap[] and apply necessary encoding + // conversion + for ( i =3D 0; i < length; i++ ) { + if ((char)characterTranslationMap[ (unsigned char)string[i] ] + !=3D string[i]) { + tmpString +=3D codec->toUnicode(string + encFrom, i - encFrom); + tmpString +=3D=20 + QChar(characterTranslationMap[ (unsigned char)string[i] ]); + encFrom =3D i + 1; + } } + tmpString +=3D codec->toUnicode(string + encFrom, i - encFrom); =20 spaces =3D 0; =2D i =3D length - 1 ; + i =3D tmpString.length() - 1 ; =20 // Count spaces on the trailing end of the string. =2D while( string[i] =3D=3D 0x20 ) { + while( tmpString[i] =3D=3D 0x20 ) { // printf("i is now=3D %d\n", i); spaces++; // printf("spaces=3D %d\n\n", spaces); =20 // Don't cycle through again if the entire string // is counted for removal. It could result in a segfault. =2D if( spaces >=3D length ) break; + if( spaces >=3D tmpString.length() ) break; i--; } =20 =2D tmpString =3D string; // printf("tmpString=3D %s\n",(const char*)tmpString ); =20 // Remove trailing spaces and assign text to appropriate message line. diff -Nur hpoj-0.91.orig/apps/xojpanel/xojpanel.h hpoj-0.91/apps/xojpanel/x= ojpanel.h =2D-- hpoj-0.91.orig/apps/xojpanel/xojpanel.h 2002-07-25 13:01:24 +0400 +++ hpoj-0.91/apps/xojpanel/xojpanel.h 2004-04-10 20:35:01 +0400 @@ -83,6 +83,7 @@ =20 char* caption; char* ptalDeviceName; + char* deviceEncoding; =09 bool useCaption; =09 --Boundary-01=_hKheA/2HL5qwg+8-- --Boundary-03=_uKheAC3cUs5e+3Y Content-Type: application/pgp-signature Content-Description: signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQBAehKu71tprB1tyF0RAqvhAJ94ayoTiH/B8AAlwuiMMg5QNVyP6ACgjSqq gB+NutjRn0zOjqSh7Ts8/JE= =VB6m -----END PGP SIGNATURE----- --Boundary-03=_uKheAC3cUs5e+3Y--