]> git.lyx.org Git - features.git/commitdiff
encoding + etc patch from dekel
authorLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 20 Jul 2000 10:04:27 +0000 (10:04 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 20 Jul 2000 10:04:27 +0000 (10:04 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@904 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
src/Painter.C
src/encoding.C
src/encoding.h
src/font.C
src/insets/insetcite.h
src/language.C
src/lyxfunc.C
src/mathed/formula.C
src/mathed/math_symbols.C
src/paragraph.C

index ad735034f4193ca562eeeb2550b54a46672973c3..5cbbc3482372ceeb09c60c3d102949c9487467e0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2000-07-19  Dekel Tsur  <dekel@math.tau.ac.il>
+
+       * src/Painter.C (text): Added code for using symbol glyphs from
+       iso10646 fonts. Currently diabled.
+
+       * src/encoding.C: Added new encodings: iso8859_3,iso8859_9 and
+       symbol_encoding.
+
+       * src/language.C (initL): Fixed encodings for esperanto,lsorbian,
+       magyar,turkish and usorbian.
+
+       * src/paragraph.C (isMultiLingual): Made more efficient.
+
+       * src/mathed/formula.C (LocalDispatch): Fixed behavior of greek
+       keyboard.
+
+       * src/mathed/math_symbols.C (math_insert_greek): Changed to use
+       LocalDispatch(..,LFUN_SELFINSERT,..) instead of math_insert_symbol().
+       Also changed the prototype to "bool math_insert_greek(char)".
+                                                                       
 2000-07-19  Lars Gullik Bjønnes  <larsbj@lyx.org>
 
        * lots of files: apply the NEW_INSETS on all code that will not be
index cb0cd4e740fac0f81cbde9d61933dce9b9d531ca..5eadc986465f8119f118d0a5fc7289c5b628c88a 100644 (file)
@@ -274,13 +274,23 @@ PainterBase & Painter::text(int x, int y, char const * s, int ls,
 {
        if (lyxrc.font_norm_type == LyXRC::ISO_10646_1) {
                XChar2b * xs = new XChar2b[ls];
-               Encoding const * enc = f.language()->encoding();
+               Encoding const * encoding = f.language()->encoding();
+               LyXFont const * font = &f; 
+               if (f.family() == LyXFont::SYMBOL_FAMILY) {
+#ifdef USE_UNICODE_FOR_SYMBOLS
+                       LyXFont font2 = f;
+                       font2.setFamily(LyXFont::ROMAN_FAMILY);
+                       font2.setShape(LyXFont::UP_SHAPE);
+                       font = &font2;
+#endif
+                       encoding = &symbol_encoding;
+               }
                for (int i = 0; i < ls; ++i) {
-                       Uchar c = enc->ucs(s[i]);
+                       Uchar c = encoding->ucs(s[i]);
                        xs[i].byte1 = c >> 8;
                        xs[i].byte2 = c & 0xff;
-                }
-               text(x , y, xs, ls, f);
+               }
+               text(x , y, xs, ls, *font);
                delete[] xs;
                return *this;
        }
index c2a8bc53a9e6e9ce7f717f9b3876f436688a4428..129a29a03678ee249e4d04fd8dc07da9ddbd9101 100644 (file)
@@ -56,6 +56,31 @@ Uchar tab_iso8859_2[256] = {
    0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9
 };
 
+Uchar tab_iso8859_3[256] = {
+   0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+   0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+   0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+   0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+   0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+   0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+   0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+   0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
+   0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+   0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
+   0x00a0, 0x0126, 0x02d8, 0x00a3, 0x00a4, 0xffff, 0x0124, 0x00a7,
+   0x00a8, 0x0130, 0x015e, 0x011e, 0x0134, 0x00ad, 0xffff, 0x017b,
+   0x00b0, 0x0127, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x0125, 0x00b7,
+   0x00b8, 0x0131, 0x015f, 0x011f, 0x0135, 0x00bd, 0xffff, 0x017c,
+   0x00c0, 0x00c1, 0x00c2, 0xffff, 0x00c4, 0x010a, 0x0108, 0x00c7,
+   0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
+   0xffff, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x0120, 0x00d6, 0x00d7,
+   0x011c, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x016c, 0x015c, 0x00df,
+   0x00e0, 0x00e1, 0x00e2, 0xffff, 0x00e4, 0x010b, 0x0109, 0x00e7,
+   0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
+   0xffff, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x0121, 0x00f6, 0x00f7,
+   0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9,
+};
+
 Uchar tab_iso8859_4[256] = {
    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
@@ -137,6 +162,31 @@ Uchar tab_iso8859_7[256] = {
    0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0xffff
 };
 
+Uchar tab_iso8859_9[256] = {
+   0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+   0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+   0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+   0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+   0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+   0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+   0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+   0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
+   0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+   0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
+   0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
+   0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
+   0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
+   0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
+   0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
+   0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
+   0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
+   0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df,
+   0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
+   0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
+   0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
+   0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff,
+};
+
 Uchar tab_cp1255[256] = {
    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
@@ -189,6 +239,57 @@ Uchar tab_koi8[256] = {
    0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a
 };
 
+Uchar tab_symbol[256] = {
+   0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+   0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+
+   0x0020, 0x0021, 0x2200, 0x0023, 0x2203, 0x0025, 0x0026, 0x220b,
+   0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
+
+   0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+
+//   0x2245, 0x0391, 0x0392, 0x03a7, 0x0394, 0x0395, 0x03a6, 0x0393,
+//   0x0397, 0x0399, 0x03d1, 0x039a, 0x039b, 0x039c, 0x039d, 0x039f,
+
+//   0x03a0, 0x0398, 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03c2, 0x03a9,
+//   0x039e, 0x03a8, 0x0396, 0x005b, 0x2234, 0x005d, 0x22a5, 0xffff,
+   0x2245, 0x0041, 0x0042, 0x0058, 0x0394, 0x0045, 0x03c2, 0x03a9,
+   0x0048, 0x0049, 0x03d1, 0x004b, 0x039b, 0x004d, 0x004e, 0x004f,
+
+   0x03a0, 0x0398, 0x0050, 0x03a3, 0x0054, 0x0059, 0x03c2, 0x03a9,
+   0x039e, 0x03a8, 0x005a, 0x005b, 0x2234, 0x005d, 0x22a5, 0xffff,
+
+   0xffff, 0x03b1, 0x03b2, 0x03c7, 0x03b4, 0x03b5, 0x03d5, 0x03b3,
+   0x03b7, 0x03b9, 0x03c6, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03bf,
+
+   0x03c0, 0x03b8, 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03d6, 0x03c9,
+   0x03be, 0x03c8, 0x03b6, 0x007b, 0x007c, 0x007d, 0x007e, 0xffff,
+
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0x03d2, 0x2032, 0x2264, 0x2215, 0x221e, 0xffff, 0x2663,
+   0x2666, 0x2665, 0x2660, 0x2194, 0x2190, 0x2191, 0x2192, 0x2193,
+
+   0x00b0, 0x00b1, 0x2033, 0x2265, 0x00d7, 0x221d, 0x2202, 0x2022,
+   0x00f7, 0x2260, 0x2261, 0x2248, 0x22ef, 0xffff, 0xffff, 0x21b5,
+
+   0x2135, 0x2111, 0x211c, 0x2118, 0x2297, 0x2295, 0x2205, 0x2229,
+   0x222a, 0x2283, 0x2287, 0x2284, 0x2282, 0x2286, 0x2208, 0x2209,
+
+   0x2220, 0x2207, 0x00ae, 0x00a9, 0x2122, 0x220f, 0x221a, 0x22c5,
+   0x00ac, 0x2227, 0x2228, 0x21d4, 0x21d0, 0x21d1, 0x21d2, 0x21d3,
+
+   0x2662, 0x2329, 0x00ae, 0x00a9, 0x2122, 0x2211, 0xffff, 0xffff,
+   0xffff, 0x2308, 0xffff, 0x230a, 0xffff, 0xffff, 0xffff, 0xffff,
+
+   0xffff, 0x232a, 0x222b, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+   0xffff, 0x2309, 0xffff, 0x230b, 0xffff, 0xffff, 0xffff, 0xffff
+};
+
 unsigned char arabic_table2[63][4] = {
        {0x41, 0x41, 0x41, 0x41}, // 0xc1 = hamza
        {0x42, 0xa1, 0x42, 0x42}, // 0xc2 = ligature madda on alef
@@ -303,7 +404,7 @@ unsigned char arabic_table[63][2] = {
        {0xe8, 0xe8},   // 0xe8 = waw
        {0xe9, 0xe9},   // 0xe9 = alef maksura
        {0xea, 0xfe},   // 0xea = ya
-       {0xeb, 0xa8},   // 0xeb = fathatan
+       {0xa8, 0xa8},   // 0xeb = fathatan
        {0xa9, 0xa9},   // 0xec = dammatan
        {0xaa, 0xaa},   // 0xed = kasratan
        {0xab, 0xab},   // 0xee = fatha
@@ -329,8 +430,17 @@ unsigned char arabic_table[63][2] = {
 
 Encoding iso8859_1("latin1",tab_iso8859_1);
 Encoding iso8859_2("latin2",tab_iso8859_2);
+Encoding iso8859_3("latin3",tab_iso8859_3);
 Encoding iso8859_4("latin4",tab_iso8859_4);
-Encoding iso8859_6("latin6",tab_iso8859_6_16);
-Encoding iso8859_7("latin7",tab_iso8859_7);
+Encoding iso8859_6("unknown",tab_iso8859_6_16);
+Encoding iso8859_7("unknown",tab_iso8859_7);
+Encoding iso8859_9("latin5",tab_iso8859_9);
 Encoding cp1255("cp1255",tab_cp1255);
 Encoding koi8("koi8-r",tab_koi8);
+
+
+#ifdef USE_UNICODE_FOR_SYMBOLS
+Encoding symbol_encoding("",tab_symbol);
+#else
+Encoding symbol_encoding("",tab_iso8859_1);
+#endif
index 4f21877e5cf530357a76d8063012549c65729621..d8059d68ec89f307f4adf61fe4359d8207951608 100644 (file)
@@ -59,12 +59,14 @@ private:
 
 extern Encoding iso8859_1;
 extern Encoding iso8859_2;
+extern Encoding iso8859_3;
 extern Encoding iso8859_4;
 extern Encoding iso8859_6;
 extern Encoding iso8859_7;
+extern Encoding iso8859_9;
 extern Encoding cp1255;
 extern Encoding koi8;
-
+extern Encoding symbol_encoding;
 
 inline
 bool Encoding::IsComposeChar_hebrew(unsigned char c)
index c17c8da8f8bbecfde85a835eca884a7dba7010c0..1aae9a6e43569a54828bf0afebd3b84673ad29c3 100644 (file)
@@ -94,13 +94,23 @@ int lyxfont::width(char const * s, int n, LyXFont const & f)
 
        if (lyxrc.font_norm_type == LyXRC::ISO_10646_1) {
                XChar2b * xs = new XChar2b[n];
-               Encoding const * enc = f.language()->encoding();
+               Encoding const * encoding = f.language()->encoding();
+               LyXFont const * font = &f; 
+               if (f.family() == LyXFont::SYMBOL_FAMILY) {
+#ifdef USE_UNICODE_FOR_SYMBOLS
+                       LyXFont font2 = f;
+                       font2.setFamily(LyXFont::ROMAN_FAMILY);
+                       font2.setShape(LyXFont::UP_SHAPE);
+                       font = &font2;
+#endif
+                       encoding = &symbol_encoding;
+               }
                for (int i = 0; i < n; ++i) {
-                       Uchar c = enc->ucs(s[i]);
+                       Uchar c = encoding->ucs(s[i]);
                        xs[i].byte1 = c >> 8;
                        xs[i].byte2 = c & 0xff;
                 }
-               int result = width(xs, n, f);
+               int result = width(xs, n, *font);
                delete[] xs;
                return result;
        }
index 1c87a452f6c70042960944fd9136e5aebd2788f3..bf2cd559b363f5595c4935d16584f5157d9d65c5 100644 (file)
 
 class Dialogs;
 
+#ifdef SIGC_CXX_NAMESPACES
+using SigC::Signal0;
+#endif
+
+
 /** Used to insert citations  
  */
 class InsetCitation : public InsetCommand {
@@ -40,7 +45,7 @@ public:
         ///
        void Edit(BufferView *, int, int, unsigned int);
        ///
-       SigC::Signal0<void> hide;
+       Signal0<void> hide;
 };
 
 #endif // INSET_CITE_H
index f439153ae07803a399166dfdb66f4b3bc24736bc..b96c66a2ec0a8fb33ffa802a15f09dc7db7eb5f8 100644 (file)
@@ -53,7 +53,7 @@ void LangInit::initL()
        { "danish", N_("Danish"), false, &iso8859_1 },
        { "dutch", N_("Dutch"), false, &iso8859_1 },
        { "english", N_("English"), false, &iso8859_1 },
-       { "esperanto", N_("Esperanto"), false, &iso8859_1 },
+       { "esperanto", N_("Esperanto"), false, &iso8859_3 },
        { "estonian", N_("Estonian"), false, &iso8859_4 },
        { "finnish", N_("Finnish"), false, &iso8859_1 },
        { "francais", N_("Francais"), false, &iso8859_1 },
@@ -70,8 +70,8 @@ void LangInit::initL()
        //{ "hungarian", N_("Hungarian"), false, &iso8859_2 },
        { "irish", N_("Irish"), false, &iso8859_1 },
        { "italian", N_("Italian"), false, &iso8859_1 },
-       { "lsorbian", N_("Lsorbian"), false, &iso8859_1 },
-       { "magyar", N_("Magyar"), false, &iso8859_1 },
+       { "lsorbian", N_("Lsorbian"), false, &iso8859_2 },
+       { "magyar", N_("Magyar"), false, &iso8859_2 },
        { "norsk", N_("Norsk"), false, &iso8859_1 },
        { "polish", N_("Polish"), false, &iso8859_2 },
        { "portuges", N_("Portuges"), false, &iso8859_1 },
@@ -82,8 +82,8 @@ void LangInit::initL()
        { "slovak", N_("Slovak"), false, &iso8859_2 },
        { "slovene", N_("Slovene"), false, &iso8859_2 },
        { "swedish", N_("Swedish"), false, &iso8859_1 },
-       { "turkish", N_("Turkish"), false, &iso8859_1 },
-       { "usorbian", N_("Usorbian"), false, &iso8859_1 },
+       { "turkish", N_("Turkish"), false, &iso8859_9 },
+       { "usorbian", N_("Usorbian"), false, &iso8859_2 },
        { "welsh", N_("Welsh"), false, &iso8859_1 },
        { 0, 0, false, 0 }
        };
index 0073d9d2663fa3815bbeed9e009992bf947d419a..ed4429f003e68247846adc83a97fabe14dfd3f54 100644 (file)
@@ -98,10 +98,10 @@ extern bool cursor_follows_scrollbar;
 
 extern void InsertAsciiFile(BufferView *, string const &, bool);
 extern void math_insert_symbol(char const *);
-extern Bool math_insert_greek(char const); // why "Bool"?
+extern bool math_insert_greek(char);
 extern BufferList bufferlist;
 extern LyXServer * lyxserver;
-extern short greek_kb_flag;
+extern int greek_kb_flag;
 extern FD_form_toc * fd_form_toc;
 extern bool selection_possible;
 
index b00ea87361acca2673b0fbe664afd1019a37c007..a90d0db7ab62f2f554b7046b959916cfe6d9b278 100644 (file)
@@ -53,7 +53,7 @@ extern char * mathed_label;
 
 extern char const * latex_special_chars;
 
-short greek_kb_flag = 0;
+int greek_kb_flag = 0;
 
 LyXFont * Math_Fonts = 0; // this is only used by Whichfont and mathed_init_fonts (Lgb)
 
@@ -1117,7 +1117,21 @@ InsetFormula::LocalDispatch(BufferView * bv,
            }
 
 //          lyxerr << "Varcode << vardoce;
-           mathcursor->Insert(c, (greek_kb_flag) ? LM_TC_SYMB: varcode);
+           MathedTextCodes char_code = varcode;
+           if (greek_kb_flag) {
+                   char greek[26] = 
+                   {'A', 'B', 'X',  0 , 'E',  0 ,  0 , 'H', 'I',  0 ,
+                    'K',  0 , 'M', 'N', 'O',  0 ,  0 , 'P',  0 , 'T',
+                    'Y',  0,   0,   0,   0 , 'Z' };
+                   if ('A' <= c && c <= 'Z' && greek[c - 'A']) {
+                           char_code = LM_TC_RM;
+                           c = greek[c - 'A'];
+                   } else
+                           char_code = LM_TC_SYMB;
+           }
+           mathcursor->Insert(c, char_code);
+           if (greek_kb_flag && char_code == LM_TC_RM )
+                   mathcursor->setLastCode(LM_TC_VAR);
            varcode = LM_TC_MIN;
            if (greek_kb_flag<2) greek_kb_flag = 0;
         } else 
index 0d7c82642ae112a83a03e2d2bf585f108bbc5691..8eaf226a796a820d63aecb0e0a38b83afebe6a3c 100644 (file)
@@ -43,7 +43,7 @@ using std::max;
 using std::endl;
 using std::ostream;
 
-extern short greek_kb_flag;
+extern int greek_kb_flag;
 
 extern BufferView * current_view;
 
@@ -121,21 +121,11 @@ static char const * latex_dots[] = {
    "ldots", "cdots", "vdots", "ddots"
 };
 
-static signed char latin2greek[] =  {
-  0, 1, 25, 3, 4, 23, 2, 7, 10, 24, 11, 12, 13, 14, -1, 16, 8, 18,
-  19, 21, 22, 17, 27, 15, 26, 6
-};
-static signed char Latin2Greek[] =  {
- -1, -1, -1, 1, -1, 8, 0, -1, -1, -1, -1, 3, -1, -1, -1,
- 5, 2, -1, 6, -1, 7, -1, 10, 4, 9, -1
-}; 
-
 extern char const ** mathed_get_pixmap_from_icon(int d);
 extern "C" void math_cb(FL_OBJECT*, long);
 static char const ** pixmapFromBitmapData(char const *, int, int);
 void math_insert_symbol(char const * s);
-Bool math_insert_greek(char const c);
+bool math_insert_greek(char c);
 
 BitmapMenu * BitmapMenu::active = 0;
 
@@ -340,28 +330,32 @@ char const ** get_pixmap_from_symbol(char const * arg, int wx, int hx)
    return data;
 }
 
-Bool math_insert_greek(char const c)
+bool math_insert_greek(char c)
 {
-   int i;
-   char const * s= 0;
-   
-   if ('A' <= c && c <= 'Z') {
-      if ((i = Latin2Greek[c - 'A']) >= 0)
-       s = latex_greek[i];
-   }   
-   if ('a'<= c && c<= 'z') {
-      if ((i= latin2greek[c - 'a'])>= 0)
-       s = latex_greek[i+11];
+   if (current_view->available() &&
+       (('A' <= c && c <= 'Z') ||
+       ('a'<= c && c<= 'z')))   {
+      string tmp;
+      tmp = c;
+      if (!current_view->the_locking_inset) {
+        int greek_kb_flag_save = greek_kb_flag;
+        InsetFormula * new_inset = new InsetFormula();
+        current_view->beforeChange();
+        current_view->insertInset(new_inset);
+//      Update(1);//BUG
+        new_inset->Edit(current_view, 0, 0, 0);
+        new_inset->LocalDispatch(current_view, LFUN_SELFINSERT, tmp);
+        if (greek_kb_flag_save < 2)
+                current_view->unlockInset(current_view->the_locking_inset);
+      } else
+        if (current_view->the_locking_inset->LyxCode() == Inset::MATH_CODE)
+               static_cast<InsetFormula*>(current_view->the_locking_inset)->LocalDispatch(current_view, LFUN_SELFINSERT, tmp);
+        else
+               lyxerr << "Math error: attempt to write on a wrong "
+                       "class of inset." << endl;
+      return true;
    }
-   if (s) {
-      math_insert_symbol(s);
-      if (greek_kb_flag<2) {
-        greek_kb_flag = 0;
-        current_view->unlockInset(current_view->the_locking_inset);
-      }
-      return True;
-   } else
-     return False; 
+   return false;
 }
 
 
index 1822d79637b900f6b8c053dfc063d45d645395ab..c30089e73607219c3fb3e1795589b8a5fc70cdd3 100644 (file)
@@ -4542,13 +4542,11 @@ void LyXParagraph::ChangeLanguage(BufferParams const & bparams,
 
 bool LyXParagraph::isMultiLingual(BufferParams const & bparams)
 {
-       Language const * doc_language =
-               bparams.language_info;
-       for(size_type i = 0; i < size(); ++i) {
-               LyXFont font = GetFontSettings(bparams, i);
-               if (font.language() != doc_language)
+       Language const * doc_language = bparams.language_info;
+       for (FontList::const_iterator cit = fontlist.begin();
+            cit != fontlist.end(); ++cit)
+               if ((*cit).font.language() != doc_language)
                        return true;
-       }
        return false;
 }