]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetText.cpp
InsetTabular.cpp: fix #6585 also for wrapped floats - thanks Vincent
[lyx.git] / src / insets / InsetText.cpp
index c29742cb0e2e34c87ceeb31c3069b291c1022dc1..9cccee55c538ba30298928a203eaeae32d4539ee 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "InsetText.h"
 
-#include "insets/InsetOptArg.h"
+#include "insets/InsetArgument.h"
 
 #include "buffer_funcs.h"
 #include "Buffer.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
 
-#include <boost/bind.hpp>
+#include "support/bind.h"
 #include "support/lassert.h"
 
+#include <algorithm>
+
+
 using namespace std;
 using namespace lyx::support;
 
-using boost::bind;
-using boost::ref;
 
 namespace lyx {
 
@@ -241,7 +242,7 @@ Inset * InsetText::editXY(Cursor & cur, int x, int y)
 void InsetText::doDispatch(Cursor & cur, FuncRequest & cmd)
 {
        LYXERR(Debug::ACTION, "InsetText::doDispatch()"
-               << " [ cmd.action_ = " << cmd.action_ << ']');
+               << " [ cmd.action() = " << cmd.action() << ']');
 
        if (getLayout().isPassThru()) {
                // Force any new text to latex_language FIXME: This
@@ -254,7 +255,7 @@ void InsetText::doDispatch(Cursor & cur, FuncRequest & cmd)
                cur.real_current_font.setLanguage(latex_language);
        }
 
-       switch (cmd.action_) {
+       switch (cmd.action()) {
        case LFUN_PASTE:
        case LFUN_CLIPBOARD_PASTE:
        case LFUN_SELECTION_PASTE:
@@ -297,7 +298,7 @@ void InsetText::doDispatch(Cursor & cur, FuncRequest & cmd)
 bool InsetText::getStatus(Cursor & cur, FuncRequest const & cmd,
        FuncStatus & status) const
 {
-       switch (cmd.action_) {
+       switch (cmd.action()) {
        case LFUN_INSET_DISSOLVE: {
                bool const main_inset = &buffer().inset() == this;
                bool const target_inset = cmd.argument().empty() 
@@ -396,7 +397,7 @@ int InsetText::latex(odocstream & os, OutputParams const & runparams) const
        }
        OutputParams rp = runparams;
        if (il.isPassThru())
-               rp.verbatim = true;
+               rp.pass_thru = true;
        if (il.isNeedProtect())
                rp.moving_arg = true;
 
@@ -404,6 +405,7 @@ int InsetText::latex(odocstream & os, OutputParams const & runparams) const
        TexRow texrow;
        latexParagraphs(buffer(), text_, os, texrow, rp);
        rows += texrow.rows();
+       runparams.encoding = rp.encoding;
 
        if (!il.latexname().empty()) {
                if (il.latextype() == InsetLayout::COMMAND) {
@@ -698,12 +700,12 @@ void InsetText::addToToc(DocIterator const & cdit)
                        //lyxerr << (void*)&inset << " code: " << inset.lyxCode() << std::endl;
                        inset.addToToc(dit);
                        switch (inset.lyxCode()) {
-                       case OPTARG_CODE: {
+                       case ARG_CODE: {
                                if (!tocstring.empty())
                                        break;
                                dit.pos() = 0;
                                Paragraph const & insetpar =
-                                       *static_cast<InsetOptArg&>(inset).paragraphs().begin();
+                                       *static_cast<InsetArgument&>(inset).paragraphs().begin();
                                if (!par.labelString().empty())
                                        tocstring = par.labelString() + ' ';
                                tocstring += insetpar.asString(AS_STR_INSETS);
@@ -720,7 +722,8 @@ void InsetText::addToToc(DocIterator const & cdit)
                        // insert this into the table of contents
                        if (tocstring.empty())
                                tocstring = par.asString(AS_STR_LABEL | AS_STR_INSETS);
-                       toc.push_back(TocItem(dit, toclevel - min_toclevel, tocstring));
+                       toc.push_back(TocItem(dit, toclevel - min_toclevel,
+                               tocstring, tocstring));
                }
                
                // And now the list of changes.
@@ -817,6 +820,18 @@ docstring InsetText::contextMenu(BufferView const &, int, int) const
 }
 
 
+docstring InsetText::toolTipText() const
+{
+       OutputParams rp(&buffer().params().encoding());
+       odocstringstream ods;
+       // do not remove InsetText::, otherwise there
+       // will be no tooltip text for InsetNotes
+       InsetText::plaintext(ods, rp);
+       docstring const content_tip = ods.str();
+       return support::wrapParas(content_tip, 4);
+}
+
+
 InsetCaption const * InsetText::getCaptionInset() const
 {
        ParagraphList::const_iterator pit = paragraphs().begin();