]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbranch.C
* src/LyXAction.C: mark goto-clear-bookmark as working without buffer
[lyx.git] / src / insets / insetbranch.C
index 9b08b7c7d19d46f0ce88d0cec5edeb76f6f65739..d39d69c718adfa5716e679c9fdecbfba235e1e53 100644 (file)
@@ -26,7 +26,8 @@
 
 #include <sstream>
 
-using lyx::docstring;
+
+namespace lyx {
 
 using std::string;
 using std::auto_ptr;
@@ -37,7 +38,7 @@ using std::ostringstream;
 
 void InsetBranch::init()
 {
-       setInsetName("Branch");
+       setInsetName(from_utf8("Branch"));
        setButtonLabel();
 }
 
@@ -96,15 +97,14 @@ void InsetBranch::setButtonLabel()
        font.decSize();
        font.decSize();
 
-       // FIXME UNICODE
-       string s = lyx::to_utf8(_("Branch: ")) + 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;
-                       // FIXME UNICODE
-                       s = lyx::to_utf8(_("Undef: ")) + s;
+                       s = _("Undef: ") + s;
                }
                setBackgroundColor(c);
        } else
@@ -126,7 +126,7 @@ void InsetBranch::doDispatch(LCursor & cur, FuncRequest & cmd)
        switch (cmd.action) {
        case LFUN_INSET_MODIFY: {
                InsetBranchParams params;
-               InsetBranchMailer::string2params(lyx::to_utf8(cmd.argument()), params);
+               InsetBranchMailer::string2params(to_utf8(cmd.argument()), params);
                params_.branch = params.branch;
                setButtonLabel();
                break;
@@ -221,7 +221,7 @@ bool InsetBranch::isBranchSelected(Buffer const & buffer) const
 }
 
 
-int InsetBranch::latex(Buffer const & buf, ostream & os,
+int InsetBranch::latex(Buffer const & buf, odocstream & os,
                       OutputParams const & runparams) const
 {
        return isBranchSelected(buf) ?
@@ -229,7 +229,7 @@ int InsetBranch::latex(Buffer const & buf, ostream & os,
 }
 
 
-int InsetBranch::docbook(Buffer const & buf, std::ostream & os,
+int InsetBranch::docbook(Buffer const & buf, odocstream & os,
                         OutputParams const & runparams) const
 {
        return isBranchSelected(buf) ?
@@ -237,7 +237,7 @@ int InsetBranch::docbook(Buffer const & buf, std::ostream & os,
 }
 
 
-int InsetBranch::plaintext(Buffer const & buf, std::ostream & os,
+int InsetBranch::plaintext(Buffer const & buf, odocstream & os,
                           OutputParams const & runparams) const
 {
        return isBranchSelected(buf) ?
@@ -245,6 +245,13 @@ int InsetBranch::plaintext(Buffer const & buf, std::ostream & os,
 }
 
 
+void InsetBranch::textString(Buffer const & buf, odocstream & os) const
+{
+       if (isBranchSelected(buf))
+               os << paragraphs().begin()->asString(buf, true);
+}
+
+
 void InsetBranch::validate(LaTeXFeatures & features) const
 {
        InsetText::validate(features);
@@ -303,7 +310,7 @@ void InsetBranchMailer::string2params(string const & in,
 
 void InsetBranchParams::write(ostream & os) const
 {
-       os << "Branch " << branch << '\n';
+       os << "Branch " << to_utf8(branch) << '\n';
 }
 
 
@@ -311,3 +318,5 @@ void InsetBranchParams::read(LyXLex & lex)
 {
        lex >> branch;
 }
+
+} // namespace lyx