]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbranch.C
Get rid of trailing whitespace 'noise' in future patches for the
[lyx.git] / src / insets / insetbranch.C
index b5115422dcefde213eb9a8fb1d5f955241a34627..c01cccddb8139f7054c2ecaf88b8f22c5a8ac63e 100644 (file)
@@ -5,35 +5,32 @@
  *
  * \author Martin Vermeer
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
-#include "Lsstream.h"
-
 #include "insetbranch.h"
-#include "gettext.h"
-#include "lyxfont.h"
-#include "language.h"
+
 #include "buffer.h"
+#include "bufferparams.h"
 #include "BufferView.h"
-#include "LaTeXFeatures.h"
-#include "latexrunparams.h"
+#include "funcrequest.h"
+#include "gettext.h"
 #include "lyxlex.h"
-#include "lyxtext.h"
-#include "insets/insettext.h"
-#include "support/LOstream.h"
-#include "support/lstrings.h"
-#include "debug.h"
+#include "paragraph.h"
+
+#include "support/std_sstream.h"
 
-using std::ostream;
 using std::auto_ptr;
+using std::istringstream;
+using std::ostream;
+using std::ostringstream;
+
 
 void InsetBranch::init()
 {
        setInsetName("Branch");
-       setButtonLabel();
 }
 
 
@@ -43,7 +40,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();
 }
 
@@ -74,14 +71,14 @@ string const InsetBranch::editMessage() const
 }
 
 
-void InsetBranch::write(Buffer const * buf, ostream & os) const
+void InsetBranch::write(Buffer const & buf, ostream & os) const
 {
        params_.write(os);
        InsetCollapsable::write(buf, os);
 }
 
 
-void InsetBranch::read(Buffer const * buf, LyXLex & lex)
+void InsetBranch::read(Buffer const & buf, LyXLex & lex)
 {
        if (lex.isOK()) {
                lex.next();
@@ -98,7 +95,7 @@ void InsetBranch::setButtonLabel()
        font.decSize();
        font.decSize();
 
-       setLabel(params_.branch);
+       setLabel("Branch: " + params_.branch);
        font.setColor(LColor::foreground);
        string const color = params_.branchlist.getColor(params_.branch);
        if (!color.empty()) {
@@ -109,19 +106,6 @@ void InsetBranch::setButtonLabel()
 }
 
 
-void InsetBranch::metrics(MetricsInfo & mi, Dimension & dim) const
-{
-       InsetCollapsable::metrics(mi, dim);
-       dim_ = dim;
-}
-
-
-void InsetBranch::draw(PainterInfo & pi, int x, int y) const
-{
-       InsetCollapsable::draw(pi, x, y);
-}
-
-
 bool InsetBranch::showInsetDialog(BufferView * bv) const
 {
        InsetBranchMailer("branch", const_cast<InsetBranch &>(*this)).showDialog(bv);
@@ -139,12 +123,13 @@ dispatch_result InsetBranch::localDispatch(FuncRequest const & cmd)
                InsetBranchMailer::string2params(cmd.argument, params);
                params_.branch = params.branch;
                setButtonLabel();
-               bv->updateInset();
+               bv->updateInset(this);
                return DISPATCHED;
                }
        case LFUN_INSET_EDIT:
-               if (cmd.button() != mouse_button::button3) 
+               if (cmd.button() != mouse_button::button3)
                        return InsetCollapsable::localDispatch(cmd);
+
                return UNDISPATCHED;
        case LFUN_INSET_DIALOG_UPDATE:
                InsetBranchMailer("branch", *this).updateDialog(bv);
@@ -161,36 +146,35 @@ dispatch_result InsetBranch::localDispatch(FuncRequest const & cmd)
 }
 
 
-
-int InsetBranch::latex(Buffer const * buf, ostream & os,
+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;
 }
 
 
-int InsetBranch::linuxdoc(Buffer const *, std::ostream &) const
-{ 
-       return 0; 
+int InsetBranch::linuxdoc(Buffer const &, std::ostream &) const
+{
+       return 0;
 }
 
 
-int InsetBranch::docbook(Buffer const * buf, std::ostream & os, bool mixcont) const
+int InsetBranch::docbook(Buffer const & buf, std::ostream & os, bool mixcont) const
 {
        // untested - MV
-       string const branch_sel = buf->params.branchlist.allSelected();
-       if (branch_sel.find(params_.branch, 0) != string::npos) 
+       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;
 }
 
 
-int InsetBranch::ascii(Buffer const * buf, std::ostream & os, int ll) const
+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);
        }
@@ -215,14 +199,14 @@ 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 << ' ';
@@ -274,4 +258,3 @@ void InsetBranchParams::read(LyXLex & lex)
                branch = lex.getString();
        }
 }
-