#Patch: correct support for non-latin1 languages in AbiWord-0.7.11 (c) # by Vlad Harchev # # Revision history: # 1.0f * Now characters are properly converted when pasting from other apps or # when reading plain text files. Without this modification, cutting and # pasting text just pasted from other app produces are garbage. # * Support for accented letters in Latin1 returned back. # # 1.0e * Now all fonts in subdirectory named after current locale's charset # will unconditionally replace the ones read from "standard fonts" # folder. # * Use original algorith for remapping glyphs in GR_Graphics::remapGlyph # if Unicode character has no corresponding one in current locale's # charset (rather than replacing it with '?'). This is # extremely important for experimental lists code. Sorry for so silly # bug. # 1.0d # * In previous version of the patch, I've forgot to include diff # for Makefile.abi. Fixed. # # 1.0c # * Fixed problem with $LANG=en (it was due to bug in glibc). # * Fixed t[gb]z_install.sh - now they will generate the wrapper # properly. # * Made UT_is{lower,upper,alpha} and UT_tolower unicode-safe and wokring. # * Fixed charset recoding of data passed to ispell submodule. Now # spellchecking works wonderfully for russian too (and should work # for any language). Added support for storing information about # dictionary's charset via "-encoding" file (the file with name of # dictionary with "-encoding" appended is looked for, if it exists # its content is treated as the name of charset of this dictionary). # * Fixed 1 typo in russian stringset. # * Nothing new on the Windows front. # # 1.0b First public release. The known bug is wrong behaviour for $LANG=en. # Will be fixed soon. I didn't even try to compile all this on Windows. # diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/ev/unix/ev_UnixKeyboard.cpp abi-0.7.11/abi-0.7.11/src/af/ev/unix/ev_UnixKeyboard.cpp --- abi-0.7.11-orig/abi-0.7.11/src/af/ev/unix/ev_UnixKeyboard.cpp Thu Mar 2 21:52:05 2000 +++ abi-0.7.11/abi-0.7.11/src/af/ev/unix/ev_UnixKeyboard.cpp Thu Sep 28 01:20:12 2000 @@ -30,6 +30,9 @@ #include "ev_NamedVirtualKey.h" #include "ev_UnixKeyboard.h" +#include "xap_App.h" +#include "xap_EncodingManager.h" + ////////////////////////////////////////////////////////////////// static EV_EditBits s_mapVirtualKeyCodeToNVK(gint keyval); @@ -121,7 +124,30 @@ } else { - UT_uint16 charData = e->keyval; + UT_uint16 charData = 0; + + if (e->length==0) /* shouldn't happen. But let it crash somewhere else.*/ + charData = e->keyval; + else + { + GdkWChar wc; + if ( (state & EV_EMS_CONTROL) || (state & EV_EMS_ALT)) + { + charData = e->keyval; + } + else { + if (e->length==1) + /* straightforward */ + wc = (unsigned char)(*e->string); + else + { + int ret = gdk_mbstowcs(&wc,e->string,1); + UT_ASSERT(ret==1); + }; + charData = XAP_App::getApp()->getEncodingManager()->nativeToU(wc); + } + } + result = m_pEEM->Keystroke(EV_EKP_PRESS|state|charData,&pEM); switch (result) @@ -389,12 +415,6 @@ if (keyval == 0x0020) // special handling for ASCII-Space return UT_TRUE; - // TODO for now, verify Latin-1 - // TODO we don't currently know what to - // TODO do with the other character sets. - - UT_ASSERT(keyval <= 0x00FF); - return UT_FALSE; } diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/ev/xp/ev_EditBinding.cpp abi-0.7.11/abi-0.7.11/src/af/ev/xp/ev_EditBinding.cpp --- abi-0.7.11-orig/abi-0.7.11/src/af/ev/xp/ev_EditBinding.cpp Sat Jul 22 23:51:36 2000 +++ abi-0.7.11/abi-0.7.11/src/af/ev/xp/ev_EditBinding.cpp Thu Sep 28 01:20:43 2000 @@ -190,11 +190,20 @@ return 0; // no bindings of anykind for non-nvk keys UT_uint32 n_evk = EV_EVK_ToNumber(eb); - if (n_evk >= 257) - { - n_evk = n_evk - 65280; // quick fix - } - UT_ASSERT(n_evk < 256); // TODO see note [1] above. + if (n_evk >= 257) + { + if ( n_evk >= 257 && (n_evk - 65280) < 256) + n_evk -= 65280; // quick fix + else + { + n_evk = 'a'; + /* in hopes that there will be + 'insertData' method assigned to + plain 'a' + */ + } + }; + UT_uint32 n_ems = EV_EMS_ToNumberNoShift(eb); return m_pebChar->m_peb[n_evk][n_ems]; } diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/gr/xp/gr_Graphics.cpp abi-0.7.11/abi-0.7.11/src/af/gr/xp/gr_Graphics.cpp --- abi-0.7.11-orig/abi-0.7.11/src/af/gr/xp/gr_Graphics.cpp Thu Sep 7 23:37:12 2000 +++ abi-0.7.11/abi-0.7.11/src/af/gr/xp/gr_Graphics.cpp Thu Oct 5 14:30:13 2000 @@ -22,6 +22,7 @@ #include #include "xap_App.h" +#include "xap_EncodingManager.h" #include "xap_Prefs.h" #include "gr_Graphics.h" #include "ut_assert.h" @@ -104,9 +105,13 @@ return stringWidth; } -UT_UCSChar GR_Graphics::remapGlyph(const UT_UCSChar actual, UT_Bool noMatterWhat) +UT_UCSChar GR_Graphics::remapGlyph(const UT_UCSChar actual_, UT_Bool noMatterWhat) { - + UT_UCSChar actual = m_pApp->getEncodingManager()->try_UToNative(actual_); + if (!actual) + actual = actual_;/*code below may have an idea what to do with it*/ + + // Here is how the remapGlyph works. // * If preference value RemapGlyphsMasterSwitch is not true, no @@ -213,7 +218,8 @@ UT_Bool try_default = UT_TRUE; for (UT_uint32 tdex=0; tdex= 256) return c; /* Unicode but not Latin-1 - don't know what to do */ if (c >= 0xC0 && c <= 0xDE && c != 0xD7) /* uppercase Latin-1 chars */ return c + 0x20; return c; +#else + /*let's trust libc!*/ + UT_UCSChar local = XAP_EncodingManager::instance->try_UToNative(c); + if (!local) + return c; + local = XAP_EncodingManager::instance->try_UToNative(tolower(local)); + return local ? local : c; +#endif } @@ -927,3 +937,21 @@ } return (result); } + +UT_Bool UT_UCS_isupper(UT_UCSChar c) +{ + UT_UCSChar local = XAP_EncodingManager::instance->try_UToNative(c); + return local ? isupper(local)!=0 : 0; +}; + +UT_Bool UT_UCS_islower(UT_UCSChar c) +{ + UT_UCSChar local = XAP_EncodingManager::instance->try_UToNative(c); + return local ? islower(local)!=0 : 0; +}; + +UT_Bool UT_UCS_isalpha(UT_UCSChar c) +{ + UT_UCSChar local = XAP_EncodingManager::instance->try_UToNative(c); + return local ? isalpha(local)!=0 : 0; +}; diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/util/xp/ut_string.h abi-0.7.11/abi-0.7.11/src/af/util/xp/ut_string.h --- abi-0.7.11-orig/abi-0.7.11/src/af/util/xp/ut_string.h Thu Aug 31 23:52:54 2000 +++ abi-0.7.11/abi-0.7.11/src/af/util/xp/ut_string.h Tue Oct 3 19:12:48 2000 @@ -98,9 +98,16 @@ UT_Bool UT_isSmartQuotedCharacter(UT_UCSChar c); #define UT_UCS_isdigit(x) (((x) >= '0') && ((x) <= '9')) // TODO: make UNICODE-wise +#if 0 #define UT_UCS_isupper(x) (((x) >= 'A') && ((x) <= 'Z')) // HACK: not UNICODE-safe #define UT_UCS_islower(x) (((x) >= 'a') && ((x) <= 'z')) // HACK: not UNICODE-safe #define UT_UCS_isalpha(x) (UT_UCS_isupper(x) || UT_UCS_islower(x)) // HACK: not UNICODE-safe +#else + /*these are unicode-safe*/ +UT_Bool UT_UCS_isupper(UT_UCSChar c); +UT_Bool UT_UCS_islower(UT_UCSChar c); +UT_Bool UT_UCS_isalpha(UT_UCSChar c); +#endif #define UT_UCS_isalnum(x) (UT_UCS_isalpha(x) || UT_UCS_isdigit(x)) // HACK: not UNICODE-safe #define UT_UCS_isspace(x) (((x)==' '||((x)=='\r')||((x)=='\n')||((x)=='\t')||((x)=='\f'))) // HACK: not UNICODE safe #define UT_UCS_ispunct(x) ((!UT_UCS_isspace(x) && !UT_UCS_isalnum(x) && (x)>' ')) // HACK: not UNICODE safe diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/xap/Makefile abi-0.7.11/abi-0.7.11/src/af/xap/Makefile --- abi-0.7.11-orig/abi-0.7.11/src/af/xap/Makefile Tue Aug 1 09:23:33 2000 +++ abi-0.7.11/abi-0.7.11/src/af/xap/Makefile Mon Sep 25 20:23:42 2000 @@ -54,7 +54,8 @@ $(OBJDIR)/xap_$(ABI_FE)PSGenerate.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_$(ABI_FE)PSParseAFM.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_$(ABI_FE)PSImage.$(OBJ_SUFFIX) \ - $(OBJDIR)/xap_$(ABI_FE)PSGraphics.$(OBJ_SUFFIX) + $(OBJDIR)/xap_$(ABI_FE)PSGraphics.$(OBJ_SUFFIX) \ + $(OBJDIR)/xap_$(ABI_FE)EncodingManager.$(OBJ_SUFFIX) endif ifeq ($(ABI_FE), Win32) @@ -101,7 +102,8 @@ $(OBJDIR)/xap_Strings.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_Toolbar_ControlFactory.$(OBJ_SUFFIX) \ $(OBJDIR)/xap_ViewListener.$(OBJ_SUFFIX) \ - $(OBJDIR)/xav_View.$(OBJ_SUFFIX) + $(OBJDIR)/xav_View.$(OBJ_SUFFIX) \ + $(OBJDIR)/xap_EncodingManager.$(OBJ_SUFFIX) include $(ABI_ROOT)/src/config/abi_rules.mk diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/Makefile abi-0.7.11/abi-0.7.11/src/af/xap/unix/Makefile --- abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/Makefile Tue Jun 6 12:30:39 2000 +++ abi-0.7.11/abi-0.7.11/src/af/xap/unix/Makefile Mon Sep 25 19:42:47 2000 @@ -45,7 +45,8 @@ xap_UnixPSGenerate.cpp \ xap_UnixPSParseAFM.cpp \ xap_UnixPSImage.cpp \ - xap_UnixPSGraphics.cpp + xap_UnixPSGraphics.cpp \ + xap_UnixEncodingManager.cpp TARGETS= $(OBJS) INCLUDES= -I/usr/X11R6/include diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/xap_UnixApp.cpp abi-0.7.11/abi-0.7.11/src/af/xap/unix/xap_UnixApp.cpp --- abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/xap_UnixApp.cpp Fri Aug 18 04:46:00 2000 +++ abi-0.7.11/abi-0.7.11/src/af/xap/unix/xap_UnixApp.cpp Mon Oct 2 11:26:37 2000 @@ -38,6 +38,7 @@ #include "xap_UnixToolbar_Icons.h" #include "xap_Unix_TB_CFactory.h" #include "xap_Prefs.h" +#include "xap_UnixEncodingManager.h" /*****************************************************************/ @@ -58,6 +59,8 @@ // specify a --geometry argument, we only want to obey the // size (which is set above), not a position. m_geometry.flags = GEOMETRY_FLAG_SIZE; + DELETEP(m_pEncMgr); + m_pEncMgr = new XAP_UnixEncodingManager(); } XAP_UnixApp::~XAP_UnixApp(void) diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/xap_UnixDlg_FontChooser.cpp abi-0.7.11/abi-0.7.11/src/af/xap/unix/xap_UnixDlg_FontChooser.cpp --- abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/xap_UnixDlg_FontChooser.cpp Thu Jul 27 09:15:21 2000 +++ abi-0.7.11/abi-0.7.11/src/af/xap/unix/xap_UnixDlg_FontChooser.cpp Sun Oct 1 17:10:16 2000 @@ -303,28 +303,25 @@ windowFontSelection = gtk_window_new (GTK_WINDOW_DIALOG); gtk_object_set_data (GTK_OBJECT (windowFontSelection), "windowFontSelection", windowFontSelection); gtk_window_set_title (GTK_WINDOW (windowFontSelection), pSS->getValue(XAP_STRING_ID_DLG_UFS_FontTitle)); - gtk_window_set_policy (GTK_WINDOW (windowFontSelection), FALSE, FALSE, FALSE); + gtk_window_set_policy (GTK_WINDOW (windowFontSelection), FALSE, TRUE, FALSE); vboxOuter = gtk_vbox_new (FALSE, 0); gtk_object_set_data (GTK_OBJECT (windowFontSelection), "vboxOuter", vboxOuter); gtk_widget_show (vboxOuter); gtk_container_add (GTK_CONTAINER (windowFontSelection), vboxOuter); - gtk_widget_set_usize (vboxOuter, 469, -1); vboxMain = constructWindowContents(GTK_OBJECT (windowFontSelection)); - gtk_box_pack_start (GTK_BOX (vboxOuter), vboxMain, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vboxOuter), vboxMain, TRUE, TRUE, 0); fixedButtons = gtk_fixed_new (); gtk_object_set_data (GTK_OBJECT (windowFontSelection), "fixedButtons", fixedButtons); gtk_widget_show (fixedButtons); gtk_box_pack_start (GTK_BOX (vboxOuter), fixedButtons, FALSE, TRUE, 0); - gtk_widget_set_usize (fixedButtons, -1, 43); buttonOK = gtk_button_new_with_label (pSS->getValue(XAP_STRING_ID_DLG_OK)); gtk_object_set_data (GTK_OBJECT (windowFontSelection), "buttonOK", buttonOK); gtk_widget_show (buttonOK); gtk_fixed_put (GTK_FIXED (fixedButtons), buttonOK, 279, 0); - gtk_widget_set_usize (buttonOK, 85, 35); //extra height for "default" border; it's silly GTK_WIDGET_SET_FLAGS (buttonOK, GTK_CAN_DEFAULT); gtk_widget_grab_default (buttonOK); @@ -332,7 +329,6 @@ gtk_object_set_data (GTK_OBJECT (windowFontSelection), "buttonCancel", buttonCancel); gtk_widget_show (buttonCancel); gtk_fixed_put (GTK_FIXED (fixedButtons), buttonCancel, 374, 6); - gtk_widget_set_usize (buttonCancel, 85, 24); gtk_signal_connect_after(GTK_OBJECT(windowFontSelection), "destroy", @@ -393,61 +389,158 @@ vboxMain = gtk_vbox_new (FALSE, 0); gtk_object_set_data (parent, "vboxMain", vboxMain); gtk_widget_show (vboxMain); - gtk_widget_set_usize (vboxMain, 469, -1); notebookMain = gtk_notebook_new (); gtk_object_set_data (parent, "notebookMain", notebookMain); gtk_widget_show (notebookMain); - gtk_box_pack_start (GTK_BOX (vboxMain), notebookMain, FALSE, FALSE, 0); - gtk_widget_set_usize (notebookMain, 418, 247); + gtk_box_pack_start (GTK_BOX (vboxMain), notebookMain, 1, 1, 0); gtk_container_set_border_width (GTK_CONTAINER (notebookMain), 8); - fixedFont = gtk_fixed_new (); - gtk_object_set_data (parent, "fixedFont", fixedFont); - gtk_widget_show (fixedFont); - gtk_container_add (GTK_CONTAINER (notebookMain), fixedFont); - gtk_widget_set_usize (fixedFont, -1, 191); + GtkObject *window1 = parent; + GtkWidget *table1; + GtkWidget *vbox1; + + GtkWidget *scrolledwindow1; + GtkWidget *vbox2; + GtkWidget *scrolledwindow2; + GtkWidget *vbox3; + GtkWidget *scrolledwindow3; + GtkWidget *vboxmisc; + GtkWidget *hboxForEncoding; + + table1 = gtk_table_new (2, 3, FALSE); + gtk_widget_set_name (table1, "table1"); + gtk_widget_ref (table1); + gtk_object_set_data_full (GTK_OBJECT (window1), "table1", table1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (table1); + gtk_container_add (GTK_CONTAINER (notebookMain), table1); + + vbox1 = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (vbox1, "vbox1"); + gtk_widget_ref (vbox1); + gtk_object_set_data_full (GTK_OBJECT (window1), "vbox1", vbox1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (vbox1); + gtk_table_attach (GTK_TABLE (table1), vbox1, 0, 1, 0, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); labelFont = gtk_label_new (pSS->getValue(XAP_STRING_ID_DLG_UFS_FontLabel)); - gtk_object_set_data (parent, "labelFont", labelFont); + gtk_widget_set_name (labelFont, "labelFont"); + gtk_widget_ref (labelFont); + gtk_object_set_data_full (GTK_OBJECT (window1), "labelFont", labelFont, + (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (labelFont); - gtk_fixed_put (GTK_FIXED (fixedFont), labelFont, 5, 8); - gtk_widget_set_usize (labelFont, 34, 16); + gtk_box_pack_start (GTK_BOX (vbox1), labelFont, FALSE, FALSE, 0); + + scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_set_name (scrolledwindow1, "scrolledwindow1"); + gtk_widget_ref (scrolledwindow1); + gtk_object_set_data_full (GTK_OBJECT (window1), "scrolledwindow1", scrolledwindow1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (scrolledwindow1); + gtk_box_pack_start (GTK_BOX (vbox1), scrolledwindow1, TRUE, TRUE, 0); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow1), 3); + + listFonts = gtk_clist_new (1); + gtk_widget_set_name (listFonts, "listFonts"); + gtk_widget_ref (listFonts); + gtk_object_set_data_full (GTK_OBJECT (window1), "listFonts", listFonts, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (listFonts); + gtk_container_add (GTK_CONTAINER (scrolledwindow1), listFonts); + gtk_clist_set_column_auto_resize (GTK_CLIST(listFonts), 0, TRUE); + + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (vbox2, "vbox2"); + gtk_widget_ref (vbox2); + gtk_object_set_data_full (GTK_OBJECT (window1), "vbox2", vbox2, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (vbox2); + gtk_table_attach (GTK_TABLE (table1), vbox2, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); labelStyle = gtk_label_new (pSS->getValue(XAP_STRING_ID_DLG_UFS_StyleLabel)); - gtk_object_set_data (parent, "labelStyle", labelStyle); + gtk_widget_set_name (labelStyle, "labelStyle"); + gtk_widget_ref (labelStyle); + gtk_object_set_data_full (GTK_OBJECT (window1), "labelStyle", labelStyle, + (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (labelStyle); - gtk_fixed_put (GTK_FIXED (fixedFont), labelStyle, 209, 8); - gtk_widget_set_usize (labelStyle, 34, 16); + gtk_box_pack_start (GTK_BOX (vbox2), labelStyle, FALSE, FALSE, 0); - frameFonts = gtk_scrolled_window_new(NULL, NULL); - gtk_object_set_data(parent, "frameFonts", frameFonts); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(frameFonts), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); - gtk_fixed_put(GTK_FIXED(fixedFont), frameFonts, 8, 24); - gtk_widget_set_usize(frameFonts, 195, 167); - gtk_widget_show(frameFonts); + scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_set_name (scrolledwindow2, "scrolledwindow2"); + gtk_widget_ref (scrolledwindow2); + gtk_object_set_data_full (GTK_OBJECT (window1), "scrolledwindow2", scrolledwindow2, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (scrolledwindow2); + gtk_box_pack_start (GTK_BOX (vbox2), scrolledwindow2, TRUE, TRUE, 0); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_NEVER, GTK_POLICY_NEVER); + gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow2), 3); - listFonts = gtk_clist_new (1); - gtk_object_set_data (parent, "listFonts", listFonts); - gtk_clist_set_selection_mode (GTK_CLIST(listFonts), GTK_SELECTION_SINGLE); - gtk_clist_set_shadow_type (GTK_CLIST(listFonts), GTK_SHADOW_IN); + listStyles = gtk_clist_new (1); + gtk_widget_set_name (listStyles, "listStyles"); + gtk_widget_ref (listStyles); + gtk_object_set_data_full (GTK_OBJECT (window1), "listStyles", listStyles, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (listStyles); + gtk_container_add (GTK_CONTAINER (scrolledwindow2), listStyles); gtk_clist_set_column_auto_resize (GTK_CLIST(listFonts), 0, TRUE); - gtk_widget_show (listFonts); - gtk_container_add (GTK_CONTAINER (frameFonts), listFonts); + + vbox3 = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (vbox3, "vbox3"); + gtk_widget_ref (vbox3); + gtk_object_set_data_full (GTK_OBJECT (window1), "vbox3", vbox3, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (vbox3); + gtk_table_attach (GTK_TABLE (table1), vbox3, 2, 3, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); labelSize = gtk_label_new (pSS->getValue(XAP_STRING_ID_DLG_UFS_SizeLabel)); - gtk_object_set_data (parent, "labelSize", labelSize); + gtk_widget_set_name (labelSize, "labelSize"); + gtk_widget_ref (labelSize); + gtk_object_set_data_full (GTK_OBJECT (window1), "labelSize", labelSize, + (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (labelSize); - gtk_fixed_put (GTK_FIXED (fixedFont), labelSize, 356, 8); - gtk_widget_set_usize (labelSize, 50, 16); + gtk_box_pack_start (GTK_BOX (vbox3), labelSize, FALSE, FALSE, 0); - /*************************************/ + scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_set_name (scrolledwindow3, "scrolledwindow3"); + gtk_widget_ref (scrolledwindow3); + gtk_object_set_data_full (GTK_OBJECT (window1), "scrolledwindow3", scrolledwindow3, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (scrolledwindow3); + gtk_box_pack_start (GTK_BOX (vbox3), scrolledwindow3, TRUE, TRUE, 0); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow3), 3); + listSizes = gtk_clist_new (1); + gtk_widget_set_name (listSizes, "listSizes"); + gtk_widget_ref (listSizes); + gtk_object_set_data_full (GTK_OBJECT (window1), "listSizes", listSizes, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (listSizes); + gtk_container_add (GTK_CONTAINER (scrolledwindow3), listSizes); + gtk_clist_set_column_auto_resize (GTK_CLIST(listFonts), 0, TRUE); + + vboxmisc = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (vboxmisc, "vboxmisc"); + gtk_widget_ref (vboxmisc); + gtk_object_set_data_full (GTK_OBJECT (window1), "vboxmisc", vboxmisc, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (vboxmisc); + gtk_table_attach (GTK_TABLE (table1), vboxmisc, 1, 3, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + frameEffects = gtk_frame_new (pSS->getValue(XAP_STRING_ID_DLG_UFS_EffectsFrameLabel)); gtk_object_set_data (parent, "frameEffects", frameEffects); gtk_widget_show (frameEffects); - gtk_fixed_put (GTK_FIXED (fixedFont), frameEffects, 216, 117); - gtk_widget_set_usize (frameEffects, 225, 45); + gtk_box_pack_start(GTK_BOX (vboxmisc), frameEffects, 0,0, 2); hboxDecorations = gtk_hbox_new (FALSE, 0); gtk_object_set_data (parent, "hboxDecorations", hboxDecorations); @@ -466,21 +559,26 @@ gtk_widget_show (checkbuttonUnderline); gtk_box_pack_start (GTK_BOX (hboxDecorations), checkbuttonUnderline, TRUE, TRUE, 0); - /*************************************/ + hboxForEncoding = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (hboxForEncoding, "hboxForEncoding"); + gtk_widget_ref (hboxForEncoding); + gtk_object_set_data_full (GTK_OBJECT (window1), "hboxForEncoding", hboxForEncoding, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (hboxForEncoding); + gtk_box_pack_start (GTK_BOX (vboxmisc), hboxForEncoding, TRUE, TRUE, 0); + labelEncoding = gtk_label_new (pSS->getValue(XAP_STRING_ID_DLG_UFS_EncodingLabel)); gtk_object_set_data (parent, "labelEncoding", labelEncoding); gtk_widget_show (labelEncoding); - gtk_fixed_put (GTK_FIXED (fixedFont), labelEncoding, 216, 170); - gtk_widget_set_usize (labelEncoding, 70, 22); + gtk_box_pack_start (GTK_BOX (hboxForEncoding), labelEncoding, 1,1, 2); gtk_label_set_justify (GTK_LABEL (labelEncoding), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (labelEncoding), 0, 0.5); - + comboEncoding = gtk_combo_new (); gtk_object_set_data (parent, "comboEncoding", comboEncoding); gtk_widget_show (comboEncoding); - gtk_fixed_put (GTK_FIXED (fixedFont), comboEncoding, 290, 170); - gtk_widget_set_usize (GTK_WIDGET (comboEncoding), 150, 22); + gtk_box_pack_start(GTK_BOX (hboxForEncoding), comboEncoding, 1, 1, 0); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (GTK_COMBO (comboEncoding)->popup), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); @@ -493,50 +591,11 @@ // comboEncoding_items = g_list_append (comboEncoding_items, "These Are Bogus"); gtk_combo_set_popdown_strings (GTK_COMBO (comboEncoding), comboEncoding_items); g_list_free (comboEncoding_items); - - /*************************************/ - - frameStyle = gtk_scrolled_window_new(NULL, NULL); - gtk_object_set_data(parent, "frameStyle", frameStyle); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(frameStyle), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); - gtk_fixed_put(GTK_FIXED(fixedFont), frameStyle, 216, 24); - gtk_widget_set_usize(frameStyle, 126, 85); - gtk_widget_show(frameStyle); - - listStyles = gtk_clist_new (1); - gtk_object_set_data (parent, "listStyles", listStyles); - gtk_clist_set_selection_mode (GTK_CLIST(listStyles), GTK_SELECTION_SINGLE); - gtk_clist_set_shadow_type (GTK_CLIST(listStyles), GTK_SHADOW_IN); - gtk_clist_set_column_auto_resize (GTK_CLIST(listStyles), 0, TRUE); - gtk_widget_show (listStyles); - gtk_container_add (GTK_CONTAINER (frameStyle), listStyles); - - frameSize = gtk_scrolled_window_new(NULL, NULL); - gtk_object_set_data(parent, "frameSize", frameSize); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(frameSize), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); - gtk_fixed_put(GTK_FIXED(fixedFont), frameSize, 356, 24); - gtk_widget_set_usize(frameSize, 84, 85); - gtk_widget_show(frameSize); - - listSizes = gtk_clist_new (1); - gtk_object_set_data (parent, "listSizes", listSizes); - gtk_clist_set_selection_mode (GTK_CLIST(listSizes), GTK_SELECTION_SINGLE); - gtk_clist_set_shadow_type (GTK_CLIST(listSizes), GTK_SHADOW_IN); - gtk_clist_set_column_auto_resize (GTK_CLIST(listSizes), 0, TRUE); - gtk_widget_show (listSizes); - gtk_container_add (GTK_CONTAINER (frameSize), listSizes); - - fixedColor = gtk_fixed_new (); - gtk_object_set_data (parent, "fixedColor", fixedColor); - gtk_widget_show (fixedColor); - gtk_container_add (GTK_CONTAINER (notebookMain), fixedColor); - gtk_widget_set_usize (fixedColor, 421, 187); - + /*another Notebook page*/ hbox1 = gtk_hbox_new (FALSE, 0); gtk_object_set_data (parent, "hbox1", hbox1); gtk_widget_show (hbox1); - gtk_fixed_put (GTK_FIXED (fixedColor), hbox1, 8, 10); - gtk_widget_set_usize (hbox1, 426, 186); + gtk_container_add (GTK_CONTAINER (notebookMain),hbox1); colorSelector = gtk_color_selection_new (); gtk_object_set_data (parent, "colorSelector", colorSelector); @@ -553,10 +612,11 @@ gtk_widget_show (labelTabColor); set_notebook_tab (notebookMain, 1, labelTabColor); + /* frame with preview */ frame4 = gtk_frame_new (NULL); gtk_object_set_data (parent, "frame4", frame4); gtk_widget_show (frame4); - gtk_box_pack_start (GTK_BOX (vboxMain), frame4, FALSE, TRUE, PREVIEW_BOX_BORDER_WIDTH_PIXELS); + gtk_box_pack_start (GTK_BOX (vboxMain), frame4, FALSE, FALSE, PREVIEW_BOX_BORDER_WIDTH_PIXELS); // setting the height takes into account the border applied on all // sides, so we need to double the single border width gtk_widget_set_usize (frame4, -1, PREVIEW_BOX_HEIGHT_PIXELS + (PREVIEW_BOX_BORDER_WIDTH_PIXELS * 2)); diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/xap_UnixDlg_Zoom.cpp abi-0.7.11/abi-0.7.11/src/af/xap/unix/xap_UnixDlg_Zoom.cpp --- abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/xap_UnixDlg_Zoom.cpp Sat Jul 8 04:46:48 2000 +++ abi-0.7.11/abi-0.7.11/src/af/xap/unix/xap_UnixDlg_Zoom.cpp Sun Oct 1 13:59:32 2000 @@ -411,7 +411,10 @@ gtk_object_set_data (GTK_OBJECT (windowZoom), "frameSampleText", frameSampleText); gtk_widget_show (frameSampleText); gtk_container_add (GTK_CONTAINER (framePreview), frameSampleText); +#if 0 + /*setting size of 'frameSampleText' makes no sense - VH*/ gtk_widget_set_usize (frameSampleText, 221, 97); +#endif gtk_container_border_width (GTK_CONTAINER (frameSampleText), 10); // *** This is how we do a preview widget *** diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/xap_UnixEncodingManager.cpp abi-0.7.11/abi-0.7.11/src/af/xap/unix/xap_UnixEncodingManager.cpp --- abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/xap_UnixEncodingManager.cpp Thu Jan 1 04:00:00 1970 +++ abi-0.7.11/abi-0.7.11/src/af/xap/unix/xap_UnixEncodingManager.cpp Wed Oct 4 00:16:10 2000 @@ -0,0 +1,426 @@ +#include "xap_UnixEncodingManager.h" +#include "ut_debugmsg.h" +#include "ut_string.h" +#include +#include + +/* We source this file in order not to replace symbols in gnome-libs. + (if AW is linked with GNOME). +*/ + +/* Only this function is used. For $LANG=ru_RU.KOI8-R it returns the following + list: + + ru_RU.KOI8-R + ru_RU + ru.KOI8-R + ru + C + "" + + It's much more powerfull (gives correct result) than plain setlocale since + it explicitly reads locale aliases. +*/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +const GList * +g_i18n_get_language_list (const gchar *category_name); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +/* + * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation + * All rights reserved. + * + * This file is part of the Gnome Library. + * + * The Gnome Library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * The Gnome Library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with the Gnome Library; see the file COPYING.LIB. If not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +#include + +static GHashTable *alias_table = NULL; +static GHashTable *category_table= NULL; + +/*read an alias file for the locales*/ +static void +read_aliases (char *file) +{ + FILE *fp; + char buf[256]; + if (!alias_table) + alias_table = g_hash_table_new (g_str_hash, g_str_equal); + fp = fopen (file,"r"); + if (!fp) + return; + while (fgets (buf,256,fp)) + { + char *p; + g_strstrip(buf); + if (buf[0]=='#' || buf[0]=='\0') + continue; + p = strtok (buf,"\t "); + if (!p) + continue; + p = strtok (NULL,"\t "); + if(!p) + continue; + if (!g_hash_table_lookup (alias_table, buf)) + g_hash_table_insert (alias_table, g_strdup(buf), g_strdup(p)); + } + fclose (fp); +} + +/*return the un-aliased language as a newly allocated string*/ +static char * +unalias_lang (char *lang) +{ + char *p; + int i; + if (!alias_table) + { + read_aliases ("/usr/share/locale/locale.alias"); + read_aliases ("/usr/local/share/locale/locale.alias"); + read_aliases ("/usr/lib/X11/locale/locale.alias"); + read_aliases ("/usr/openwin/lib/locale/locale.alias"); + } + i = 0; + while ((p=(char*)g_hash_table_lookup(alias_table,lang)) && strcmp(p, lang)) + { + lang = p; + if (i++ == 30) + { + static gboolean said_before = FALSE; + if (!said_before) + g_warning ("Too many alias levels for a locale, " + "may indicate a loop"); + said_before = TRUE; + return lang; + } + } + return lang; +} + +/* Mask for components of locale spec. The ordering here is from + * least significant to most significant + */ +enum +{ + COMPONENT_CODESET = 1 << 0, + COMPONENT_TERRITORY = 1 << 1, + COMPONENT_MODIFIER = 1 << 2 +}; + +/* Break an X/Open style locale specification into components + */ +static guint +explode_locale (const gchar *locale, + gchar **language, + gchar **territory, + gchar **codeset, + gchar **modifier) +{ + const gchar *uscore_pos; + const gchar *at_pos; + const gchar *dot_pos; + + guint mask = 0; + + uscore_pos = strchr (locale, '_'); + dot_pos = strchr (uscore_pos ? uscore_pos : locale, '.'); + at_pos = strchr (dot_pos ? dot_pos : (uscore_pos ? uscore_pos : locale), '@'); + + if (at_pos) + { + mask |= COMPONENT_MODIFIER; + *modifier = g_strdup (at_pos); + } + else + at_pos = locale + strlen (locale); + + if (dot_pos) + { + mask |= COMPONENT_CODESET; + *codeset = g_new (gchar, 1 + at_pos - dot_pos); + strncpy (*codeset, dot_pos, at_pos - dot_pos); + (*codeset)[at_pos - dot_pos] = '\0'; + } + else + dot_pos = at_pos; + + if (uscore_pos) + { + mask |= COMPONENT_TERRITORY; + *territory = g_new (gchar, 1 + dot_pos - uscore_pos); + strncpy (*territory, uscore_pos, dot_pos - uscore_pos); + (*territory)[dot_pos - uscore_pos] = '\0'; + } + else + uscore_pos = dot_pos; + + *language = g_new (gchar, 1 + uscore_pos - locale); + strncpy (*language, locale, uscore_pos - locale); + (*language)[uscore_pos - locale] = '\0'; + + return mask; +} + +/* + * Compute all interesting variants for a given locale name - + * by stripping off different components of the value. + * + * For simplicity, we assume that the locale is in + * X/Open format: language[_territory][.codeset][@modifier] + * + * TODO: Extend this to handle the CEN format (see the GNUlibc docs) + * as well. We could just copy the code from glibc wholesale + * but it is big, ugly, and complicated, so I'm reluctant + * to do so when this should handle 99% of the time... + */ +static GList * +compute_locale_variants (const gchar *locale) +{ + GList *retval = NULL; + + gchar *language; + gchar *territory; + gchar *codeset; + gchar *modifier; + + guint mask; + guint i; + + g_return_val_if_fail (locale != NULL, NULL); + + mask = explode_locale (locale, &language, &territory, &codeset, &modifier); + + /* Iterate through all possible combinations, from least attractive + * to most attractive. + */ + for (i=0; i<=mask; i++) + if ((i & ~mask) == 0) + { + gchar *val = g_strconcat(language, + (i & COMPONENT_TERRITORY) ? territory : "", + (i & COMPONENT_CODESET) ? codeset : "", + (i & COMPONENT_MODIFIER) ? modifier : "", + NULL); + retval = g_list_prepend (retval, val); + } + + g_free (language); + if (mask & COMPONENT_CODESET) + g_free (codeset); + if (mask & COMPONENT_TERRITORY) + g_free (territory); + if (mask & COMPONENT_MODIFIER) + g_free (modifier); + + return retval; +} + +/* The following is (partly) taken from the gettext package. + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. */ + +static const gchar * +guess_category_value (const gchar *categoryname) +{ + const gchar *retval; + + /* The highest priority value is the `LANGUAGE' environment + variable. This is a GNU extension. */ + retval = g_getenv ("LANGUAGE"); + if (retval != NULL && retval[0] != '\0') + return retval; + + /* `LANGUAGE' is not set. So we have to proceed with the POSIX + methods of looking to `LC_ALL', `LC_xxx', and `LANG'. On some + systems this can be done by the `setlocale' function itself. */ + + /* Setting of LC_ALL overwrites all other. */ + retval = g_getenv ("LC_ALL"); + if (retval != NULL && retval[0] != '\0') + return retval; + + /* Next comes the name of the desired category. */ + retval = g_getenv (categoryname); + if (retval != NULL && retval[0] != '\0') + return retval; + + /* Last possibility is the LANG environment variable. */ + retval = g_getenv ("LANG"); + if (retval != NULL && retval[0] != '\0') + return retval; + + return NULL; +} + +/** + * g_i18n_get_language_list: + * @category_name: Name of category to look up, e.g. "LC_MESSAGES". + * + * This computes a list of language strings. It searches in the + * standard environment variables to find the list, which is sorted + * in order from most desirable to least desirable. The `C' locale + * is appended to the list if it does not already appear (other routines depend on this behaviour). + * If @category_name is %NULL, then LC_ALL is assumed. + * + * Return value: the list of languages, this list should not be freed as it is owned by gnome-i18n + **/ +const GList * +g_i18n_get_language_list (const gchar *category_name) +{ + GList *list; + + if (!category_name) + category_name= "LC_ALL"; + + if (category_table) + { + list= (GList *)g_hash_table_lookup (category_table, (const gpointer) category_name); + } + else + { + category_table= g_hash_table_new (g_str_hash, g_str_equal); + list= NULL; + } + + if (!list) + { + gint c_locale_defined= FALSE; + + const gchar *category_value; + gchar *category_memory, *orig_category_memory; + + category_value = guess_category_value (category_name); + if (! category_value) + category_value = "C"; + orig_category_memory = category_memory = + (gchar*) g_malloc (strlen (category_value)+1); + + while (category_value[0] != '\0') + { + while (category_value[0] != '\0' && category_value[0] == ':') + ++category_value; + + if (category_value[0] != '\0') + { + char *cp= category_memory; + + while (category_value[0] != '\0' && category_value[0] != ':') + *category_memory++= *category_value++; + + category_memory[0]= '\0'; + category_memory++; + + cp = unalias_lang(cp); + + if (strcmp (cp, "C") == 0) + c_locale_defined= TRUE; + + list= g_list_concat (list, compute_locale_variants (cp)); + } + } + + g_free (orig_category_memory); + + if (!c_locale_defined) + list= g_list_append (list, "C"); + + g_hash_table_insert (category_table, (gpointer) category_name, list); + } + + return list; +} + + +XAP_UnixEncodingManager::XAP_UnixEncodingManager() +{ + initialize(); +} + +XAP_UnixEncodingManager::~XAP_UnixEncodingManager() {} + +static const char* NativeEncodingName, *LanguageISOName, *LanguageISOTerritory; + +const char* XAP_UnixEncodingManager::getNativeEncodingName() const +{ return NativeEncodingName; }; + +const char* XAP_UnixEncodingManager::getLanguageISOName() const +{ return LanguageISOName; }; + +const char* XAP_UnixEncodingManager::getLanguageISOTerritory() const +{ return LanguageISOTerritory; }; + + +void XAP_UnixEncodingManager::initialize() +{ + const GList* lst = g_i18n_get_language_list ("LANG"); + const char* locname = (char*)lst->data; + + NativeEncodingName = "ISO-8859-1"; + LanguageISOName = "en"; + LanguageISOTerritory = "US"; + + if (!*locname || !strcmp(locname,"C")) + { /* paranoic case - broken system */ + ; /*already initialized*/ + } + else + { + char* lang,*terr,*cs,*mod; + int mask = explode_locale (locname,&lang,&terr,&cs,&mod); + LanguageISOName = lang; + if (mask & COMPONENT_TERRITORY) + { + LanguageISOTerritory = terr+1;/*yes, +1*/ + } + if (mask & COMPONENT_CODESET) + { + NativeEncodingName = cs+1; + if (!strncmp(cs+1,"ISO8859",strlen("ISO8859"))) { + /* + work around glibc bug - its iconv doesn't know + ISO8859-* - ISO-8859-1 should be used (we encounter this + since locale.alias aliases en_US.ISO8859-1 to 'en' + PS: This is true for my RH6.0 system - VH + */ + static char buf[40]; + strcpy(buf,"ISO-"); + strcat(buf,cs+1+3); + NativeEncodingName = buf; + } + + } + }; + XAP_EncodingManager::initialize(); + describe(); +}; + + diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/xap_UnixEncodingManager.h abi-0.7.11/abi-0.7.11/src/af/xap/unix/xap_UnixEncodingManager.h --- abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/xap_UnixEncodingManager.h Thu Jan 1 04:00:00 1970 +++ abi-0.7.11/abi-0.7.11/src/af/xap/unix/xap_UnixEncodingManager.h Mon Oct 2 13:04:26 2000 @@ -0,0 +1,20 @@ +#ifndef XAP_UNIXENCMGR_H +#define XAP_UNIXENCMGR_H + +#include "xap_EncodingManager.h" + +/* it's assumed that only one instance of this class will exist */ +class XAP_UnixEncodingManager: public XAP_EncodingManager +{ +public: + XAP_UnixEncodingManager(); + ~XAP_UnixEncodingManager(); + + const char* getNativeEncodingName() const; + const char* getLanguageISOName() const; + const char* getLanguageISOTerritory() const; + + void initialize(); +}; + +#endif /* XAP_UNIXENCMGR_H */ diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/xap_UnixFont.cpp abi-0.7.11/abi-0.7.11/src/af/xap/unix/xap_UnixFont.cpp --- abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/xap_UnixFont.cpp Tue Aug 1 09:23:33 2000 +++ abi-0.7.11/abi-0.7.11/src/af/xap/unix/xap_UnixFont.cpp Fri Oct 13 13:56:02 2000 @@ -31,6 +31,7 @@ #include "ut_dialogHelper.h" #include "xap_UnixFont.h" #include "xap_UnixFontXLFD.h" +#include "xap_EncodingManager.h" #define ASSERT_MEMBERS do { UT_ASSERT(m_name); UT_ASSERT(m_fontfile); UT_ASSERT(m_metricfile); } while (0) @@ -766,8 +767,14 @@ } m_uniWidths = (UT_uint16 *) malloc (sizeof (UT_uint16) * 256); memset (m_uniWidths, 0, 256 * sizeof(UT_uint16)); // Clear array - i would hope that sizeof(UT_uint16) == 16 - for (UT_sint32 i=0; i != m_metricsData->numOfChars; ++i) + if (XAP_EncodingManager::instance->try_nativeToU(0xa1)==0xa1) { + /* it's iso8859-1 or cp1252 encoding - glyphs in font are in wrong + order - we have to map them by name. + */ + for (UT_sint32 i=0; i != m_metricsData->numOfChars && i<256; ++i) + { + UT_sint32 unicode = -1; for (UT_uint32 j = 0; the_enc[j].type1_name != NULL; j++) { @@ -782,7 +789,21 @@ UT_ASSERT (unicode < 256); // TODO: support multibyte chars m_uniWidths[unicode] = m_metricsData->cmi[i].wx; } - } + } + } + else + { + /* it's non-latin1 encoding - we have to assume that order of + glyphs in font is correct. + */ + for (UT_sint32 i=0; i != m_metricsData->numOfChars && i<256; ++i) + { + if (m_metricsData->cmi[i].code<256 && m_metricsData->cmi[i].code>=0) + m_uniWidths[m_metricsData->cmi[i].code] = m_metricsData->cmi[i].wx; + + }; + }; + fclose(fp); diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/xap_UnixFontManager.cpp abi-0.7.11/abi-0.7.11/src/af/xap/unix/xap_UnixFontManager.cpp --- abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/xap_UnixFontManager.cpp Tue Jun 6 01:00:43 2000 +++ abi-0.7.11/abi-0.7.11/src/af/xap/unix/xap_UnixFontManager.cpp Thu Oct 5 14:41:45 2000 @@ -31,6 +31,7 @@ #include "xap_UnixApp.h" #include "xap_UnixFontManager.h" #include "xap_UnixFontXLFD.h" +#include "xap_EncodingManager.h" // TODO get this from some higher-level place @@ -61,20 +62,36 @@ UT_Bool XAP_UnixFontManager::scavengeFonts(void) { - UT_uint32 i = 0; + UT_uint32 i = 0, j; UT_uint32 count = m_searchPaths.getItemCount(); UT_uint32 totaldirs = 0; UT_uint32 totalfonts = 0; - for (i = 0; i < count; i++) + /* If j is even, we open fonts.dir in encoding-specific directory */ + for (j = 0; j < 2*count; j++) { - UT_ASSERT(m_searchPaths.getNthItem(i)); + i = j/2; + /* odd numbers mean should open encoding-specific directory*/ + UT_Bool encspecific = j & 1; - char * filename = (char *) calloc(strlen((char *) m_searchPaths.getNthItem(i)) + - strlen((char *) FONTS_DIR_FILE) + 1, sizeof(char)); + UT_ASSERT(m_searchPaths.getNthItem(i)); - sprintf(filename, "%s%s", (char *) m_searchPaths.getNthItem(i), FONTS_DIR_FILE); + char* basedirname = (char *) m_searchPaths.getNthItem(i); + int basedirname_len = strlen(basedirname); + char* filename; + + if (encspecific) + { + const char* encname = XAP_EncodingManager::instance->getNativeEncodingName(); + filename = (char *) calloc(basedirname_len + 1 + strlen(encname) + strlen((char *) FONTS_DIR_FILE) + 1, sizeof(char)); + sprintf(filename, "%s/%s%s", basedirname , encname ,FONTS_DIR_FILE); + } + else + { + filename = (char *) calloc(basedirname_len + strlen((char *) FONTS_DIR_FILE) + 1, sizeof(char)); + sprintf(filename, "%s%s", basedirname , FONTS_DIR_FILE); + } FILE * file; @@ -112,6 +129,10 @@ UT_DEBUGMSG(("File says %d fonts should follow...\n", fontcount)); } #endif + + char* lastslash = strrchr(filename,'/'); + if (lastslash) + *lastslash = '\0'; // every line after is a font name / XLFD pair UT_sint32 line; @@ -130,8 +151,7 @@ fclose(file); return UT_TRUE; } - _allocateThisFont((const char *) buffer, - (const char *) m_searchPaths.getNthItem(i)); + _allocateThisFont((const char *) buffer, filename); } totalfonts += line; @@ -434,9 +454,24 @@ FREEP(linedup); } -void XAP_UnixFontManager::_addFont(XAP_UnixFont * font) +void XAP_UnixFontManager::_addFont(XAP_UnixFont * newfont) { // we index fonts by a combined "name" and "style" - - m_fontHash.addEntry(font->getFontKey(), NULL, (void *) font); + const char* fontkey = newfont->getFontKey(); + UT_HashEntry* curfont_entry = m_fontHash.findEntry(fontkey); + if (!curfont_entry || !curfont_entry->pData) + { + m_fontHash.addEntry(fontkey, NULL, (void *) newfont); + } else { + /* + since "standard fonts" folder is read first and then + current charset-specific subdirectory, it's obvious that + the recent version is current charset-specific font, + so we replace original font (that is standard) + unconditionally. + */ + XAP_UnixFont* curfont = static_cast(curfont_entry->pData); + delete curfont; + curfont_entry->pData = (void*)newfont; + } } diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/xap_UnixPSGenerate.cpp abi-0.7.11/abi-0.7.11/src/af/xap/unix/xap_UnixPSGenerate.cpp --- abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/xap_UnixPSGenerate.cpp Thu Jun 8 02:49:24 2000 +++ abi-0.7.11/abi-0.7.11/src/af/xap/unix/xap_UnixPSGenerate.cpp Tue Sep 26 13:07:18 2000 @@ -118,7 +118,7 @@ UT_ASSERT(m_fp); UT_ASSERT(pBytes && (length>0)); - UT_ASSERT(length<256); // DSC3.0 requirement +// UT_ASSERT(length<256); // DSC3.0 requirement doProtectFromPipe(); UT_Bool bSuccess = (fwrite(pBytes,sizeof(UT_Byte),length,m_fp)==length); diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/xap_UnixToolbar_Icons.cpp abi-0.7.11/abi-0.7.11/src/af/xap/unix/xap_UnixToolbar_Icons.cpp --- abi-0.7.11-orig/abi-0.7.11/src/af/xap/unix/xap_UnixToolbar_Icons.cpp Mon Dec 7 21:12:55 1998 +++ abi-0.7.11/abi-0.7.11/src/af/xap/unix/xap_UnixToolbar_Icons.cpp Mon Sep 25 15:10:41 2000 @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ - +#include #include "ut_types.h" #include "ut_assert.h" #include "xap_UnixToolbar_Icons.h" @@ -40,7 +40,7 @@ UT_ASSERT(szIconName && *szIconName); UT_ASSERT(pwPixmap); - const char ** pIconData = NULL; + const char ** pIconData = NULL, **used_pIconData = NULL; UT_uint32 sizeofIconData = 0; // number of cells in the array UT_Bool bFound = _findIconDataByName(szIconName, &pIconData, &sizeofIconData); @@ -49,9 +49,41 @@ GdkBitmap * mask; GdkColormap * colormap = NULL; + { + /*if this is BW icon, use the current theme's text foreground + color instead of black (since background on which the icon + is painted can be very dark so that default black icon won't be + visible at all). + Vlad Harchev */ + int w,h,nc; + if (sscanf(pIconData[0],"%d %d %d",&h,&w,&nc)==3 && (nc == 2 || nc == 3) && + !strcmp(pIconData[2],". c #000000")) { + /*it's BW image and 2nd color is black - substitute it.*/ + used_pIconData = (const char**)malloc(sizeof(char*)*(h+nc+1)); + if (!used_pIconData) + goto done; /* let's it crash somewhere else */ + memcpy(used_pIconData,pIconData,sizeof(char*)*(h+nc+1)); + + static GtkWidget* label = NULL; + static char buf[50]; + if (!label) { + label = gtk_label_new(""); + gtk_widget_ensure_style(label); + + GdkColor* c = label->style->text + GTK_STATE_NORMAL; + sprintf(buf,".\tc #%02x%02x%02x",(unsigned int)c->red>>8,(unsigned int) c->green>>8,(unsigned int) c->blue>>8); + }; + used_pIconData[2] = buf; + }; + done: ; + } GdkPixmap * pixmap = gdk_pixmap_colormap_create_from_xpm_d(window,colormap,&mask, - background, (char **)pIconData); + background, (char **) (used_pIconData ? used_pIconData : pIconData)); + if (used_pIconData) + free(used_pIconData); + + if (!pixmap) return UT_FALSE; diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/xap/xp/Makefile abi-0.7.11/abi-0.7.11/src/af/xap/xp/Makefile --- abi-0.7.11-orig/abi-0.7.11/src/af/xap/xp/Makefile Wed Apr 26 19:12:22 2000 +++ abi-0.7.11/abi-0.7.11/src/af/xap/xp/Makefile Mon Sep 25 19:45:27 2000 @@ -48,7 +48,8 @@ xap_Strings.cpp \ xap_Toolbar_ControlFactory.cpp \ xap_ViewListener.cpp \ - xav_View.cpp + xav_View.cpp \ + xap_EncodingManager.cpp TARGETS= $(OBJS) diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/xap/xp/xap_App.cpp abi-0.7.11/abi-0.7.11/src/af/xap/xp/xap_App.cpp --- abi-0.7.11-orig/abi-0.7.11/src/af/xap/xp/xap_App.cpp Tue Aug 1 09:23:34 2000 +++ abi-0.7.11/abi-0.7.11/src/af/xap/xp/xap_App.cpp Mon Sep 25 22:25:13 2000 @@ -38,6 +38,7 @@ #include "xap_LoadBindings.h" #include "xap_Dictionary.h" #include "xap_Prefs.h" +#include "xap_EncodingManager.h" /*****************************************************************/ @@ -56,6 +57,11 @@ m_pToolbarActionSet = NULL; m_pDict = NULL; m_prefs = NULL; + m_pEncMgr = new XAP_EncodingManager();/* HACK: this is done in order + not to update the code for each platform. If platform specific + code has its own implementation of EncodingManager, then it + should just simply delete an instance pointed by this member + and assign ptr to platform-specific implementation. - hvv */ m_pApp = this; m_lastFocussedFrame = NULL; @@ -79,7 +85,13 @@ DELETEP(m_pToolbarActionSet); DELETEP(m_pDict); DELETEP(m_prefs); + DELETEP(m_pEncMgr); } + +const XAP_EncodingManager* XAP_App::getEncodingManager(void) const +{ + return m_pEncMgr; +}; UT_Bool XAP_App::initialize(void) { diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/xap/xp/xap_App.h abi-0.7.11/abi-0.7.11/src/af/xap/xp/xap_App.h --- abi-0.7.11-orig/abi-0.7.11/src/af/xap/xp/xap_App.h Fri Jul 28 08:24:10 2000 +++ abi-0.7.11/abi-0.7.11/src/af/xap/xp/xap_App.h Mon Sep 25 18:16:02 2000 @@ -47,6 +47,7 @@ class XAP_Dictionary; class PD_DocumentRange; class AV_View; +class XAP_EncodingManager; /***************************************************************** ****************************************************************** @@ -92,6 +93,7 @@ EV_EditBindingMap * getBindingMap(const char * szName); const EV_Menu_ActionSet * getMenuActionSet(void) const; const EV_Toolbar_ActionSet * getToolbarActionSet(void) const; + const XAP_EncodingManager* getEncodingManager(void) const; XAP_Args * getArgs(void) const; @@ -162,6 +164,7 @@ XAP_Dialog_Modeless * pDialog; } m_IdTable[NUM_MODELESSID+1]; + XAP_EncodingManager* m_pEncMgr; static XAP_App * m_pApp; }; diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/xap/xp/xap_EncodingManager.cpp abi-0.7.11/abi-0.7.11/src/af/xap/xp/xap_EncodingManager.cpp --- abi-0.7.11-orig/abi-0.7.11/src/af/xap/xp/xap_EncodingManager.cpp Thu Jan 1 04:00:00 1970 +++ abi-0.7.11/abi-0.7.11/src/af/xap/xp/xap_EncodingManager.cpp Wed Oct 4 00:03:47 2000 @@ -0,0 +1,628 @@ +#include "xap_EncodingManager.h" +#include "ut_debugmsg.h" +#include "ut_string.h" + +#include +#include + + + +/* + By Vlad Harchev +*/ +XAP_EncodingManager* XAP_EncodingManager::instance = NULL; +const char* XAP_EncodingManager::getNativeEncodingName() const +{ + return "ISO-8859-1"; /* this will definitely work*/ +} + +XAP_EncodingManager::~XAP_EncodingManager() {}; +XAP_EncodingManager::XAP_EncodingManager() { instance = this; initialize(); } + +const char* XAP_EncodingManager::getLanguageISOName() const +{ + return "en"; +}; + +const char* XAP_EncodingManager::getLanguageISOTerritory() const +{ + return NULL; +}; + +char XAP_EncodingManager::fallbackChar(UT_UCSChar c) const +{ + return '?'; +} + +/* in fact this method should provide full implementation */ + +UT_uint32 XAP_EncodingManager::approximate(char* out,UT_uint32 max_length,UT_UCSChar c) const +{ + if (max_length==0) + return 0; + if (max_length==1) + { + switch (c) + { + case 0x201d: + case 0x201c: + *out = '"'; return 1; + default: + return 0; + } + } + else + { + /* + this case can't happen with current code, so there is no + proper implementation. + */ + } + return 0; +}; + +UT_UCSChar XAP_EncodingManager::nativeToU(UT_UCSChar c) const +{ + UT_UCSChar ret = try_nativeToU(c); + return ret ? ret : fallbackChar(c); +}; + +UT_UCSChar XAP_EncodingManager::UToNative(UT_UCSChar c) const +{ + UT_UCSChar ret = try_UToNative(c); + if (!ret) + { + char repl; + int repl_len = approximate(&repl,1,c); + return repl_len == 1? repl : fallbackChar(c); + } + else + return ret; +}; + +UT_UCSChar XAP_EncodingManager::WindowsToU(UT_UCSChar c) const +{ + UT_UCSChar ret = try_WindowsToU(c); + return ret ? ret : fallbackChar(c); +}; + + +UT_UCSChar XAP_EncodingManager::UToWindows(UT_UCSChar c) const +{ + UT_UCSChar ret = try_UToWindows(c); + return ret ? ret : fallbackChar(c); +}; + + +const char* XAP_EncodingManager::strToNative(const char* in,const char* charset) const +{ + static char buf[2000]; + return strToNative(in,charset,buf,sizeof(buf)); +}; + +const char* XAP_EncodingManager::strToNative(const char* in,const char* charset,char* buf,int bufsz) const +{ + if (!charset || !*charset || !in || !*in || !buf) + return in; /*won't translate*/ + iconv_t iconv_handle = iconv_open(getNativeEncodingName(),charset); + if (iconv_handle == (iconv_t)-1) + return in; + const char* inptr = in; + char* outptr = buf; + size_t inbytes = strlen(in), outbytes = bufsz; + size_t donecnt = iconv(iconv_handle,&inptr,&inbytes,&outptr,&outbytes); + const char* retstr = in; + if (donecnt!=(size_t)-1 && inbytes==0) { + retstr = buf; + buf[bufsz - outbytes] = '\0';/*for sure*/ + }; + iconv_close(iconv_handle); + return retstr; +}; + +#ifndef HAVE_GNOME_XML2 + /*this is used by code that reads xml using expat*/ +int XAP_EncodingManager::XAP_XML_UnknownEncodingHandler(void* /*encodingHandlerData*/, + const XML_Char *name, + XML_Encoding *info) +{ + iconv_t iconv_handle = iconv_open("UCS-2",name); + if (iconv_handle == (iconv_t)-1) + return 0; + info->convert = NULL; + info->release = NULL; + { + char ibuf[1],obuf[2]; + for(int i=0;i<256;++i) + { + size_t ibuflen = 1, obuflen=2; + const char* iptr = ibuf; + char* optr = obuf; + ibuf[0] = (unsigned char)i; + size_t donecnt = iconv(iconv_handle,&iptr,&ibuflen,&optr,&obuflen); + if (donecnt!=(size_t)-1 && ibuflen==0) + { + unsigned short uval; + unsigned short b1 = (unsigned char)obuf[0]; + unsigned short b2 = (unsigned char)obuf[1]; + uval = (b1<<8) | b2; + info->map[i] = (unsigned int) uval; + } + else + info->map[i] = -1;/* malformed character. Such cases exist - e.g. 0x98 in cp1251*/ + + } + } + iconv_close(iconv_handle); + return 1; +}; +#endif + +static iconv_t iconv_handle_N2U,iconv_handle_U2N, + iconv_handle_U2Win,iconv_handle_Win2U; + + + +extern "C" { char *wvLIDToCodePageConverter(unsigned short lid); } +static void init_values(const XAP_EncodingManager* that) +{ + iconv_handle_N2U = iconv_open("UCS-2",that->getNativeEncodingName()); + iconv_handle_U2N = iconv_open(that->getNativeEncodingName(),"UCS-2"); + + char* winencname = wvLIDToCodePageConverter(that->getWinLanguageCode()); + iconv_handle_Win2U = iconv_open("UCS-2",winencname); + iconv_handle_U2Win = iconv_open(winencname,"UCS-2"); +}; + + +static UT_UCSChar try_CToU(UT_UCSChar c,iconv_t iconv_handle) +{ + /* + We don't support multibyte chars yet. wcstombcs should be used. + */ + if (c>255) + return 0; + if (iconv_handle == (iconv_t)-1) + return 0; + char ibuf[1],obuf[2]; + size_t ibuflen = 1, obuflen=2; + const char* iptr = ibuf; + char* optr = obuf; + ibuf[0] = (unsigned char)c; + size_t donecnt = iconv(iconv_handle,&iptr,&ibuflen,&optr,&obuflen); + if (donecnt!=(size_t)-1 && ibuflen==0) + { + unsigned short uval; + unsigned short b1 = (unsigned char)obuf[0]; + unsigned short b2 = (unsigned char)obuf[1]; + uval = (b1<<8) | b2; + return uval; + } else + return 0; +}; + +static UT_UCSChar try_UToC(UT_UCSChar c,iconv_t iconv_handle) +{ + if (iconv_handle == (iconv_t)-1) + return 0; + char ibuf[2],obuf[10]; + size_t ibuflen = sizeof(ibuf), obuflen=sizeof(obuf); + const char* iptr = ibuf; + char* optr = obuf; + { + ibuf[0] = (unsigned char)(c>>8); + ibuf[1] = (unsigned char)(c & 0xff); + } + size_t donecnt = iconv(iconv_handle,&iptr,&ibuflen,&optr,&obuflen); + if (donecnt!=(size_t)-1 && ibuflen==0) + { + int len = sizeof(obuf) - obuflen; + if (len!=1) + /* + We don't support multibyte chars yet. mbstowcs should be used. + */ + return 0; + else + return (unsigned char)*obuf; + } else + return 0; +}; + +UT_UCSChar XAP_EncodingManager::try_nativeToU(UT_UCSChar c) const +{ + return try_CToU(c,iconv_handle_N2U); +}; + +UT_UCSChar XAP_EncodingManager::try_UToNative(UT_UCSChar c) const +{ + return try_UToC(c,iconv_handle_U2N); +}; + +UT_UCSChar XAP_EncodingManager::try_WindowsToU(UT_UCSChar c) const +{ + return try_CToU(c,iconv_handle_Win2U); +} + +UT_UCSChar XAP_EncodingManager::try_UToWindows(UT_UCSChar c) const +{ + return try_UToC(c,iconv_handle_U2Win); +} + +/*reverse map*/ +struct _rmap +{ + const char* value;//it can't be NULL for non-special entries like last or first + const char** keys;//NULL-teminated array of strings +}; + +static const char* search_rmap(const _rmap* m,const char* key,UT_Bool* is_default = NULL) +{ + const _rmap* cur = m+1; + if (is_default) + *is_default = UT_FALSE; + for(;cur->value;++cur) + { + if (!cur->keys) + { + if (!UT_stricmp(cur->value,key)) + return cur->value; + else + continue; + }; + const char** curkey = cur->keys; + for(;*curkey;++curkey) + if (!UT_stricmp(*curkey,key)) + return cur->value; + } + if (is_default) + *is_default = UT_TRUE; + return m->value; +}; + +static const char* search_rmap_with_opt_suffix(const _rmap* m,const char* key,const char* fallback_key=NULL) +{ + UT_Bool is_default; + const char* value = search_rmap(m,key,&is_default); + if (!is_default || !fallback_key) + return value; + return search_rmap(m,fallback_key); +}; + + +struct _map +{ + char* key; + char* value; +}; +static const char* search_map(const _map* m,const char* key,UT_Bool* is_default = NULL) +{ + const _map* cur = m+1; + if (is_default) + *is_default = UT_FALSE; + for(;cur->key;++cur) + if (!UT_stricmp(cur->key,key)) + return cur->value; + if (is_default) + *is_default = UT_TRUE; + return m->value; +}; + +static const char* search_map_with_opt_suffix(const _map* m,const char* key,const char* fallback_key=NULL) +{ + UT_Bool is_default; + const char* value = search_map(m,key,&is_default); + if (!is_default || !fallback_key) + return value; + return search_map(m,fallback_key); +}; + +/* ************************* here begin tables *************************/ + +/* this array describes mapping form current encoding to Tex's encoding name. + The 1st entry is default value. + If the 'keys' field is NULL, then the 'value' of that entry should be used + (in the same case) if searched key matches the value. +*/ +static const char* texenc_iso88595[] = { "iso8859-5", NULL }; +static const _rmap native_tex_enc_map[]= +{ + { NULL}, /* the 1st item tells default value */ + { "koi8-r"}, { "koi8-ru"}, { "koi8-u"}, { "cp1251"}, { "cp866"}, + { "iso88595", texenc_iso88595}, + { NULL } /*last entry has NULL as 'value'*/ +}; + + +static const _map langcode_to_babelarg[]= +{ + {NULL,NULL}, + {"ru","english,russian"}, + + /* I'm not sure that this is correct, but my TeTex 0.9.17 works only + this way (i.e. only with "russian" in the middle) - hvv */ + {"uk","english,russian,ukrainian"}, + + /* I'm not sure again - my TeTex 0.9.17 doesn't know 'byelorussian' + language - hvv */ + {"be","english,russian"}, + {NULL,NULL} +}; + + +/* + Mapping from langcode to windows charset code. + See wingdi.h for charset codes windows defines, macros *_CHARSET (e.g. + RUSSIAN_CHARSET). +*/ +static const char* wincharsetcode_ru[]= /* russian charset */ +{ "ru","be", "uk" , NULL }; +static const char* wincharsetcode_el[]= /* greek charset*/ +{ "el", NULL }; + +static const char* wincharsetcode_tr[]= /* turkish charset*/ +{ "tr", NULL }; + +static const char* wincharsetcode_vi[]= /* vietnamese charset*/ +{ "vi", NULL }; + +static const char* wincharsetcode_th[]= /* thai charset*/ +{ "th", NULL }; + +static const _rmap langcode_to_wincharsetcode[]= +{ + {"0"}, /* default value - ansi charset*/ + {"204",wincharsetcode_ru}, + {"161",wincharsetcode_el}, + {"162",wincharsetcode_tr}, + {"163",wincharsetcode_vi}, + {"222",wincharsetcode_th}, + {NULL} +}; + +/* This structure is built from + http://www.unicode.org/unicode/onlinedat/languages.html + using lynx, sed and hands of VH. + + gcc for some reason barfs for each entry of this table: + "warning: aggregate has a partly bracketed initializer" +*/ +const XAP_LangInfo XAP_EncodingManager::langinfo[]= +{ + { "Abkhazian", "ab", "", "", ""}, + { "Afar", "aa", "", "", ""}, + { "Afrikaans", "af", "0x0036", "", ""}, + { "Albanian", "sq", "0x001c", "langAlbanian", "36"}, + { "Amharic", "am", "", "langAmharic", "85"}, + { "Arabic", "ar", "0x0001", "langArabic", "12"}, + { "Armenian", "hy", "", "langArmenian", "51"}, + { "Assamese", "as", "", "langAssamese", "68"}, + { "Aymara", "ay", "", "langAymara", "134"}, + { "Azerbaijani", "az", "", "langAzerbaijani(Latin)", "49"}, + { "Azerbaijani", "az", "", "langAzerbaijanAr(Arabic)", "50", }, + { "Bashkir", "ba", "", "", "",}, + { "Basque", "eu", "0x002d", "langBasque", "129",}, + { "Bengali", "bn", "", "langBengali", "67",}, + { "Bangla", "bn", "", "langBengali", "67", }, + { "Bhutani", "dz", "", "langDzongkha", "137",}, + { "Bihari", "bh", "", "", "",}, + { "Bislama", "bi", "", "", "",}, + { "Breton", "br", "", "langBreton", "142",}, + { "Bulgarian", "bg", "0x0002", "langBulgarian", "44",}, + { "Burmese", "my", "", "langBurmese", "77",}, + { "Byelorussian", "be", "0x0023", "langByelorussian", "46",}, + { "Cambodian", "km", "", "langKhmer", "78",}, + { "Catalan", "ca", "0x0003", "langCatalan", "130",}, + { "Chewa", "", "", "langChewa", "92",}, + { "Chinese", "zh", "0x0004", "langTradChinese", "19",}, + { "Chinese", "zh", "0x0004", "langSimpChinese", "33", }, + { "Corsican", "co", "", "", "",}, + { "Croatian", "hr", "0x001a", "langCroatian", "18",}, + { "Czech", "cs", "0x0005", "langCzech", "38",}, + { "Danish", "da", "0x0006", "langDanish", "7",}, + { "Dutch", "nl", "0x0013", "langDutch", "4",}, + { "English", "en", "0x0009", "langEnglish", "0",}, + { "Esperanto", "eo", "", "langEsperanto", "94",}, + { "Estonian", "et", "0x0025", "langEstonian", "27",}, + { "Faeroese", "fo", "0x0038", "langFaeroese", "30",}, + { "Farsi", "fa", "0x0029", "langFarsi", "31",}, + { "Farsi", "fa", "0x0029", "langPersian", "31", }, + { "Fiji", "fj", "", "", "",}, + { "Finnish", "fi", "0x000b", "langFinnish", "13",}, + { "Flemish", "", "", "langFlemish", "34",}, + { "French", "fr", "0x000c", "langFrench", "1",}, + { "Frisian", "fy", "", "", "",}, + { "Galician", "gl", "", "", "",}, + { "Galla", "", "", "langGalla", "87",}, + { "Georgian", "ka", "", "langGeorgian", "52",}, + { "German", "de", "0x0007", "langGerman", "2",}, + { "Greek", "el", "0x0008", "langGreek", "14",}, + { "Greenlandic", "kl", "", "", "",}, + { "Guarani", "gn", "", "langGuarani", "133",}, + { "Gujarati", "gu", "", "langGujarati", "69",}, + { "Hausa", "ha", "", "", "",}, + { "Hebrew", "he", "0x000d", "langHebrew", "10",}, + { "Hebrew", "iw", "0x000d", "langHebrew", "10", }, + { "Hindi", "hi", "0x0039", "langHindi", "21",}, + { "Hungarian", "hu", "0x000e", "langHungarian", "26",}, + { "Icelandic", "is", "0x000f", "langIcelandic", "15",}, + { "Indonesian", "in", "0x0021", "langIndonesian", "81",}, + { "Indonesian", "id", "0x0021", "langIndonesian", "81", }, + { "Interlingua", "ia", "", "", "",}, + { "Interlingue", "ie", "", "", "",}, + { "Inuktitut", "iu", "", "langInuktitut", "143",}, + { "Inupiak", "ik", "", "", "",}, + { "Irish", "ga", "", "langIrish", "35",}, + { "Italian", "it", "0x0010", "langItalian", "3",}, + { "Japanese", "ja", "0x0011", "langJapanese", "11",}, + { "Javanese", "jw", "", "langJavaneseRom", "138",}, + { "Kannada", "kn", "", "langKannada", "73",}, + { "Kashmiri", "ks", "", "langKashmiri", "61",}, + { "Kazakh", "kk", "", "langKazakh", "48",}, + { "Kinyarwanda", "rw", "", "", "",}, + { "Kirghiz", "ky", "", "langKirghiz", "54",}, + { "Kirundi", "rn", "", "", "",}, + { "Korean", "ko", "0x0012", "langKorean", "23",}, + { "Kurdish", "ku", "", "langKurdish", "60",}, + { "Laothian", "lo", "", "langLao", "79",}, + { "Lappish", "", "", "langLappish", "29",}, + { "Lappish", "", "", "langSaamisk", "29", }, + { "Latin", "la", "", "langLatin", "131",}, + { "Latvian", "lv", "0x0026", "langLatvian", "28",}, + { "Lettish", "lv", "0x0026", "langLatvian", "28", }, + { "Lingala", "ln", "", "", "",}, + { "Lithuanian", "lt", "0x0027", "langLithuanian", "24",}, + { "Macedonian", "mk", "0x002f", "langMacedonian", "43",}, + { "Malagasy", "mg", "", "langMalagasy", "93",}, + { "Malay", "ms", "0x003e", "langMalayRoman(Latin)", "83",}, + { "Malay", "ms", "0x003e", "langMalayArabic(Arabic)", "84", }, + { "Malayalam", "ml", "", "langMalayalam", "72",}, + { "Maltese", "mt", "", "langMaltese", "16",}, + { "Manx Gaelic", "gv", "", "langGailck", "141",}, + { "Maori", "mi", "", "", "",}, + { "Marathi", "mr", "", "langMarathi", "66",}, + { "Moldavian", "mo", "", "langMoldavian", "53",}, + { "Mongolian", "mn", "", "langMongolian(Mongolian)", "57",}, + { "Mongolian", "mn", "", "langMongolianCyr(Cyrillic)", "58",}, + { "Nauru", "na", "", "", "",}, + { "Nepali", "ne", "", "langNepali", "64",}, + { "Norwegian", "no", "0x0014", "langNorwegian", "9",}, + { "Occitan", "oc", "", "", "",}, + { "Oriya", "or", "", "langOriya", "71",}, + { "Oromo", "om", "", "langOromo", "87",}, + { "Afan", "om", "", "langOromo", "87", }, + { "Pashto", "ps", "", "langPashto", "59",}, + { "Pushto", "ps", "", "langPashto", "59", }, + { "Polish", "pl", "0x0015", "langPolish", "25",}, + { "Portuguese", "pt", "0x0016", "langPortuguese", "8",}, + { "Punjabi", "pa", "", "langPunjabi", "70",}, + { "Quechua", "qu", "", "langQuechua", "132",}, + { "Rhaeto-Romance", "rm", "", "", "",}, + { "Romanian", "ro", "0x0018", "langRomanian", "37",}, + { "Ruanda", "", "", "langRuanda", "90",}, + { "Rundi", "", "", "langRundi", "91",}, + { "Russian", "ru", "0x0019", "langRussian", "32",}, + { "Samoan", "sm", "", "", "",}, + { "Sangro", "sg", "", "", "",}, + { "Sanskrit", "sa", "", "langSanskrit", "65",}, + { "Scots Gaelic", "gd", "", "langGaidhlig", "140",}, + { "Serbian", "sr", "0x001a", "langSerbian", "42",}, + { "Serbo-Croatian", "sh", "", "", "",}, + { "Sesotho", "st", "", "", "",}, + { "Setswana", "tn", "", "", "",}, + { "Shona", "sn", "", "", "",}, + { "Sindhi", "sd", "", "langSindhi", "62",}, + { "Singhalese", "si", "", "langSinhalese", "76",}, + { "Siswati", "ss", "", "", "",}, + { "Slovak", "sk", "0x001b", "langSlovak", "39",}, + { "Slovenian", "sl", "0x0024", "langSlovenian", "40",}, + { "Somali", "so", "", "langSomali", "88",}, + { "Spanish", "es", "0x000a", "langSpanish", "6",}, + { "Sundanese", "su", "", "langSundaneseRom", "139",}, + { "Swahili", "sw", "0x0041", "langSwahili", "89",}, + { "Swedish", "sv", "0x001d", "langSwedish", "5",}, + { "Tagalog", "tl", "", "langTagalog", "82",}, + { "Tajik", "tg", "", "langTajiki", "55",}, + { "Tamil", "ta", "", "langTamil", "74",}, + { "Tatar", "tt", "", "langTatar", "135",}, + { "Telugu", "te", "", "langTelugu", "75",}, + { "Thai", "th", "0x001e", "langThai", "22",}, + { "Tibetan", "bo", "", "langTibetan", "63",}, + { "Tigrinya", "ti", "", "langTigrinya", "86",}, + { "Tonga", "to", "", "", "",}, + { "Tsonga", "ts", "", "", "",}, + { "Turkish", "tr", "0x001f", "langTurkish", "17",}, + { "Turkmen", "tk", "", "langTurkmen", "56",}, + { "Twi", "tw", "", "", "",}, + { "Uighur", "ug", "", "langUighur", "136",}, + { "Ukrainian", "uk", "0x0022", "langUkrainian", "45",}, + { "Urdu", "ur", "0x0020", "langUrdu", "20",}, + { "Uzbek", "uz", "", "langUzbek", "47",}, + { "Vietnamese", "vi", "0x002a", "langVietnamese", "80",}, + { "Volapьk", "vo", "", "", "",}, + { "Welsh", "cy", "", "langWelsh", "128",}, + { "Wolof", "wo", "", "", "",}, + { "Xhosa", "xh", "", "", "",}, + { "Yiddish", "ji", "", "langYiddish", "41",}, + { "Yiddish", "yi", "", "langYiddish", "41",}, + { "Yoruba", "yo", "", "", "",}, + { "Zulu", "zu", "", "", "",}, + { NULL, "", "", "", ""} +}; +/* ************************* here end tables *************************/ + +const XAP_LangInfo* XAP_EncodingManager::findLangInfo(const char* key,XAP_LangInfo::fieldidx idx) +{ + if (idx > XAP_LangInfo::max_idx) + return NULL; + const XAP_LangInfo* cur = langinfo; + for(; cur->fields[0]; ++cur) + if (!UT_stricmp(cur->fields[idx],key)) + return cur; + return NULL; +}; + +static const char* NativeTexEncodingName,*NativeBabelArgument; +static UT_uint32 WinLanguageCode,WinCharsetCode; + +void XAP_EncodingManager::initialize() +{ + const char* isocode = getLanguageISOName(), + *terrname = getLanguageISOTerritory(); + char fulllocname[30]; + if (terrname) + sprintf(fulllocname,"%s_%s",isocode,terrname); + else + strcpy(fulllocname,isocode); + NativeTexEncodingName = search_rmap(native_tex_enc_map,getNativeEncodingName()); + NativeBabelArgument = search_map_with_opt_suffix(langcode_to_babelarg,fulllocname,isocode); + { + const char* str = search_rmap_with_opt_suffix(langcode_to_wincharsetcode,fulllocname,isocode); + WinCharsetCode = str ? atoi(str) : 0; + } + { + const XAP_LangInfo* found = findLangInfo(getLanguageISOName(),XAP_LangInfo::isoshortname_idx); + char* str; + WinLanguageCode = 0; + if (found && *(str=found->fields[XAP_LangInfo::winlangcode_idx])) + { + int val; + if (sscanf(str,"%i",&val)==1) + WinLanguageCode = 0x400 + val; + } + } + init_values(this); /*do this unconditionally! */ +} + +const char* XAP_EncodingManager::getNativeTexEncodingName() const +{ + return NativeTexEncodingName; +}; + +const char* XAP_EncodingManager::getNativeBabelArgument() const +{ + return NativeBabelArgument; +}; + +UT_uint32 XAP_EncodingManager::getWinLanguageCode() const +{ + return WinLanguageCode; +}; + +UT_uint32 XAP_EncodingManager::getWinCharsetCode() const +{ + return WinCharsetCode; +}; + +void XAP_EncodingManager::describe() +{ + UT_DEBUGMSG(("EncodingManager reports the following:\n" + " NativeEncodingName is %s, LanguageISOName is %s,\n" + " LanguageISOTerritory is %s, NativeTexEncodingName is %s\n" + " NativeBabelArgument is [%s], fallbackchar is '%c'\n" + " WinLanguageCode is 0x%04x, WinCharsetCode is %d\n", + getNativeEncodingName(),getLanguageISOName(), + getLanguageISOTerritory() ? getLanguageISOTerritory() : "NULL", + getNativeTexEncodingName() ? getNativeTexEncodingName() : "NULL", + getNativeBabelArgument() ? getNativeBabelArgument() : "NULL", + fallbackChar(1072), getWinLanguageCode(), getWinCharsetCode() )); +}; diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/xap/xp/xap_EncodingManager.h abi-0.7.11/abi-0.7.11/src/af/xap/xp/xap_EncodingManager.h --- abi-0.7.11-orig/abi-0.7.11/src/af/xap/xp/xap_EncodingManager.h Thu Jan 1 04:00:00 1970 +++ abi-0.7.11/abi-0.7.11/src/af/xap/xp/xap_EncodingManager.h Mon Oct 2 11:25:55 2000 @@ -0,0 +1,150 @@ +/* + By Vlad Harchev +*/ + +#ifndef XAP_ENCMGR_H +#define XAP_ENCMGR_H + +#include "ut_types.h" + +#ifdef HAVE_GNOME_XML2 +#include +#else +#include "xmlparse.h" +#endif + +struct XAP_LangInfo +{ + /*no memeber can have NULL value. If string is empty, then value is + not defined. All fields are strings to simplify searches. + */ + enum fieldidx { longname_idx, /*this field is not empty*/ + isoshortname_idx /*ISO*/, + winlangcode_idx, /*0x400 + atoi() it to get a value*/ + macname_idx, /*e.g. "langRussian" or empty*/ + maclangcode_idx, /*atoi() it to get a value*/ + max_idx = maclangcode_idx }; + + char* fields[max_idx+1]; +}; + + +class XAP_EncodingManager +{ +public: + /* + this shouldn't return NULL. Don't free or write to returned string. + The string should be uppercased (extra font tarballs assume this). + */ + virtual const char* getNativeEncodingName() const; + /* + This shouldn't return NULL. Don't free or write to returned string. + Returns ISO two-letter name like "en" + */ + virtual const char* getLanguageISOName() const; + + /* + This can return NULL. Don't free or write to returned string. + Returns ISO two-letter territory name like "UK". + */ + + virtual const char* getLanguageISOTerritory() const; + /* + for exporting to Tex - in order to provide proper argument for + {inputenc}, e.g. \usepackage[koi8-r]{inputenc} + If NULL is returned, then package 'inputenc' is not used at all. + */ + virtual const char* getNativeTexEncodingName() const; + /* + For exporting to Text - in order to provide argument for package + 'babel', e.g. \usepackage[english,russian]{babel}. The returned + value is inserted between square brackets - nothing is appended or + prepended. If NULL is returned, entire line "\usepackage" is not + emitted. + */ + virtual const char* getNativeBabelArgument() const; + + /*these return 0 if they can't convert*/ + virtual UT_UCSChar try_nativeToU(UT_UCSChar c) const; + virtual UT_UCSChar try_UToNative(UT_UCSChar c) const; + + /*these are used for reading/writing of doc and rtf files. */ + virtual UT_UCSChar try_WindowsToU(UT_UCSChar c) const; + virtual UT_UCSChar try_UToWindows(UT_UCSChar c) const; + virtual char fallbackChar(UT_UCSChar c) const; + + virtual ~XAP_EncodingManager(); + + /* This tries to approximate the character with the string, e.g. + horizontal-elipsis -> "...". Returns # of chars written or 0 if can't. + The returned string will be in ascii (i.e. it will be representable + in any encoding). + If 'max_length' is 1, then approrixmation with exactly one character is + requested. If 'max_length' is not 1, then it's rather large (e.g. 16) - + so there is no need to check whether there is enough free space in the + buffer. + */ + virtual UT_uint32 approximate(char* out,UT_uint32 max_length,UT_UCSChar c) const; + + /* + This should return 0 if it's unknown. Used only when exporting the + document. + */ + virtual UT_uint32 getWinLanguageCode() const; + + /* + 0 means Ascii. See _CHARSET macros (e.g RUSSIAN_CHARSET) in wingdi.h + from Win32 SDK. Used only when exporting RTF. + */ + virtual UT_uint32 getWinCharsetCode() const; + + /*can be called several times - e.g. by constructor of port-specific + implementation. */ + virtual void initialize(); + + + /* these use try_ methods, and if they fail, fallbackChar() is returned*/ + UT_UCSChar nativeToU(UT_UCSChar c) const; + UT_UCSChar UToNative(UT_UCSChar c) const; + UT_UCSChar WindowsToU(UT_UCSChar c) const; + UT_UCSChar UToWindows(UT_UCSChar c) const; + + /* + this will convert the string 'in' from charset 'charset' to + native charset. This is mostly shorthand function. + it returns ptr to translated string - it will be either + 'in' or will be in static storage that shouldn't be freed. + Allowed values for 'charset' include "" and NULL in which case + 'in' be returned. Don't ask to translate strings longer than 2K. + This code is mostly used for translating localized menuitems to + the proper charset. + + Of course it uses iconv internally. + */ + const char* strToNative(const char* in,const char* charset) const; + + /* + Same as above, but it will use buffer provided by caller. + */ + const char* strToNative(const char* in,const char* charset,char* buf,int bufsz) const; +#ifndef HAVE_GNOME_XML2 + /*this is used by code that reads xml using expat*/ + static int XAP_XML_UnknownEncodingHandler(void *encodingHandlerData, + const XML_Char *name, + XML_Encoding *info); +#endif + XAP_EncodingManager(); + static XAP_EncodingManager* instance; + + /*it's terminated with the record with NULL in language name. */ + static const XAP_LangInfo langinfo[]; + + /* these are utility functions. Since all fields are strings, + we can use the same routine. Returns NULL if nothing was found. */ + static const XAP_LangInfo* findLangInfo(const char* key, + XAP_LangInfo::fieldidx column); +protected: + void describe(); +}; + +#endif /* XAP_APP_H */ diff -ruN abi-0.7.11-orig/abi-0.7.11/src/af/xap/xp/xap_Strings.cpp abi-0.7.11/abi-0.7.11/src/af/xap/xp/xap_Strings.cpp --- abi-0.7.11-orig/abi-0.7.11/src/af/xap/xp/xap_Strings.cpp Thu Jul 27 09:15:22 2000 +++ abi-0.7.11/abi-0.7.11/src/af/xap/xp/xap_Strings.cpp Fri Sep 29 17:43:32 2000 @@ -28,6 +28,7 @@ #include "ut_string.h" #include "ut_growbuf.h" #include "xap_Strings.h" +#include "xap_EncodingManager.h" ////////////////////////////////////////////////////////////////// // base class provides interface regardless of how we got the strings @@ -143,25 +144,45 @@ UT_decodeUTF8string(szString,UT_XML_strlen(szString),&gb); // TODO The strings that we use (for dialogs and etc) are currently - // TODO limited to Latin-1 by the GUI. Therefore, we convert them - // TODO back to a single-byte string. + // TODO limited to single-byte encodings by the code below. int kLimit=gb.getLength(); UT_uint16 * p=gb.getPointer(0); for (int k=0; kUToNative(p[k]); if (j > 0xff) { bFoundMultiByte = UT_TRUE; p[k] = '@'; - } + } + else + p[k] = j; } szDup = (XML_Char *)malloc((gb.getLength()+1)*sizeof(XML_Char)); if (!szDup) return UT_FALSE; +#if 0 UT_UCS_strcpy_to_char(szDup,gb.getPointer(0)); +#else + /* + Since we insure above that chars <0xff (i.e. + single-byte) it's safe to convert them using plain assignment. + Otherwise there will be a lot of troubles with any non-latin1 + single-byte encodings, (e.g. any russian encoding). + It's harmless to do so. + */ + { + int kLimit=gb.getLength(); + UT_uint16 * p=gb.getPointer(0); + for (int k=0; k>8) & 0xff) | ((in[i]&0xff)<<8); + } + out[i]= 0; +} + +/*this one copies from 'ucs2' to word16 swapping bytes if necessary */ +static void fromucs2(unsigned short *word16, int length) +{ + int i = 0; + unsigned short* in = ucs2,*out = word16; + for(;i>8) & 0xff) | ((in[i]&0xff)<<8); + } + out[i]= 0; +} +#ifndef __GLIBC__ +# define UCS_2_INTERNAL "UCS-2-INTERNAL" +#else +# define UCS_2_INTERNAL "UCS-2" +#endif +static void try_autodetect_charset(char* hashname) +{ + int len; + char buf[3000]; + FILE* f; + if (strlen(hashname)>(3000-15)) + return; + sprintf(buf,"%s-%s",hashname,"encoding"); + f = fopen(buf,"r"); + if (!f) + return; + len = fread(buf,1,sizeof(buf),f); + if (len<=0) + return; + buf[len]=0; + fclose(f); + { + char* start, *p = buf; + while (*p==' ' || *p=='\t' || *p=='\n') + ++p; + start = p; + while (!(*p==' ' || *p=='\t' || *p=='\n' || *p=='\0')) + ++p; + *p = '\0'; + if (!*start) /* empty enc */ + return; + translate_in = iconv_open(start, UCS_2_INTERNAL); + translate_out = iconv_open(UCS_2_INTERNAL, start); + } + +} /***************************************************************************/ @@ -70,8 +134,8 @@ prefstringchar = findfiletype("utf8", 1, deftflag < 0 ? &deftflag : (int *) NULL); if (prefstringchar >= 0) { - translate_in = iconv_open("utf-8", "UCS-2-INTERNAL"); - translate_out = iconv_open("UCS-2-INTERNAL", "utf-8"); + translate_in = iconv_open("utf-8", UCS_2_INTERNAL); + translate_out = iconv_open(UCS_2_INTERNAL, "utf-8"); } /* Test for "latinN" */ @@ -87,29 +151,30 @@ prefstringchar = findfiletype(teststring, 1, deftflag < 0 ? &deftflag : (int *) NULL); if (prefstringchar >= 0) { - translate_in = iconv_open(teststring, "UCS-2-INTERNAL"); - translate_out = iconv_open("UCS-2-INTERNAL", teststring); + translate_in = iconv_open(teststring, UCS_2_INTERNAL); + translate_out = iconv_open(UCS_2_INTERNAL, teststring); break; } } } + try_autodetect_charset(hashname); /* Test for known "hashname"s */ if(translate_in == (iconv_t)-1) { - if( strstr( hashname, "russian.hash" ) ) + if( strstr( hashname, "russian.hash" )) { /* ISO-8859-5, CP1251 or KOI8-R */ - translate_in = iconv_open("CP1251", "UCS-2-INTERNAL"); - translate_out = iconv_open("UCS-2-INTERNAL", "CP1251"); + translate_in = iconv_open("KOI8-R", UCS_2_INTERNAL); + translate_out = iconv_open(UCS_2_INTERNAL, "KOI8-R"); } } /* If nothing found, use latin1 */ if(translate_in == (iconv_t)-1) { - translate_in = iconv_open("latin1", "UCS-2-INTERNAL"); - translate_out = iconv_open("UCS-2-INTERNAL", "latin1"); + translate_in = iconv_open("latin1", UCS_2_INTERNAL); + translate_out = iconv_open(UCS_2_INTERNAL, "latin1"); } if (prefstringchar < 0) @@ -159,10 +224,11 @@ /* TF CHANGE: Use the right types unsigned int len_in, len_out; */ - size_t len_in, len_out; - const char *In = (const char *)word16; + size_t len_in, len_out; + const char *In = (const char *)ucs2; char *Out = word8; + toucs2(word16,length); len_in = length * 2; len_out = sizeof( word8 ) - 1; iconv(translate_in, &In, &len_in, &Out, &len_out); @@ -208,9 +274,9 @@ unsigned int len_in, len_out; */ size_t len_in, len_out; - const char *In = (const char *)word16; + const char *In = (const char *)ucs2; char *Out = word8; - + toucs2(word16,length); len_in = length * 2; len_out = sizeof( word8 ) - 1; iconv(translate_in, &In, &len_in, &Out, &len_out); @@ -264,12 +330,13 @@ */ size_t len_in, len_out; const char *In = possibilities[c]; - char *Out = (char *)sg->word[c]; + char *Out = (char *)ucs2; len_in = l; len_out = sizeof(unsigned short) * l; - iconv(translate_out, &In, &len_in, &Out, &len_out); + iconv(translate_out, &In, &len_in, &Out, &len_out); *((unsigned short *)Out) = 0; + fromucs2(sg->word[c], (unsigned short*)Out-ucs2); } } diff -ruN abi-0.7.11-orig/abi-0.7.11/src/pkg/common/unix/data/tbz_install.sh abi-0.7.11/abi-0.7.11/src/pkg/common/unix/data/tbz_install.sh --- abi-0.7.11-orig/abi-0.7.11/src/pkg/common/unix/data/tbz_install.sh Sun May 21 19:44:01 2000 +++ abi-0.7.11/abi-0.7.11/src/pkg/common/unix/data/tbz_install.sh Wed Oct 4 00:32:32 2000 @@ -180,10 +180,39 @@ # Change this if you move your fonts ABISUITE_FONT_HOME=\$ABISUITE_HOME/fonts +#locale-specific dirs could be added to it. +ABISUITE_FONT_PATH=\$ABISUITE_FONT_HOME + +#now try to guess locale +locale=\$LC_ALL #it's incorrect to set this variable, but someone + #might set it incorrectly. +if [ -z \$locale ] +then + locale=\$LANG +fi + +if [ ! -z \$locale ] +then + #now guess encoding + encoding=\`echo \$locale | sed -e 's/^.*\.\(.*\)\$/\1/'\` + if [ ! -z \$encoding ] + then + addfontdir=\$ABISUITE_FONT_HOME/\$encoding + if [ ! -z \$addfontdir ] + then + if [ -d \$addfontdir ] + then + #add directory with locale-specific fonts to font path + ABISUITE_FONT_PATH=\$ABISUITE_FONT_PATH,\$addfontdir + fi + fi + fi +fi + # Set run-time font path if [ -d \$ABISUITE_FONT_HOME ] then - xset fp+ \$ABISUITE_FONT_HOME 1>/dev/null 2>/dev/null + xset fp+ \$ABISUITE_FONT_PATH 1>/dev/null 2>/dev/null fi # Figure out which binary to run @@ -205,7 +234,7 @@ # Set post run-time font path if [ -d \$ABISUITE_FONT_HOME ] then - xset fp- \$ABISUITE_FONT_HOME 1>/dev/null 2>/dev/null + xset fp- \$ABISUITE_FONT_PATH 1>/dev/null 2>/dev/null fi EOF diff -ruN abi-0.7.11-orig/abi-0.7.11/src/pkg/common/unix/data/tgz_install.sh abi-0.7.11/abi-0.7.11/src/pkg/common/unix/data/tgz_install.sh --- abi-0.7.11-orig/abi-0.7.11/src/pkg/common/unix/data/tgz_install.sh Wed Mar 8 06:34:31 2000 +++ abi-0.7.11/abi-0.7.11/src/pkg/common/unix/data/tgz_install.sh Wed Oct 4 00:32:26 2000 @@ -180,10 +180,39 @@ # Change this if you move your fonts ABISUITE_FONT_HOME=\$ABISUITE_HOME/fonts +#locale-specific dirs could be added to it. +ABISUITE_FONT_PATH=\$ABISUITE_FONT_HOME + +#now try to guess locale +locale=\$LC_ALL #it's incorrect to set this variable, but someone + #might set it incorrectly. +if [ -z \$locale ] +then + locale=\$LANG +fi + +if [ ! -z \$locale ] +then + #now guess encoding + encoding=\`echo \$locale | sed -e 's/^.*\.\(.*\)\$/\1/'\` + if [ ! -z \$encoding ] + then + addfontdir=\$ABISUITE_FONT_HOME/\$encoding + if [ ! -z \$addfontdir ] + then + if [ -d \$addfontdir ] + then + #add directory with locale-specific fonts to font path + ABISUITE_FONT_PATH=\$ABISUITE_FONT_PATH,\$addfontdir + fi + fi + fi +fi + # Set run-time font path if [ -d \$ABISUITE_FONT_HOME ] then - xset fp+ \$ABISUITE_FONT_HOME 1>/dev/null 2>/dev/null + xset fp+ \$ABISUITE_FONT_PATH 1>/dev/null 2>/dev/null fi # Figure out which binary to run @@ -205,7 +234,7 @@ # Set post run-time font path if [ -d \$ABISUITE_FONT_HOME ] then - xset fp- \$ABISUITE_FONT_HOME 1>/dev/null 2>/dev/null + xset fp- \$ABISUITE_FONT_PATH 1>/dev/null 2>/dev/null fi EOF diff -ruN abi-0.7.11-orig/abi-0.7.11/src/pkg/common/unix/scripts/makewrapper.sh abi-0.7.11/abi-0.7.11/src/pkg/common/unix/scripts/makewrapper.sh --- abi-0.7.11-orig/abi-0.7.11/src/pkg/common/unix/scripts/makewrapper.sh Mon Jul 10 10:12:00 2000 +++ abi-0.7.11/abi-0.7.11/src/pkg/common/unix/scripts/makewrapper.sh Mon Oct 2 18:23:51 2000 @@ -55,10 +55,39 @@ # Change this if you move your fonts. ABISUITE_FONT_HOME=\$ABISUITE_HOME/fonts +#locale-specific dirs could be added to it. +ABISUITE_FONT_PATH=\$ABISUITE_FONT_HOME + +#now try to guess locale +locale=\$LC_ALL #it's incorrect to set this variable, but someone + #might set it incorrectly. +if [ -z \$locale ] +then + locale=\$LANG +fi + +if [ ! -z \$locale ] +then + #now guess encoding + encoding=\`echo \$locale | sed -e 's/^.*\.\(.*\)\$/\1/'\` + if [ ! -z \$encoding ] + then + addfontdir=\$ABISUITE_FONT_HOME/\$encoding + if [ ! -z \$addfontdir ] + then + if [ -d \$addfontdir ] + then + #add directory with locale-specific fonts to font path + ABISUITE_FONT_PATH=\$ABISUITE_FONT_PATH,\$addfontdir + fi + fi + fi +fi + # Set run-time font path if [ -d \$ABISUITE_FONT_HOME ] then - xset fp+ \$ABISUITE_FONT_HOME 1>/dev/null 2>/dev/null + xset fp+ \$ABISUITE_FONT_PATH 1>/dev/null 2>/dev/null fi # Figure out which binary to run @@ -83,7 +112,7 @@ # Set post run-time font path if [ -d \$ABISUITE_FONT_HOME ] then - xset fp- $ABISUITE_FONT_HOME 1>/dev/null 2>/dev/null + xset fp- \$ABISUITE_FONT_PATH 1>/dev/null 2>/dev/null fi fi EOF diff -ruN abi-0.7.11-orig/abi-0.7.11/src/wp/ap/unix/ap_UnixApp.cpp abi-0.7.11/abi-0.7.11/src/wp/ap/unix/ap_UnixApp.cpp --- abi-0.7.11-orig/abi-0.7.11/src/wp/ap/unix/ap_UnixApp.cpp Mon Aug 28 06:45:41 2000 +++ abi-0.7.11/abi-0.7.11/src/wp/ap/unix/ap_UnixApp.cpp Mon Sep 25 23:36:25 2000 @@ -370,9 +370,15 @@ // paste from the system clipboard using the best-for-us format // that is present. try to get the content in the order listed. + /* + I've reordered AP_CLIPBOARD_STRING and AP_CLIPBOARD_TEXTPLAIN_8BIT + since for non-Latin1 text the data in AP_CLIPBOARD_TEXTPLAIN_8BIT + format has name of encoding as prefix, and AP_CLIPBOARD_STRING + doesn't - hvv. + */ static const char * aszFormatsAccepted[] = { AP_CLIPBOARD_RTF, - AP_CLIPBOARD_TEXTPLAIN_8BIT, AP_CLIPBOARD_STRING, + AP_CLIPBOARD_TEXTPLAIN_8BIT, 0 /* must be last */ }; // TODO currently i have this set so that a ^v or Menu[Edit/Paste] will diff -ruN abi-0.7.11-orig/abi-0.7.11/src/wp/ap/unix/ap_UnixDialog_Columns.cpp abi-0.7.11/abi-0.7.11/src/wp/ap/unix/ap_UnixDialog_Columns.cpp --- abi-0.7.11-orig/abi-0.7.11/src/wp/ap/unix/ap_UnixDialog_Columns.cpp Wed Aug 9 05:21:42 2000 +++ abi-0.7.11/abi-0.7.11/src/wp/ap/unix/ap_UnixDialog_Columns.cpp Mon Oct 2 11:48:48 2000 @@ -309,13 +309,11 @@ buttonOK = gtk_button_new_with_label ( pSS->getValue(XAP_STRING_ID_DLG_OK)); gtk_widget_show(buttonOK ); gtk_container_add (GTK_CONTAINER (m_wGnomeButtons), buttonOK); - gtk_widget_set_usize (buttonOK, 37, -2); GTK_WIDGET_SET_FLAGS (buttonOK, GTK_CAN_DEFAULT); buttonCancel = gtk_button_new_with_label ( pSS->getValue(XAP_STRING_ID_DLG_Cancel)); gtk_widget_show(buttonCancel ); gtk_container_add (GTK_CONTAINER (m_wGnomeButtons), buttonCancel); - gtk_widget_set_usize (buttonCancel, 37, -2); GTK_WIDGET_SET_FLAGS (buttonCancel, GTK_CAN_DEFAULT); m_wbuttonOk = buttonOK; @@ -372,7 +370,6 @@ wColumnFrame = gtk_frame_new ( pSS->getValue(AP_STRING_ID_DLG_Column_Number)); gtk_widget_show(wColumnFrame); gtk_box_pack_start (GTK_BOX (hbox1), wColumnFrame, TRUE, TRUE, 7); - gtk_widget_set_usize (wColumnFrame, 120, -2); // was -2 wSelectFrame = gtk_frame_new (NULL); gtk_widget_show(wSelectFrame ); @@ -392,7 +389,6 @@ gtk_widget_show(wToggleOne ); UT_Bool butlab = label_button_with_abi_pixmap(wToggleOne, "tb_1column_xpm"); gtk_box_pack_start (GTK_BOX (hbox3), wToggleOne, FALSE, FALSE, 0); - gtk_widget_set_usize (wToggleOne, 44, 44); GTK_WIDGET_SET_FLAGS (wToggleOne, GTK_CAN_DEFAULT); wLabelOne = gtk_label_new ( pSS->getValue(AP_STRING_ID_DLG_Column_One)); @@ -407,7 +403,6 @@ gtk_widget_show(wToggleTwo ); label_button_with_abi_pixmap(wToggleTwo, "tb_2column_xpm"); gtk_box_pack_start (GTK_BOX (hbox4), wToggleTwo, FALSE, FALSE, 0); - gtk_widget_set_usize (wToggleTwo, 44, 44); GTK_WIDGET_SET_FLAGS (wToggleTwo, GTK_CAN_DEFAULT); wLabelTwo = gtk_label_new( pSS->getValue(AP_STRING_ID_DLG_Column_Two)); @@ -423,7 +418,6 @@ gtk_widget_show(wToggleThree ); label_button_with_abi_pixmap(wToggleThree, "tb_3column_xpm"); gtk_box_pack_start (GTK_BOX (hbox5), wToggleThree, FALSE, FALSE, 0); - gtk_widget_set_usize (wToggleThree, 44, 44); GTK_WIDGET_SET_FLAGS (wToggleThree, GTK_CAN_DEFAULT); wLabelThree = gtk_label_new ( pSS->getValue(AP_STRING_ID_DLG_Column_Three)); @@ -433,7 +427,7 @@ wPreviewFrame = gtk_frame_new ( pSS->getValue(AP_STRING_ID_DLG_Column_Preview)); gtk_widget_show(wPreviewFrame ); gtk_box_pack_start (GTK_BOX (hbox1), wPreviewFrame, TRUE, TRUE, 4); - gtk_widget_set_usize (wPreviewFrame, 100, -2); // was -2 +// gtk_widget_set_usize (wPreviewFrame, 100, -2); // was -2 wDrawFrame = gtk_frame_new (NULL); gtk_widget_show(wDrawFrame ); @@ -454,7 +448,7 @@ gtk_box_pack_end (GTK_BOX (hbox1), vbuttonbox1, FALSE, FALSE, 0); gtk_button_box_set_layout (GTK_BUTTON_BOX (vbuttonbox1), GTK_BUTTONBOX_START); gtk_button_box_set_spacing (GTK_BUTTON_BOX (vbuttonbox1), 0); - gtk_button_box_set_child_size (GTK_BUTTON_BOX (vbuttonbox1), 74, 27); +// gtk_button_box_set_child_size (GTK_BUTTON_BOX (vbuttonbox1), 74, 27); gtk_button_box_set_child_ipadding (GTK_BUTTON_BOX (vbuttonbox1), 0, 1); m_wGnomeButtons = vbuttonbox1; @@ -467,7 +461,7 @@ gtk_widget_show(wLineBtween ); gtk_box_pack_start (GTK_BOX (hbox2), wLineBtween, FALSE, FALSE, 3); - wLabelLineBetween = gtk_label_new ("Line Between"); + wLabelLineBetween = gtk_label_new (pSS->getValue(AP_STRING_ID_DLG_Column_Line_Between)); gtk_widget_show(wLabelLineBetween ); gtk_box_pack_start (GTK_BOX (hbox2), wLabelLineBetween, FALSE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (wLabelLineBetween), GTK_JUSTIFY_LEFT); diff -ruN abi-0.7.11-orig/abi-0.7.11/src/wp/ap/unix/ap_UnixDialog_Insert_DateTime.cpp abi-0.7.11/abi-0.7.11/src/wp/ap/unix/ap_UnixDialog_Insert_DateTime.cpp --- abi-0.7.11-orig/abi-0.7.11/src/wp/ap/unix/ap_UnixDialog_Insert_DateTime.cpp Thu May 11 09:16:58 2000 +++ abi-0.7.11/abi-0.7.11/src/wp/ap/unix/ap_UnixDialog_Insert_DateTime.cpp Sun Oct 1 14:42:20 2000 @@ -185,7 +185,7 @@ windowMain = gtk_window_new (GTK_WINDOW_DIALOG); gtk_object_set_data (GTK_OBJECT (windowMain), "windowMain", windowMain); - gtk_widget_set_usize (windowMain, 270, 240); +// gtk_widget_set_usize (windowMain, 270 , 240); gtk_container_set_border_width (GTK_CONTAINER (windowMain), 10); gtk_window_set_title (GTK_WINDOW (windowMain), pSS->getValue(AP_STRING_ID_DLG_DateTime_DateTimeTitle)); gtk_window_set_policy (GTK_WINDOW (windowMain), FALSE, FALSE, FALSE); @@ -221,7 +221,8 @@ (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (scrolledwindowFormats); gtk_box_pack_start (GTK_BOX (vboxFormats), scrolledwindowFormats, TRUE, TRUE, 0); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindowFormats), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindowFormats), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + gtk_widget_set_usize(scrolledwindowFormats,-1,240); viewportFormats = gtk_viewport_new (NULL, NULL); gtk_widget_ref (viewportFormats); diff -ruN abi-0.7.11-orig/abi-0.7.11/src/wp/ap/unix/ap_UnixPrefs.cpp abi-0.7.11/abi-0.7.11/src/wp/ap/unix/ap_UnixPrefs.cpp --- abi-0.7.11-orig/abi-0.7.11/src/wp/ap/unix/ap_UnixPrefs.cpp Thu Jul 27 09:15:28 2000 +++ abi-0.7.11/abi-0.7.11/src/wp/ap/unix/ap_UnixPrefs.cpp Fri Sep 29 13:35:35 2000 @@ -102,9 +102,19 @@ // en-US, es-ES, pt-PT // we'll try this quick conversion - if (lc_ctype != NULL && strlen(lc_ctype) >= 5) { - lc_ctype[2] = '-'; - szNewLang = lc_ctype; + if (lc_ctype != NULL && strlen(lc_ctype) >= 5) + { + lc_ctype[2] = '-'; + char* dot = strrchr(lc_ctype,'.'); + + /* + remove charset field. It's a right thing since expat + already converts data in stringset from ANY encoding to + current one (if iconv knows this encoding). + */ + if (dot) + *dot = '\0'; + szNewLang = lc_ctype; } UT_DEBUGMSG(("Prefs: Using LOCALE info from environment [%s]\n",szNewLang)); diff -ruN abi-0.7.11-orig/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_bold_rus.xpm abi-0.7.11/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_bold_rus.xpm --- abi-0.7.11-orig/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_bold_rus.xpm Thu Jan 1 04:00:00 1970 +++ abi-0.7.11/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_bold_rus.xpm Mon Oct 2 03:16:06 2000 @@ -0,0 +1,29 @@ +/* XPM */ +static char * tb_text_bold_rus_xpm[] = { +"24 24 2 1", +" c None", +". c #000000", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ... .. ... ", +" .. .. .. ", +" .. .. .. ", +" ...... ", +" .... ", +" ...... ", +" .. .. .. ", +" .. .. .. ", +" ... .. ... ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff -ruN abi-0.7.11-orig/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_italic_rus.xpm abi-0.7.11/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_italic_rus.xpm --- abi-0.7.11-orig/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_italic_rus.xpm Thu Jan 1 04:00:00 1970 +++ abi-0.7.11/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_italic_rus.xpm Mon Oct 2 03:25:13 2000 @@ -0,0 +1,29 @@ +/* XPM */ +static char * tb_text_italic_rus_xpm[] = { +"24 24 2 1", +" c None", +". c #000000", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" .... ... ", +" .. .. ", +" ... .. ", +" ..... ", +" ..... ", +" .. .. ", +" ... .. ", +" .. .. ", +" .... .... ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff -ruN abi-0.7.11-orig/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_overline_rus.xpm abi-0.7.11/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_overline_rus.xpm --- abi-0.7.11-orig/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_overline_rus.xpm Thu Jan 1 04:00:00 1970 +++ abi-0.7.11/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_overline_rus.xpm Mon Oct 2 03:25:22 2000 @@ -0,0 +1,29 @@ +/* XPM */ +static char * tb_text_overline_rus_xpm[] = { +"24 24 2 1", +" c None", +". c #000000", +" ", +" ", +" ", +" ", +" ", +" ", +" ......... ", +" ", +" .... .... ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" ...... ", +" .. ", +" .. ", +" .... ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff -ruN abi-0.7.11-orig/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_strikeout_rus.xpm abi-0.7.11/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_strikeout_rus.xpm --- abi-0.7.11-orig/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_strikeout_rus.xpm Thu Jan 1 04:00:00 1970 +++ abi-0.7.11/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_strikeout_rus.xpm Mon Oct 2 03:26:43 2000 @@ -0,0 +1,29 @@ +/* XPM */ +static char * tb_text_strikeout_rus_xpm[] = { +"24 24 2 1", +" c None", +". c #000000", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" . .... ", +" . . ", +" . . . ", +" . . .... .... ", +" ..... . . . . ", +" ................ ", +" . . . . . . ", +" ... ... ... .... ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff -ruN abi-0.7.11-orig/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_underline_rus.xpm abi-0.7.11/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_underline_rus.xpm --- abi-0.7.11-orig/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_underline_rus.xpm Thu Jan 1 04:00:00 1970 +++ abi-0.7.11/abi-0.7.11/src/wp/ap/xp/ToolbarIcons/tb_text_underline_rus.xpm Mon Oct 2 03:21:00 2000 @@ -0,0 +1,29 @@ +/* XPM */ +static char * tb_text_underline_rus_xpm[] = { +"24 24 2 1", +" c None", +". c #000000", +" ", +" ", +" ", +" ", +" ", +" ", +" .... .... ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" ...... ", +" .. ", +" .. ", +" .... ", +" ", +" ......... ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff -ruN abi-0.7.11-orig/abi-0.7.11/src/wp/ap/xp/ap_Menu_LabelSet.cpp abi-0.7.11/abi-0.7.11/src/wp/ap/xp/ap_Menu_LabelSet.cpp --- abi-0.7.11-orig/abi-0.7.11/src/wp/ap/xp/ap_Menu_LabelSet.cpp Fri Feb 18 10:51:13 2000 +++ abi-0.7.11/abi-0.7.11/src/wp/ap/xp/ap_Menu_LabelSet.cpp Mon Oct 2 14:23:25 2000 @@ -24,6 +24,7 @@ #include "ev_Menu_Labels.h" #include "xap_Menu_ActionSet.h" #include "ap_Menu_Id.h" +#include "xap_EncodingManager.h" /***************************************************************** ****************************************************************** @@ -33,19 +34,29 @@ ****************************************************************** *****************************************************************/ -#define BeginSet(Language,Locale,bIsDefaultSetForLanguage) \ +#define BeginSetEnc(Language,Locale,bIsDefaultSetForLanguage,Encoding) \ static EV_Menu_LabelSet * _ap_CreateLabelSet_##Language##Locale(void) \ { EV_Menu_LabelSet * pLabelSet = \ new EV_Menu_LabelSet(#Language"-"#Locale,AP_MENU_ID__BOGUS1__,AP_MENU_ID__BOGUS2__); \ - UT_ASSERT(pLabelSet); + UT_ASSERT(pLabelSet); \ + char* encoding = (Encoding); \ + char namebuf[2000],statusmsgbuf[2000]; + +#define BeginSet(Language,Locale,bIsDefaultSetForLanguage) \ + BeginSetEnc(Language,Locale,bIsDefaultSetForLanguage,"") -#define MenuLabel(id,szName,szStatusMsg) pLabelSet->setLabel((id),(szName),(szStatusMsg)); - +#define MenuLabel(id,szName,szStatusMsg) \ + pLabelSet->setLabel((id), \ + XAP_EncodingManager::instance->strToNative((szName),encoding,namebuf,sizeof(namebuf)), \ + XAP_EncodingManager::instance->strToNative((szStatusMsg),encoding,statusmsgbuf,sizeof(statusmsgbuf)) \ + ); + #define EndSet() return pLabelSet; } #include "ap_Menu_LabelSet_Languages.h" +#undef BeginSetEnc #undef BeginSet #undef MenuLabel #undef EndSet @@ -67,7 +78,10 @@ UT_Bool m_bIsDefaultSetForLanguage; }; -#define BeginSet(Language,Locale,bIsDefaultSetForLanguage) { #Language"-"#Locale, _ap_CreateLabelSet_##Language##Locale, bIsDefaultSetForLanguage }, + +#define BeginSetEnc(Language,Locale,bIsDefaultSetForLanguage,Encoding) { #Language"-"#Locale, _ap_CreateLabelSet_##Language##Locale, bIsDefaultSetForLanguage }, +#define BeginSet(Language,Locale,bIsDefaultSetForLanguage) \ + BeginSetEnc(Language,Locale,bIsDefaultSetForLanguage,"") #define MenuLabel(id,szName,szStatusMsg) /*nothing*/ #define EndSet() /*nothing*/ @@ -78,6 +92,7 @@ }; +#undef BeginSetEnc #undef BeginSet #undef MenuLabel #undef EndSet @@ -87,8 +102,16 @@ ** Put it all together and have a "load LabelSet by Language" ****************************************************************** *****************************************************************/ -EV_Menu_LabelSet * AP_CreateMenuLabelSet(const char * szLanguage) +EV_Menu_LabelSet * AP_CreateMenuLabelSet(const char * szLanguage_) { + char buf[300]; + strcpy(buf,szLanguage_ ? szLanguage_ : ""); + char* szLanguage = buf; + + char* dot = strrchr(szLanguage,'.'); + if (dot) + *dot = '\0'; /* remove encoding part from locale name */ + if (szLanguage && *szLanguage) { UT_uint32 k; diff -ruN abi-0.7.11-orig/abi-0.7.11/src/wp/ap/xp/ap_Menu_LabelSet_Languages.h abi-0.7.11/abi-0.7.11/src/wp/ap/xp/ap_Menu_LabelSet_Languages.h --- abi-0.7.11-orig/abi-0.7.11/src/wp/ap/xp/ap_Menu_LabelSet_Languages.h Fri Jul 21 09:50:33 2000 +++ abi-0.7.11/abi-0.7.11/src/wp/ap/xp/ap_Menu_LabelSet_Languages.h Sat Sep 30 23:11:03 2000 @@ -45,3 +45,4 @@ #include "ap_Menu_LabelSet_sv-SE.h" #include "ap_Menu_LabelSet_pl-PL.h" #include "ap_Menu_LabelSet_pt-PT.h" +#include "ap_Menu_LabelSet_ru-RU.h" diff -ruN abi-0.7.11-orig/abi-0.7.11/src/wp/ap/xp/ap_Menu_LabelSet_ru-RU.h abi-0.7.11/abi-0.7.11/src/wp/ap/xp/ap_Menu_LabelSet_ru-RU.h --- abi-0.7.11-orig/abi-0.7.11/src/wp/ap/xp/ap_Menu_LabelSet_ru-RU.h Thu Jan 1 04:00:00 1970 +++ abi-0.7.11/abi-0.7.11/src/wp/ap/xp/ap_Menu_LabelSet_ru-RU.h Mon Oct 2 03:03:43 2000 @@ -0,0 +1,154 @@ +/* AbiWord + * Copyright (C) 1998-2000 AbiSource, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + + +/***************************************************************** +****************************************************************** +** IT IS IMPORTANT THAT THIS FILE ALLOW ITSELF TO BE INCLUDED +** MORE THAN ONE TIME. +****************************************************************** +*****************************************************************/ + +// We use the Win32 '&' character to denote a keyboard accelerator on a menu item. +// If your platform doesn't have a way to do accelerators or uses a different +// character, remove or change the '&' in your menu constructor code. + +// If the third argument is UT_TRUE, then this is the fall-back for +// this language (named in the first argument). + +BeginSetEnc(ru,RU,UT_TRUE,"koi8-r") + +MenuLabel(AP_MENU_ID__BOGUS1__, NULL, NULL) + +// (id, szLabel, szStatusMsg) + +MenuLabel(AP_MENU_ID_FILE, "&Файл", NULL) + MenuLabel(AP_MENU_ID_FILE_NEW, "&Новый", "Создать новый документ") + MenuLabel(AP_MENU_ID_FILE_OPEN, "&Открыть", "Открыть существующий документ") + MenuLabel(AP_MENU_ID_FILE_SAVE, "&Сохранить", "Сохранить документ") + MenuLabel(AP_MENU_ID_FILE_SAVEAS, "Сохранить &как", "Сохранить документ под другим именем") + MenuLabel(AP_MENU_ID_FILE_PAGESETUP, "П&араметры страницы", "Изменить параметры печати") + MenuLabel(AP_MENU_ID_FILE_PRINT, "&Печать", "Печатать документ или его часть") + MenuLabel(AP_MENU_ID_FILE_RECENT_1, "&1 %s", "Открыть этот документ") + MenuLabel(AP_MENU_ID_FILE_RECENT_2, "&2 %s", "Открыть этот документ") + MenuLabel(AP_MENU_ID_FILE_RECENT_3, "&3 %s", "Открыть этот документ") + MenuLabel(AP_MENU_ID_FILE_RECENT_4, "&4 %s", "Открыть этот документ") + MenuLabel(AP_MENU_ID_FILE_RECENT_5, "&5 %s", "Открыть этот документ") + MenuLabel(AP_MENU_ID_FILE_RECENT_6, "&6 %s", "Открыть этот документ") + MenuLabel(AP_MENU_ID_FILE_RECENT_7, "&7 %s", "Открыть этот документ") + MenuLabel(AP_MENU_ID_FILE_RECENT_8, "&8 %s", "Открыть этот документ") + MenuLabel(AP_MENU_ID_FILE_RECENT_9, "&9 %s", "Открыть этот документ") + MenuLabel(AP_MENU_ID_FILE_CLOSE, "&Закрыть", "Закрыть документ") + MenuLabel(AP_MENU_ID_FILE_EXIT, "&Выход", "Закрыть все документы и выйти") + +MenuLabel(AP_MENU_ID_EDIT, "&Редактирование", NULL) + MenuLabel(AP_MENU_ID_EDIT_UNDO, "&Отмена", "Отменить предыдущее действие") + MenuLabel(AP_MENU_ID_EDIT_REDO, "&Повтор", "Повторить предыдущее отмененное действие") + MenuLabel(AP_MENU_ID_EDIT_CUT, "&Вырезать", "Вырезать выделение и поместить его в буфер обмена") + MenuLabel(AP_MENU_ID_EDIT_COPY, "&Копировать", "Скопировать выделение и поместить его в буфер обмена") + MenuLabel(AP_MENU_ID_EDIT_PASTE, "В&ставить", "Вставить содержимое буфера обмена в документ") + MenuLabel(AP_MENU_ID_EDIT_CLEAR, "О&чистить", "Очистить выделение") + MenuLabel(AP_MENU_ID_EDIT_SELECTALL, "В&ыделить все", "Выделить весь документ") + MenuLabel(AP_MENU_ID_EDIT_FIND, "&Найти", "Найти заданный текст") + MenuLabel(AP_MENU_ID_EDIT_REPLACE, "&Заменить", "Заменить заданный текст другим") + MenuLabel(AP_MENU_ID_EDIT_GOTO, "Пе&рейти к", "Переместить курсор в заданное место") + +MenuLabel(AP_MENU_ID_VIEW, "&Вид", NULL) + MenuLabel(AP_MENU_ID_VIEW_TOOLBARS, "&Панели", NULL) + MenuLabel(AP_MENU_ID_VIEW_TB_STD, "&Стандартная", "Показать/спрятать стандартную панель") + MenuLabel(AP_MENU_ID_VIEW_TB_FORMAT, "&Форматирование", "Показать/спрятать панель форматирования") + MenuLabel(AP_MENU_ID_VIEW_TB_EXTRA, "&Дополнительная", "Показать/спрятать дополнительную панель") + MenuLabel(AP_MENU_ID_VIEW_RULER, "&Линейка", "Показать/спрятать линейку") + MenuLabel(AP_MENU_ID_VIEW_STATUSBAR, "&Строка статуса", "Показать/спрятать строку статуса") + MenuLabel(AP_MENU_ID_VIEW_SHOWPARA, "П&оказать спецсимволы", "Показать/спрятать непечатаемые символы") + MenuLabel(AP_MENU_ID_VIEW_HEADFOOT, "&Верхний и нижний колонтитулы", "Редактировать текст внизу и вверху каждой странице") + MenuLabel(AP_MENU_ID_VIEW_ZOOM, "&Масштаб", "Уменьшить/увеличить масштаб представления документа") + +MenuLabel(AP_MENU_ID_INSERT, "В&ставка", NULL) + MenuLabel(AP_MENU_ID_INSERT_BREAK, "&Разрыв", "Вставить разрыв страницы, колонки или секции") + MenuLabel(AP_MENU_ID_INSERT_PAGENO, "&Номера страниц", "Вставить автообновляемые номера страниц") + MenuLabel(AP_MENU_ID_INSERT_DATETIME, "&Дата и время", "Вставить дату/время") + MenuLabel(AP_MENU_ID_INSERT_FIELD, "&Поле", "Вставить автообновляемое поле") + MenuLabel(AP_MENU_ID_INSERT_SYMBOL, "&Символ", "Вставить символ или другой специальный знак") + MenuLabel(AP_MENU_ID_INSERT_GRAPHIC, "Р&исунок", "Вставить существующий рисунок из внешнего файла") + +MenuLabel(AP_MENU_ID_FORMAT, "Ф&орматирование", NULL) + MenuLabel(AP_MENU_ID_FMT_FONT, "&Шрифт", "Изменить шрифт выделенного текста") + MenuLabel(AP_MENU_ID_FMT_PARAGRAPH, "&Абзац", "Изменить формат выделенного абзаца") + MenuLabel(AP_MENU_ID_FMT_BULLETS, "&Списки", "Добавить/убрать маркеры/нумерацию у абзацев") + MenuLabel(AP_MENU_ID_FMT_BORDERS, "&Границы и заливка", "Добавить/убрать рамку и заливку у выделения") + MenuLabel(AP_MENU_ID_FMT_COLUMNS, "К&олонки", "Изменить кол-во колонок") + MenuLabel(AP_MENU_ID_FMT_TABS, "&Табуляция", "Установить позиции табуляции") + MenuLabel(AP_MENU_ID_FMT_BOLD, "&Жирный", "Сделать выделение жирным") + MenuLabel(AP_MENU_ID_FMT_ITALIC, "&Курсив", "Сделать выделение курсивным") + MenuLabel(AP_MENU_ID_FMT_UNDERLINE, "&Подчеркивание", "Подчеркнуть выделение") + MenuLabel(AP_MENU_ID_FMT_OVERLINE, "Над&черкивание", "Надчеркнуть выделение") + MenuLabel(AP_MENU_ID_FMT_STRIKE, "П&еречеркивание", "Перечеркнуть выделение") + MenuLabel(AP_MENU_ID_FMT_SUPERSCRIPT, "&Верний индекс", "Перевести выделение в верхний индекс") + MenuLabel(AP_MENU_ID_FMT_SUBSCRIPT, "&Нижний индекс", "Перевести выделение в нижний индекс") + MenuLabel(AP_MENU_ID_ALIGN, "В&ыравнивание", NULL) + MenuLabel(AP_MENU_ID_ALIGN_LEFT, "По &левому краю", "Выровнять абзац по левому краю") + MenuLabel(AP_MENU_ID_ALIGN_CENTER, "По &центру", "Выровнять абзац по центру") + MenuLabel(AP_MENU_ID_ALIGN_RIGHT, "По &правому краю", "Выровнять абзац по правому краю") + MenuLabel(AP_MENU_ID_ALIGN_JUSTIFY, "По &ширине", "Выровнять абзац по ширине листа") + MenuLabel(AP_MENU_ID_FMT_STYLE, "Ст&иль", "Определить или применить стили к выделению") + +MenuLabel(AP_MENU_ID_TOOLS, "&Сервис", NULL) + MenuLabel(AP_MENU_ID_TOOLS_SPELL, "&Правописание", "Проверить документ на правописание") + MenuLabel(AP_MENU_ID_TOOLS_WORDCOUNT, "&Статистика", "Посчитать кол-во слов, символов и т. д. в документе") + MenuLabel(AP_MENU_ID_TOOLS_OPTIONS, "&Установки", "Изменить установки") + +MenuLabel(AP_MENU_ID_WINDOW, "&Окно", NULL) + MenuLabel(AP_MENU_ID_WINDOW_NEW, "&Новое окно", "Открыть новое окно для документа") + MenuLabel(AP_MENU_ID_WINDOW_1, "&1 %s", "Переключиться на это окно") + MenuLabel(AP_MENU_ID_WINDOW_2, "&2 %s", "Переключиться на это окно") + MenuLabel(AP_MENU_ID_WINDOW_3, "&3 %s", "Переключиться на это окно") + MenuLabel(AP_MENU_ID_WINDOW_4, "&4 %s", "Переключиться на это окно") + MenuLabel(AP_MENU_ID_WINDOW_5, "&5 %s", "Переключиться на это окно") + MenuLabel(AP_MENU_ID_WINDOW_6, "&6 %s", "Переключиться на это окно") + MenuLabel(AP_MENU_ID_WINDOW_7, "&7 %s", "Переключиться на это окно") + MenuLabel(AP_MENU_ID_WINDOW_8, "&8 %s", "Переключиться на это окно") + MenuLabel(AP_MENU_ID_WINDOW_9, "&9 %s", "Переключиться на это окно") + MenuLabel(AP_MENU_ID_WINDOW_MORE, "&Другие окна", "Показать полный список окон") + +MenuLabel(AP_MENU_ID_HELP, "&Помощь", NULL) + MenuLabel(AP_MENU_ID_HELP_CONTENTS, "&Содержание", "Вызвать содержание помощи") + MenuLabel(AP_MENU_ID_HELP_INDEX, "&Оглавление", "Вызвать оглавление помощи") + MenuLabel(AP_MENU_ID_HELP_CHECKVER, "&Версия", "Показать версию программы") + MenuLabel(AP_MENU_ID_HELP_SEARCH, "&Поиск", "Искать помощь о...") + MenuLabel(AP_MENU_ID_HELP_ABOUT, "О &программе %s", "Показать версию, статус и т. д.") + MenuLabel(AP_MENU_ID_HELP_ABOUTOS, "О &Open Source", "Показать информацию об Open Source") + +MenuLabel(AP_MENU_ID_SPELL_SUGGEST_1, "%s", "Заменить этим вариантом написания") +MenuLabel(AP_MENU_ID_SPELL_SUGGEST_2, "%s", "Заменить этим вариантом написания") +MenuLabel(AP_MENU_ID_SPELL_SUGGEST_3, "%s", "Заменить этим вариантом написания") +MenuLabel(AP_MENU_ID_SPELL_SUGGEST_4, "%s", "Заменить этим вариантом написания") +MenuLabel(AP_MENU_ID_SPELL_SUGGEST_5, "%s", "Заменить этим вариантом написания") +MenuLabel(AP_MENU_ID_SPELL_SUGGEST_6, "%s", "Заменить этим вариантом написания") +MenuLabel(AP_MENU_ID_SPELL_SUGGEST_7, "%s", "Заменить этим вариантом написания") +MenuLabel(AP_MENU_ID_SPELL_SUGGEST_8, "%s", "Заменить этим вариантом написания") +MenuLabel(AP_MENU_ID_SPELL_SUGGEST_9, "%s", "Заменить этим вариантом написания") +MenuLabel(AP_MENU_ID_SPELL_IGNOREALL, "&Игнорировать", "Игнорировать все вхождения") +MenuLabel(AP_MENU_ID_SPELL_ADD, "&Добавить", "Добавить слово в словарь") + +// ... add others here ... + +MenuLabel(AP_MENU_ID__BOGUS2__, NULL, NULL) + +EndSet() diff -ruN abi-0.7.11-orig/abi-0.7.11/src/wp/ap/xp/ap_Strings.cpp abi-0.7.11/abi-0.7.11/src/wp/ap/xp/ap_Strings.cpp --- abi-0.7.11-orig/abi-0.7.11/src/wp/ap/xp/ap_Strings.cpp Fri Oct 8 11:22:52 1999 +++ abi-0.7.11/abi-0.7.11/src/wp/ap/xp/ap_Strings.cpp Fri Sep 29 17:43:56 2000 @@ -25,6 +25,7 @@ #include "ut_string.h" #include "ut_growbuf.h" #include "ap_Strings.h" +#include "xap_EncodingManager.h" ////////////////////////////////////////////////////////////////// // a sub-class to wrap the compiled-in (english) strings @@ -219,25 +220,45 @@ UT_decodeUTF8string(szString,UT_XML_strlen(szString),&gb); // TODO The strings that we use (for dialogs and etc) are currently - // TODO limited to Latin-1 by the GUI. Therefore, we convert them - // TODO back to a single-byte string. + // TODO limited to single-byte encodings by the code below. int kLimit=gb.getLength(); UT_uint16 * p=gb.getPointer(0); for (int k=0; kUToNative(p[k]); if (j > 0xff) { bFoundMultiByte = UT_TRUE; p[k] = '@'; - } + } + else + p[k] = j; } szDup = (XML_Char *)malloc((gb.getLength()+1)*sizeof(XML_Char)); if (!szDup) return UT_FALSE; +#if 0 UT_UCS_strcpy_to_char(szDup,gb.getPointer(0)); +#else + /* + Since we insure above that chars <0xff (i.e. + single-byte) it's safe to convert them using plain assignment. + Otherwise there will be a lot of troubles with any non-latin1 + single-byte encodings, (e.g. any russian encoding). + It's harmless to do so. + */ + { + int kLimit=gb.getLength(); + UT_uint16 * p=gb.getPointer(0); + for (int k=0; ksetLabel((id),(szName),(#iconName),(szToolTip),(szStatusMsg)); + pLabelSet->setLabel((id), \ + XAP_EncodingManager::instance->strToNative((szName),encoding,namebuf,sizeof(namebuf)),(#iconName), \ + XAP_EncodingManager::instance->strToNative((szToolTip),encoding,tooltipbuf,sizeof(tooltipbuf)), \ + XAP_EncodingManager::instance->strToNative((szStatusMsg),encoding,statusmsgbuf,sizeof(statusmsgbuf)) \ + ); #define EndSet() \ return pLabelSet; \ @@ -50,6 +60,7 @@ #include "ap_TB_LabelSet_Languages.h" #undef BeginSet +#undef BeginSetEnc #undef ToolbarLabel #undef EndSet @@ -70,7 +81,9 @@ UT_Bool m_bIsDefaultSetForLanguage; }; -#define BeginSet(Language,Locale,bIsDefaultSetForLanguage) { #Language"-"#Locale, _ap_CreateLabelSet_##Language##Locale, bIsDefaultSetForLanguage }, +#define BeginSetEnc(Language,Locale,bIsDefaultSetForLanguage,Encoding) { #Language"-"#Locale, _ap_CreateLabelSet_##Language##Locale, bIsDefaultSetForLanguage }, +#define BeginSet(Language,Locale,bIsDefaultSetForLanguage) \ + BeginSetEnc(Language,Locale,bIsDefaultSetForLanguage,"") #define ToolbarLabel(id,szName,iconName,szToolTip,szStatusMsg) /*nothing*/ #define EndSet() /*nothing*/ @@ -82,6 +95,7 @@ }; #undef BeginSet +#undef BeginSetEnc #undef ToolbarLabel #undef EndSet @@ -91,8 +105,16 @@ ****************************************************************** *****************************************************************/ -EV_Toolbar_LabelSet * AP_CreateToolbarLabelSet(const char * szLanguage) +EV_Toolbar_LabelSet * AP_CreateToolbarLabelSet(const char * szLanguage_) { + char buf[300]; + strcpy(buf,szLanguage_ ? szLanguage_ : ""); + char* szLanguage = buf; + + char* dot = strrchr(szLanguage,'.'); + if (dot) + *dot = '\0'; /* remove encoding part from locale name */ + if (szLanguage && *szLanguage) { UT_uint32 k; diff -ruN abi-0.7.11-orig/abi-0.7.11/src/wp/impexp/xp/ie_exp.cpp abi-0.7.11/abi-0.7.11/src/wp/impexp/xp/ie_exp.cpp --- abi-0.7.11-orig/abi-0.7.11/src/wp/impexp/xp/ie_exp.cpp Sun Aug 6 23:40:49 2000 +++ abi-0.7.11/abi-0.7.11/src/wp/impexp/xp/ie_exp.cpp Wed Sep 27 15:45:04 2000 @@ -59,6 +59,7 @@ }; #define DeclareExporter(n) { n::RecognizeSuffix, n::StaticConstructor, n::GetDlgLabels, n::SupportsFileType } +#define DeclareExporter_sub(n,subfmt) { n::RecognizeSuffix_##subfmt, n::StaticConstructor_##subfmt, n::GetDlgLabels_##subfmt, n::SupportsFileType_##subfmt } static struct _xp s_expTable[] = { @@ -69,6 +70,7 @@ // Don't declare until it works #endif DeclareExporter(IE_Exp_RTF), + DeclareExporter_sub(IE_Exp_RTF,attic), DeclareExporter(IE_Exp_Text), DeclareExporter(IE_Exp_UTF8), DeclareExporter(IE_Exp_HTML), diff -ruN abi-0.7.11-orig/abi-0.7.11/src/wp/impexp/xp/ie_exp_AbiWord_1.cpp abi-0.7.11/abi-0.7.11/src/wp/impexp/xp/ie_exp_AbiWord_1.cpp --- abi-0.7.11-orig/abi-0.7.11/src/wp/impexp/xp/ie_exp_AbiWord_1.cpp Thu Jul 27 09:15:31 2000 +++ abi-0.7.11/abi-0.7.11/src/wp/impexp/xp/ie_exp_AbiWord_1.cpp Fri Sep 29 20:29:38 2000 @@ -31,6 +31,7 @@ #include "px_CR_Strux.h" #include "xap_App.h" #include "pd_Style.h" +#include "xap_EncodingManager.h" /*****************************************************************/ /*****************************************************************/ @@ -310,6 +311,7 @@ if (*pData > 0x007f) { #if 1 +# if 0 // convert non us-ascii into numeric entities. // this has the advantage that our file format is // 7bit clean and safe for email and other network @@ -319,6 +321,32 @@ sprintf(localBuf,"&#x%x;",*pData++); while (*plocal) *pBuf++ = (UT_Byte)*plocal++; +# else + /* + Try to convert to native encoding and if + character fits into byte, output raw byte. This + is somewhat essential for single-byte non-latin + languages like russian or polish - since + tools like grep and sed can be used then for + these files without any problem. + Networks and mail transfers are 8bit clean + these days. - VH + */ + UT_UCSChar c = XAP_EncodingManager::instance->try_UToNative(*pData); + if (c==0 || c>255) + { + char localBuf[20]; + char * plocal = localBuf; + sprintf(localBuf,"&#x%x;",*pData++); + while (*plocal) + *pBuf++ = (UT_Byte)*plocal++; + } + else + { + *pBuf++ = (UT_Byte)c; + pData++; + } +# endif #else // convert to UTF8 // TODO if we choose this, do we have to put the ISO header in @@ -359,7 +387,9 @@ // any encoding, XML assumes we're using UTF-8. Note that US-ASCII // is a strict subset of UTF-8. - m_pie->write("\n"); + m_pie->write("write(XAP_EncodingManager::instance->getNativeEncodingName()); + m_pie->write("\"?>\n"); // We write this first so that the sniffer can detect AbiWord // documents more easily. diff -ruN abi-0.7.11-orig/abi-0.7.11/src/wp/impexp/xp/ie_exp_HTML.cpp abi-0.7.11/abi-0.7.11/src/wp/impexp/xp/ie_exp_HTML.cpp --- abi-0.7.11-orig/abi-0.7.11/src/wp/impexp/xp/ie_exp_HTML.cpp Thu Jul 27 09:15:31 2000 +++ abi-0.7.11/abi-0.7.11/src/wp/impexp/xp/ie_exp_HTML.cpp Fri Sep 29 20:01:46 2000 @@ -34,6 +34,7 @@ #include "px_CR_Span.h" #include "px_CR_Strux.h" #include "xap_App.h" +#include "xap_EncodingManager.h" /*****************************************************************/ /*****************************************************************/ @@ -736,8 +737,6 @@ m_pie->write(buf,(pBuf-buf)); pBuf = buf; } - - UT_ASSERT(*pData < 256); switch (*pData) { case '<': @@ -778,14 +777,20 @@ default: if (*pData > 0x007f) { - // convert non us-ascii into numeric entities. - // we could convert them into UTF-8 multi-byte - // sequences, but i prefer these. - char localBuf[20]; - char * plocal = localBuf; - sprintf(localBuf,"&#%d;",*pData++); - while (*plocal) - *pBuf++ = (UT_Byte)*plocal++; + UT_UCSChar c = XAP_EncodingManager::instance->try_UToNative(*pData); + if (c!=0 && c<256) + { + *pBuf++ = (unsigned char)c; + } + else + { + char localBuf[20]; + char * plocal = localBuf; + sprintf(localBuf,"&#%d;",*pData); + while (*plocal) + *pBuf++ = (UT_Byte)*plocal++; + }; + pData++; } else { @@ -857,6 +862,9 @@ m_pie->write("\n"); m_pie->write("\n"); m_pie->write("\n"); + m_pie->write("write(XAP_EncodingManager::instance->getNativeEncodingName()); + m_pie->write("\">\n"); m_pie->write("AbiWord Document\n"); m_pie->write("