]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbranch.C
Bug fix in branches (was earlier fixed wrongly)
[lyx.git] / src / insets / insetbranch.C
index 100fd72ed789f8e15d19d0a0605f447377e27d98..1262a52fad35b0089251fb19edf521a490350a32 100644 (file)
@@ -17,6 +17,7 @@
 #include "BufferView.h"
 #include "funcrequest.h"
 #include "gettext.h"
+#include "LColor.h"
 #include "lyxlex.h"
 #include "paragraph.h"
 
@@ -31,6 +32,7 @@ using std::ostringstream;
 void InsetBranch::init()
 {
        setInsetName("Branch");
+       setButtonLabel();
 }
 
 
@@ -40,7 +42,7 @@ InsetBranch::InsetBranch(BufferParams const & bp, string const & label)
        params_.branch = label;
        // Hack: stash the list of all allowable branch labels from this
        // buffer into inset's parm list as a "stowaway":
-       params_.branchlist = bp.branchlist;
+       params_.branchlist = bp.branchlist();
        init();
 }
 
@@ -97,10 +99,9 @@ void InsetBranch::setButtonLabel()
 
        setLabel("Branch: " + params_.branch);
        font.setColor(LColor::foreground);
-       string const color = params_.branchlist.getColor(params_.branch);
-       if (!color.empty()) {
+       if (!params_.branch.empty())
                setBackgroundColor(lcolor.getFromLyXName(params_.branch));
-       else
+       else
                setBackgroundColor(LColor::background);
        setLabelFont(font);
 }
@@ -129,7 +130,7 @@ dispatch_result InsetBranch::localDispatch(FuncRequest const & cmd)
        case LFUN_INSET_EDIT:
                if (cmd.button() != mouse_button::button3)
                        return InsetCollapsable::localDispatch(cmd);
-               
+
                return UNDISPATCHED;
        case LFUN_INSET_DIALOG_UPDATE:
                InsetBranchMailer("branch", *this).updateDialog(bv);
@@ -149,7 +150,7 @@ dispatch_result InsetBranch::localDispatch(FuncRequest const & cmd)
 int InsetBranch::latex(Buffer const & buf, ostream & os,
        LatexRunParams const & runparams) const
 {
-       string const branch_sel = buf.params().branchlist.allSelected();
+       string const branch_sel = buf.params().branchlist().allSelected();
        if (branch_sel.find(params_.branch, 0) != string::npos)
                return inset.latex(buf, os, runparams);
        return 0;
@@ -165,7 +166,7 @@ int InsetBranch::linuxdoc(Buffer const &, std::ostream &) const
 int InsetBranch::docbook(Buffer const & buf, std::ostream & os, bool mixcont) const
 {
        // untested - MV
-       string const branch_sel = buf.params().branchlist.allSelected();
+       string const branch_sel = buf.params().branchlist().allSelected();
        if (branch_sel.find(params_.branch, 0) != string::npos)
                return inset.docbook(buf, os, mixcont);
        return 0;
@@ -174,7 +175,7 @@ int InsetBranch::docbook(Buffer const & buf, std::ostream & os, bool mixcont) co
 
 int InsetBranch::ascii(Buffer const & buf, std::ostream & os, int ll) const
 {
-       string const branch_sel = buf.params().branchlist.allSelected();
+       string const branch_sel = buf.params().branchlist().allSelected();
        if (branch_sel.find(params_.branch, 0) != string::npos) {
                return inset.ascii(buf, os, ll);
        }
@@ -199,21 +200,21 @@ InsetBranchMailer::InsetBranchMailer(string const & name,
 string const InsetBranchMailer::inset2string(Buffer const & buf) const
 {
        InsetBranchParams params = inset_.params();
-       params.branchlist = buf.params().branchlist;
+       params.branchlist = buf.params().branchlist();
        inset_.setParams(params);
        return params2string(name_, params);
 }
 
 
 string const InsetBranchMailer::params2string(string const & name,
-                               InsetBranchParams const & params)
+                                             InsetBranchParams const & params)
 {
        ostringstream data;
        data << name << ' ';
        params.write(data);
        // Add all_branches parameter to data:
        data << params.branchlist.allBranches() << "\n";
-       return STRCONV(data.str());
+       return data.str();
 }
 
 
@@ -225,7 +226,7 @@ void InsetBranchMailer::string2params(string const & in,
        if (in.empty())
                return;
 
-       istringstream data(STRCONV(in));
+       istringstream data(in);
        LyXLex lex(0,0);
        lex.setStream(data);
        params.read(lex);