No need to pass the 'name' to each instance of InsetNoteMailer, 
InsetBranchMailer as this name is fixed for each Mailer type.

Committing now.

-- 
Angus
Index: src/frontends/controllers/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ChangeLog,v
retrieving revision 1.399
diff -u -p -r1.399 ChangeLog
--- src/frontends/controllers/ChangeLog	5 Dec 2003 14:07:22 -0000	1.399
+++ src/frontends/controllers/ChangeLog	10 Dec 2003 14:46:55 -0000
@@ -1,3 +1,11 @@
+2003-12-10  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* ControlBranch.C (dispatchParams): change to invocation of
+	InsetBranchMailer::params2string.
+
+	* ControlNote.C (dispatchParams): change to invocation of
+	InsetNoteMailer::params2string.
+
 2003-12-05  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* ControlVCLog.[Ch]: removed.
Index: src/frontends/controllers/ControlBranch.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlBranch.C,v
retrieving revision 1.5
diff -u -p -r1.5 ControlBranch.C
--- src/frontends/controllers/ControlBranch.C	6 Oct 2003 15:42:45 -0000	1.5
+++ src/frontends/controllers/ControlBranch.C	10 Dec 2003 14:46:55 -0000
@@ -41,6 +41,6 @@ void ControlBranch::clearParams()
 
 void ControlBranch::dispatchParams()
 {
-	string const lfun = InsetBranchMailer::params2string(string("branch"), params());
+	string const lfun = InsetBranchMailer::params2string(params());
 	kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
 }
Index: src/frontends/controllers/ControlNote.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlNote.C,v
retrieving revision 1.6
diff -u -p -r1.6 ControlNote.C
--- src/frontends/controllers/ControlNote.C	6 Oct 2003 15:42:46 -0000	1.6
+++ src/frontends/controllers/ControlNote.C	10 Dec 2003 14:46:56 -0000
@@ -27,12 +27,10 @@ ControlNote::ControlNote(Dialog & parent
 
 bool ControlNote::initialiseParams(string const & data)
 {
-    InsetNoteParams params;
+	InsetNoteParams params;
 	InsetNoteMailer::string2params(data, params);
 	params_.reset(new InsetNoteParams(params));
-
 	return true;
-
 }
 
 
@@ -44,7 +42,7 @@ void ControlNote::clearParams()
 
 void ControlNote::dispatchParams()
 {
-	string const lfun = InsetNoteMailer::params2string(string("note"), params());
+	string const lfun = InsetNoteMailer::params2string(params());
 	kernel().dispatch(FuncRequest(LFUN_INSET_APPLY, lfun));
 }
 
Index: src/insets/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v
retrieving revision 1.939
diff -u -p -r1.939 ChangeLog
--- src/insets/ChangeLog	10 Dec 2003 09:45:30 -0000	1.939
+++ src/insets/ChangeLog	10 Dec 2003 14:47:02 -0000
@@ -1,3 +1,7 @@
+2003-12-10  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* insetbranch.[Ch]: changes to the InsetBranchMailer interface.
+	* insetnote.[Ch]: changes to the InsetNoteMailer interface.
 
 2003-12-10  André Pönitz  <[EMAIL PROTECTED]>
 
Index: src/insets/insetbranch.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetbranch.C,v
retrieving revision 1.32
diff -u -p -r1.32 insetbranch.C
--- src/insets/insetbranch.C	28 Nov 2003 17:13:41 -0000	1.32
+++ src/insets/insetbranch.C	10 Dec 2003 14:47:03 -0000
@@ -59,7 +59,7 @@ InsetBranch::InsetBranch(InsetBranch con
 
 InsetBranch::~InsetBranch()
 {
-	InsetBranchMailer("branch", *this).hideDialog();
+	InsetBranchMailer(*this).hideDialog();
 }
 
 
@@ -111,7 +111,7 @@ void InsetBranch::setButtonLabel()
 
 bool InsetBranch::showInsetDialog(BufferView * bv) const
 {
-	InsetBranchMailer("branch", const_cast<InsetBranch &>(*this)).showDialog(bv);
+	InsetBranchMailer(const_cast<InsetBranch &>(*this)).showDialog(bv);
 	return true;
 }
 
@@ -136,12 +136,12 @@ InsetBranch::priv_dispatch(FuncRequest c
 		return DispatchResult(false);
 
 	case LFUN_INSET_DIALOG_UPDATE:
-		InsetBranchMailer("branch", *this).updateDialog(bv);
+		InsetBranchMailer(*this).updateDialog(bv);
 		return DispatchResult(true);
 
 	case LFUN_MOUSE_RELEASE:
 		if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
-			InsetBranchMailer("branch", *this).showDialog(bv);
+			InsetBranchMailer(*this).showDialog(bv);
 			return DispatchResult(true);
 		}
 		return InsetCollapsable::priv_dispatch(cmd, idx, pos);
@@ -200,11 +200,11 @@ void InsetBranch::validate(LaTeXFeatures
 
 
 
-InsetBranchMailer::InsetBranchMailer(string const & name,
-						InsetBranch & inset)
-	: name_(name), inset_(inset)
-{
-}
+string const InsetBranchMailer:: name_("branch");
+
+InsetBranchMailer::InsetBranchMailer(InsetBranch & inset)
+	: inset_(inset)
+{}
 
 
 string const InsetBranchMailer::inset2string(Buffer const & buf) const
@@ -212,15 +212,14 @@ string const InsetBranchMailer::inset2st
 	InsetBranchParams params = inset_.params();
 	params.branchlist = buf.params().branchlist();
 	inset_.setParams(params);
-	return params2string(name_, params);
+	return params2string(params);
 }
 
 
-string const InsetBranchMailer::params2string(string const & name,
-					      InsetBranchParams const & params)
+string const InsetBranchMailer::params2string(InsetBranchParams const & params)
 {
 	ostringstream data;
-	data << name << ' ';
+	data << name_ << ' ';
 	params.write(data);
 	// Add all_branches parameter to data:
 	data << params.branchlist.allBranches() << "\n";
@@ -229,7 +228,7 @@ string const InsetBranchMailer::params2s
 
 
 void InsetBranchMailer::string2params(string const & in,
-				     InsetBranchParams & params)
+				      InsetBranchParams & params)
 {
 	params = InsetBranchParams();
 
@@ -239,6 +238,12 @@ void InsetBranchMailer::string2params(st
 	istringstream data(in);
 	LyXLex lex(0,0);
 	lex.setStream(data);
+
+	string name;
+	lex >> name;
+	if (name != name_)
+		return;
+
 	params.read(lex);
 	// Process all_branches here:
 	if (lex.isOK()) {
Index: src/insets/insetbranch.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetbranch.h,v
retrieving revision 1.10
diff -u -p -r1.10 insetbranch.h
--- src/insets/insetbranch.h	5 Nov 2003 12:06:07 -0000	1.10
+++ src/insets/insetbranch.h	10 Dec 2003 14:47:03 -0000
@@ -90,7 +90,7 @@ private:
 class InsetBranchMailer : public MailInset {
 public:
 	///
-	InsetBranchMailer(std::string const & name, InsetBranch & inset);
+	InsetBranchMailer(InsetBranch & inset);
 	///
 	virtual InsetBase & inset() const { return inset_; }
 	///
@@ -98,13 +98,13 @@ public:
 	///
 	virtual std::string const inset2string(Buffer const &) const;
 	///
-	static std::string const params2string(std::string const &, InsetBranchParams const &);
+	static std::string const params2string(InsetBranchParams const &);
 	///
 	static void string2params(std::string const &, InsetBranchParams &);
 
 private:
 	///
-	std::string const name_;
+	static std::string const name_;
 	///
 	InsetBranch & inset_;
 };
Index: src/insets/insetnote.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetnote.C,v
retrieving revision 1.66
diff -u -p -r1.66 insetnote.C
--- src/insets/insetnote.C	3 Dec 2003 18:17:17 -0000	1.66
+++ src/insets/insetnote.C	10 Dec 2003 14:47:04 -0000
@@ -58,7 +58,7 @@ InsetNote::InsetNote(InsetNote const & i
 
 InsetNote::~InsetNote()
 {
-	InsetNoteMailer("note", *this).hideDialog();
+	InsetNoteMailer(*this).hideDialog();
 }
 
 
@@ -113,7 +113,7 @@ void InsetNote::setButtonLabel()
 
 bool InsetNote::showInsetDialog(BufferView * bv) const
 {
-	InsetNoteMailer("note", const_cast<InsetNote &>(*this)).showDialog(bv);
+	InsetNoteMailer(const_cast<InsetNote &>(*this)).showDialog(bv);
 	return true;
 }
 
@@ -134,12 +134,12 @@ InsetNote::priv_dispatch(FuncRequest con
 	}
 
 	case LFUN_INSET_DIALOG_UPDATE:
-		InsetNoteMailer("note", *this).updateDialog(bv);
+		InsetNoteMailer(*this).updateDialog(bv);
 		return DispatchResult(true, true);
 
 	case LFUN_MOUSE_RELEASE:
 		if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
-			InsetNoteMailer("note", *this).showDialog(bv);
+			InsetNoteMailer(*this).showDialog(bv);
 			return DispatchResult(true, true);
 		}
 		// fallthrough:
@@ -244,31 +244,30 @@ void InsetNote::validate(LaTeXFeatures &
 
 
 
-InsetNoteMailer::InsetNoteMailer(string const & name,
-						InsetNote & inset)
-	: name_(name), inset_(inset)
-{
-}
+string const InsetNoteMailer:: name_("note");
+
+InsetNoteMailer::InsetNoteMailer(InsetNote & inset)
+	: inset_(inset)
+{}
 
 
 string const InsetNoteMailer::inset2string(Buffer const &) const
 {
-	return params2string(name_, inset_.params());
+	return params2string(inset_.params());
 }
 
 
-string const InsetNoteMailer::params2string(string const & name,
-				InsetNoteParams const & params)
+string const InsetNoteMailer::params2string(InsetNoteParams const & params)
 {
 	ostringstream data;
-	data << name << ' ';
+	data << name_ << ' ';
 	params.write(data);
 	return data.str();
 }
 
 
 void InsetNoteMailer::string2params(string const & in,
-				     InsetNoteParams & params)
+				    InsetNoteParams & params)
 {
 	params = InsetNoteParams();
 
Index: src/insets/insetnote.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetnote.h,v
retrieving revision 1.38
diff -u -p -r1.38 insetnote.h
--- src/insets/insetnote.h	3 Dec 2003 18:17:17 -0000	1.38
+++ src/insets/insetnote.h	10 Dec 2003 14:47:04 -0000
@@ -86,7 +86,7 @@ private:
 class InsetNoteMailer : public MailInset {
 public:
 	///
-	InsetNoteMailer(std::string const & name, InsetNote & inset);
+	InsetNoteMailer(InsetNote & inset);
 	///
 	virtual InsetBase & inset() const { return inset_; }
 	///
@@ -94,17 +94,15 @@ public:
 	///
 	virtual std::string const inset2string(Buffer const &) const;
 	///
-	static std::string const params2string(std::string const &, InsetNoteParams const &);
+	static std::string const params2string(InsetNoteParams const &);
 	///
 	static void string2params(std::string const &, InsetNoteParams &);
 
 private:
 	///
-	std::string const name_;
+	static std::string const name_;
 	///
 	InsetNote & inset_;
 };
-
-
 
 #endif

Reply via email to