]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettext.C
insetcharstyle drawing cosmetics
[lyx.git] / src / insets / insettext.C
index 139e4e8884c778fb983af275c80f713a65b034e8..ba6feb7617bebfc96a5168a871c7f8b84bf349dc 100644 (file)
@@ -69,7 +69,7 @@ using std::vector;
 
 
 InsetText::InsetText(BufferParams const & bp)
-       : autoBreakRows_(false), drawFrame_(NEVER),
+       : autoBreakRows_(false), drawFrame_(false),
          frame_color_(LColor::insetframe), text_(0)
 {
        paragraphs().push_back(Paragraph());
@@ -205,7 +205,7 @@ void InsetText::draw(PainterInfo & pi, int x, int y) const
 
        text_.draw(pi, x, y + bv->top_y());
 
-       if (drawFrame_ == ALWAYS || drawFrame_ == LOCKED)
+       if (drawFrame_)
                drawFrame(pi.pain, x, y);
 }
 
@@ -249,7 +249,7 @@ void InsetText::updateLocal(LCursor & cur)
                        }
 
                        cur.clearSelection();
-                       mergeParagraph(cur.bv().buffer()->params(), paragraphs(), 0);
+                       mergeParagraph(cur.buffer().params(), paragraphs(), 0);
                }
        }
 
@@ -259,7 +259,7 @@ void InsetText::updateLocal(LCursor & cur)
        LyXView * lv = cur.bv().owner();
        lv->view_state_changed();
        lv->updateMenubar();
-       lv->updateToolbar();
+       lv->updateToolbars();
        if (old_par != cur.par()) {
                lv->setLayout(text_.getPar(cur.par()).layout()->name());
                old_par = cur.par();
@@ -273,18 +273,6 @@ string const InsetText::editMessage() const
 }
 
 
-void InsetText::sanitizeEmptyText(BufferView & bv)
-{
-       if (paragraphs().size() == 1
-           && paragraphs().begin()->empty()
-           && bv.getParentLanguage(this) != text_.current_font.language()) {
-               LyXFont font(LyXFont::ALL_IGNORE);
-               font.setLanguage(bv.getParentLanguage(this));
-               text_.setFont(bv.cursor(), font, false);
-       }
-}
-
-
 void InsetText::edit(LCursor & cur, bool left)
 {
        //lyxerr << "InsetText: edit left/right" << endl;
@@ -295,7 +283,6 @@ void InsetText::edit(LCursor & cur, bool left)
        text_.setCursor(cur.top(), par, pos);
        cur.clearSelection();
        finishUndo();
-       sanitizeEmptyText(cur.bv());
 #ifdef WITH_WARNINGS
 #warning can someone check if/when this is needed?
 #endif
@@ -304,9 +291,8 @@ void InsetText::edit(LCursor & cur, bool left)
 }
 
 
-InsetBase * InsetText::editXY(LCursor & cur, int x, int y)
+InsetBase * InsetText::editXY(LCursor & cur, int x, int y) const
 {
-       lyxerr << "InsetText::edit xy" << endl;
        old_par = -1;
        return text_.editXY(cur, x, y);
        //sanitizeEmptyText(cur.bv());
@@ -322,16 +308,6 @@ void InsetText::priv_dispatch(LCursor & cur, FuncRequest & cmd)
        bool was_empty = paragraphs().begin()->empty() && paragraphs().size() == 1;
        text_.dispatch(cur, cmd);
 
-       // If the action has deleted all text in the inset, we need
-       // to change the language to the language of the surronding
-       // text.
-       // Why this cleverness? (Andre')
-       if (!was_empty && paragraphs().begin()->empty() &&
-           paragraphs().size() == 1) {
-               LyXFont font(LyXFont::ALL_IGNORE);
-               font.setLanguage(cur.bv().getParentLanguage(this));
-               text_.setFont(cur, font, false);
-       }
 }
 
 
@@ -376,7 +352,7 @@ int InsetText::linuxdoc(Buffer const & buf, ostream & os,
 int InsetText::docbook(Buffer const & buf, ostream & os,
                       OutputParams const & runparams) const
 {
-       docbookParagraphs(buf, paragraphs(), os, runparams);
+       docbookParagraphs(paragraphs(), buf, os, runparams);
        return 0;
 }
 
@@ -388,10 +364,10 @@ void InsetText::validate(LaTeXFeatures & features) const
 }
 
 
-void InsetText::getCursorPos(CursorSlice const & cur, int & x, int & y) const
+void InsetText::getCursorPos(LCursor const & cur, int & x, int & y) const
 {
-       x = text_.cursorX(cur);
-       y = text_.cursorY(cur);
+       x = text_.cursorX(cur.top());
+       y = text_.cursorY(cur.top());
 }
 
 
@@ -448,9 +424,9 @@ void InsetText::setAutoBreakRows(bool flag)
 }
 
 
-void InsetText::setDrawFrame(DrawFrame how)
+void InsetText::setDrawFrame(bool flag)
 {
-       drawFrame_ = how;
+       drawFrame_ = flag;
 }