]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbranch.C
* In the process of fixing the math background color bug, this commit transfer backgr...
[lyx.git] / src / insets / insetbranch.C
index 9671ef86b5beda8258db0533ff39bf46a9ee9d50..3c28c079c6eef8958169aa9422c62cb036c9163f 100644 (file)
@@ -23,6 +23,7 @@
 #include "LColor.h"
 #include "lyxlex.h"
 #include "paragraph.h"
+#include "outputparams.h"
 
 #include <sstream>
 
@@ -97,11 +98,11 @@ void InsetBranch::setButtonLabel()
        font.decSize();
        font.decSize();
 
-       // FIXME UNICODE
-       docstring s = _("Branch: ") + from_utf8(params_.branch);
+       docstring s = _("Branch: ") + params_.branch;
        font.setColor(LColor::foreground);
        if (!params_.branch.empty()) {
-               LColor_color c = lcolor.getFromLyXName(params_.branch);
+               // FIXME UNICODE
+               LColor_color c = lcolor.getFromLyXName(to_utf8(params_.branch));
                if (c == LColor::none) {
                        c = LColor::error;
                        s = _("Undef: ") + s;
@@ -222,26 +223,39 @@ bool InsetBranch::isBranchSelected(Buffer const & buffer) const
 
 
 int InsetBranch::latex(Buffer const & buf, odocstream & os,
-                      OutputParams const & runparams) const
+                       OutputParams const & runparams) const
 {
        return isBranchSelected(buf) ?
                InsetText::latex(buf, os, runparams) : 0;
 }
 
 
+int InsetBranch::plaintext(Buffer const & buf, odocstream & os,
+                           OutputParams const & runparams) const
+{
+       if (!isBranchSelected(buf))
+               return 0;
+
+       os << '[' << _("branch") << ' ' << params_.branch << ":\n";
+       InsetText::plaintext(buf, os, runparams);
+       os << "\n]";
+
+       return PLAINTEXT_NEWLINE + 1; // one char on a separate line
+}
+
+
 int InsetBranch::docbook(Buffer const & buf, odocstream & os,
-                        OutputParams const & runparams) const
+                         OutputParams const & runparams) const
 {
        return isBranchSelected(buf) ?
                InsetText::docbook(buf, os, runparams) : 0;
 }
 
 
-int InsetBranch::plaintext(Buffer const & buf, odocstream & os,
-                          OutputParams const & runparams) const
+void InsetBranch::textString(Buffer const & buf, odocstream & os) const
 {
-       return isBranchSelected(buf) ?
-               InsetText::plaintext(buf, os, runparams): 0;
+       if (isBranchSelected(buf))
+               os << paragraphs().begin()->asString(buf, true);
 }
 
 
@@ -303,7 +317,7 @@ void InsetBranchMailer::string2params(string const & in,
 
 void InsetBranchParams::write(ostream & os) const
 {
-       os << "Branch " << branch << '\n';
+       os << "Branch " << to_utf8(branch) << '\n';
 }