]> git.lyx.org Git - lyx.git/blobdiff - src/text2.C
Added new FINISED states FINISHED_RIGHT, FINISHED_UP, FINISHED_DOWN.
[lyx.git] / src / text2.C
index 186c7739a8f042cd617bbcbbc2c9f03ce861007c..b4fb6d2895d34f21f577dde4f463f99013f6b77b 100644 (file)
@@ -120,16 +120,26 @@ LyXFont const realizeFont(LyXFont const & font,
        while (par && par_depth && !tmpfont.resolved()) {
                par = par->outerHook();
                if (par) {
+#ifndef INHERIT_LANGUAGE
+                       tmpfont.realize(textclasslist.
+                                       Style(buf->params.textclass,
+                                             par->getLayout()).font);
+#else
                        tmpfont.realize(textclasslist.
                                        Style(buf->params.textclass,
                                              par->getLayout()).font,
-                                                       buf->params.language);
+                                       buf->params.language);
+#endif
                        par_depth = par->getDepth();
                }
        }
 
+#ifndef INHERIT_LANGUAGE
+       tmpfont.realize(textclasslist.TextClass(buf->params.textclass).defaultfont());
+#else
        tmpfont.realize(textclasslist.TextClass(buf->params.textclass).defaultfont(),
                        buf->params.language);
+#endif
 
        return tmpfont;
 }
@@ -160,10 +170,18 @@ LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par,
                                // 1% goes here
                        LyXFont f = par->getFontSettings(buf->params,
                                                         pos);
+#ifndef INHERIT_LANGUAGE
+                       return f.realize(layout.reslabelfont);
+#else
                        return f.realize(layout.reslabelfont, buf->params.language);
+#endif
                } else {
                        LyXFont f = par->getFontSettings(buf->params, pos);
+#ifndef INHERIT_LANGUAGE
+                       return f.realize(layout.resfont);
+#else
                        return f.realize(layout.resfont, buf->params.language);
+#endif
                }
        }
        
@@ -180,7 +198,11 @@ LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par,
        }
 
        LyXFont tmpfont = par->getFontSettings(buf->params, pos);
+#ifndef INHERIT_LANGUAGE
+       tmpfont.realize(layoutfont);
+#else
        tmpfont.realize(layoutfont, buf->params.language);
+#endif
        
        return realizeFont(tmpfont, buf, par);
 }
@@ -222,7 +244,7 @@ void LyXText::setCharFont(BufferView * bv, Paragraph * par,
 {
        Buffer const * buf = bv->buffer();
        LyXFont font = getFont(buf, par, pos);
-       font.update(fnt, toggleall);
+       font.update(fnt, buf->params.language, toggleall);
        // Let the insets convert their font
        if (par->getChar(pos) == Paragraph::META_INSET) {
                Inset * inset = par->getInset(pos);
@@ -253,15 +275,25 @@ void LyXText::setCharFont(BufferView * bv, Paragraph * par,
                while (!layoutfont.resolved() && tp && tp->getDepth()) {
                        tp = tp->outerHook();
                        if (tp)
+#ifndef INHERIT_LANGUAGE
+                               layoutfont.realize(textclasslist.
+                                                  Style(buf->params.textclass,
+                                                        tp->getLayout()).font);
+#else
                                layoutfont.realize(textclasslist.
                                                   Style(buf->params.textclass,
                                                         tp->getLayout()).font,
                                                   buf->params.language);
+#endif
                }
        }
 
+#ifndef INHERIT_LANGUAGE
+       layoutfont.realize(textclasslist.TextClass(buf->params.textclass).defaultfont());
+#else
        layoutfont.realize(textclasslist.TextClass(buf->params.textclass).defaultfont(),
                           buf->params.language);
+#endif
 
        // Now, reduce font against full layout font
        font.reduce(layoutfont);
@@ -293,15 +325,25 @@ void LyXText::setCharFont(Buffer const * buf, Paragraph * par,
                while (!layoutfont.resolved() && tp && tp->getDepth()) {
                        tp = tp->outerHook();
                        if (tp)
+#ifndef INHERIT_LANGUAGE
+                               layoutfont.realize(textclasslist.
+                                                  Style(buf->params.textclass,
+                                                        tp->getLayout()).font);
+#else
                                layoutfont.realize(textclasslist.
                                                   Style(buf->params.textclass,
                                                         tp->getLayout()).font,
                                                   buf->params.language);
+#endif
                }
        }
 
+#ifndef INHERIT_LANGUAGE
+       layoutfont.realize(textclasslist.TextClass(buf->params.textclass).defaultfont());
+#else
        layoutfont.realize(textclasslist.TextClass(buf->params.textclass).defaultfont(),
                           buf->params.language);
+#endif
 
        // Now, reduce font against full layout font
        font.reduce(layoutfont);
@@ -706,14 +748,20 @@ void LyXText::setFont(BufferView * bview, LyXFont const & font, bool toggleall)
                                                   cursor.par());
                }
                // Update current font
-               real_current_font.update(font, toggleall);
+               real_current_font.update(font, 
+                                        bview->buffer()->params.language,
+                                        toggleall);
 
                // Reduce to implicit settings
                current_font = real_current_font;
                current_font.reduce(layoutfont);
                // And resolve it completely
+#ifndef INHERIT_LANGUAGE
+               real_current_font.realize(layoutfont);
+#else
                real_current_font.realize(layoutfont,
                                          bview->buffer()->params.language);
+#endif
                return;
        }
 
@@ -1663,7 +1711,7 @@ void LyXText::pasteEnvironmentType(BufferView * bview)
 }
 
 
-void LyXText::cutSelection(BufferView * bview, bool doclear)
+void LyXText::cutSelection(BufferView * bview, bool doclear, bool realcut)
 {
        // Stuff what we got on the clipboard. Even if there is no selection.
 
@@ -1705,15 +1753,17 @@ void LyXText::cutSelection(BufferView * bview, bool doclear)
                endpar = selection.end.par();
                int pos = selection.end.pos();
                CutAndPaste::cutSelection(selection.start.par(), &endpar,
-                                         selection.start.pos(), pos,
-                                         bview->buffer()->params.textclass, doclear);
+                                         selection.start.pos(), pos,
+                                         bview->buffer()->params.textclass, doclear,
+                                         realcut);
                selection.end.pos(pos);
        } else {
                endpar = selection.end.par();
                int pos = selection.end.pos();
                CutAndPaste::cutSelection(selection.start.par(), &endpar,
-                                         selection.start.pos(), pos,
-                                         bview->buffer()->params.textclass, doclear);
+                                         selection.start.pos(), pos,
+                                         bview->buffer()->params.textclass, doclear,
+                                                                 realcut);
                cursor.par(endpar);
                selection.end.par(endpar);
                selection.end.pos(pos);
@@ -1845,7 +1895,7 @@ void LyXText::replaceSelectionWithString(BufferView * bview,
        }
        
        // Cut the selection
-       cutSelection(bview);
+       cutSelection(bview, true, false);
 
        unFreezeUndo();
 }
@@ -2038,8 +2088,8 @@ bool LyXText::updateInset(BufferView * bview, Inset * inset)
 
 
 void LyXText::setCursor(BufferView * bview, Paragraph * par,
-                       Paragraph::size_type pos, 
-                       bool setfont, bool boundary) const
+                        Paragraph::size_type pos, 
+                        bool setfont, bool boundary) const
 {
        LyXCursor old_cursor = cursor;
        setCursorIntern(bview, par, pos, setfont, boundary);
@@ -2138,18 +2188,23 @@ void LyXText::setCursorIntern(BufferView * bview, Paragraph * par,
 {
        InsetText * it = static_cast<InsetText *>(par->inInset());
        if (it) {
-               lyxerr << "InsetText   is " << it << endl;
-               lyxerr << "inset_owner is " << inset_owner << endl;
                if (it != inset_owner) {
+                       lyxerr << "InsetText   is " << it << endl;
+                       lyxerr << "inset_owner is " << inset_owner << endl;
 #warning I belive this code is wrong. (Lgb)
 #warning Jürgen, have a look at this. (Lgb)
+#warning Hmmm, I guess you are right but we
+#warning should verify when this is needed
                        // Jürgen, would you like to have a look?
                        // I guess we need to move the outer cursor
                        // and open and lock the inset (bla bla bla)
                        // stuff I don't know... so can you have a look?
                        // (Lgb)
+                       // I moved the lyxerr stuff in here so we can see if this
+                       // is actually really needed and where!
+                       // (Jug)
                        it->getLyXText(bview)->setCursorIntern(bview, par, pos, setfont,
-                                                              boundary);
+                                                              boundary);
                        return;
                }
        }