This patch removes pseudo function all over, xforms , qt and gtk are
fixed.

Please have a look

? pseudo-2.diff
Index: src/LyXAction.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/LyXAction.C,v
retrieving revision 1.182
diff -u -p -r1.182 LyXAction.C
--- src/LyXAction.C	9 Sep 2003 22:13:22 -0000	1.182
+++ src/LyXAction.C	21 Sep 2003 16:39:38 -0000
@@ -344,83 +344,8 @@ LyXAction::LyXAction()
 }
 
 
-int LyXAction::searchActionArg(kb_action action, string const & arg) const
-{
-	arg_map::const_iterator pit = lyx_arg_map.find(action);
-
-	if (pit == lyx_arg_map.end()) {
-		lyxerr[Debug::ACTION] << "Action " << action
-				      << " does not have any pseudo actions."
-				      << endl;
-		return LFUN_UNKNOWN_ACTION;
-	}
-
-	arg_item::const_iterator aci = pit->second.find(arg);
-
-	if (aci == pit->second.end()) {
-		lyxerr[Debug::ACTION]
-			<< "Action " << action
-			<< "does not have any pseudoactions with arg "
-			<< arg << endl;
-		return LFUN_UNKNOWN_ACTION;
-	}
-
-	lyxerr[Debug::ACTION] << "Pseudoaction exists["
-			      << action << '|'
-			      << arg << "] = " << aci->second << endl;
-
-	return aci->second;
-}
-
-
-int LyXAction::getPseudoAction(kb_action action, string const & arg)
-{
-	int const psdaction = searchActionArg(action, arg);
-
-	if (isPseudoAction(psdaction)) return psdaction;
-
-	static unsigned int pseudo_counter = LFUN_LASTACTION;
-
-	// Create new pseudo action.
-	lyx_pseudo_map[++pseudo_counter] = FuncRequest(0, action, arg);
-
-	// First ensure that the action is in lyx_arg_map;
-	lyx_arg_map[action];
-	// get the arg_item map
-	arg_map::iterator ami = lyx_arg_map.find(action);
-	// put the new pseudo function in it
-	ami->second[arg] = pseudo_counter;
-
-	lyxerr[Debug::ACTION] << "Creating new pseudoaction "
-			      << pseudo_counter << " for [" << action
-			      << '|' << arg << "]\n";
-
-	return pseudo_counter;
-}
-
-
-FuncRequest LyXAction::retrieveActionArg(int pseudo) const
-{
-	if (!isPseudoAction(pseudo))
-		return FuncRequest(static_cast<kb_action>(pseudo));
-
-	pseudo_map::const_iterator pit = lyx_pseudo_map.find(pseudo);
-
-	if (pit != lyx_pseudo_map.end()) {
-		lyxerr[Debug::ACTION] << "Found the pseudoaction: ["
-				      << pit->second.action << '|'
-				      << pit->second.argument << "]" << endl;
-		return pit->second;
-	} else {
-		lyxerr << "Lyx Error: Unrecognized pseudo-action "
-			<< pseudo << endl;
-		return FuncRequest(LFUN_UNKNOWN_ACTION);
-	}
-}
-
-
 // Returns an action tag from a string.
-int LyXAction::LookupFunc(string const & func)
+kb_action LyXAction::LookupFunc(string const & func)
 {
 	string const func2 = trim(func);
 	if (func2.empty()) return LFUN_NOACTION;
@@ -433,25 +358,15 @@ int LyXAction::LookupFunc(string const &
 
 	func_map::const_iterator fit = lyx_func_map.find(actstr);
 
-	if (!argstr.empty() && fit != lyx_func_map.end()) {
-		// might be pseudo (or create one)
-		return getPseudoAction(fit->second, argstr);
-	}
-
 	return fit != lyx_func_map.end() ? fit->second : LFUN_UNKNOWN_ACTION;
 }
 
 
 string const LyXAction::getActionName(int action) const
 {
-	FuncRequest ev = retrieveActionArg(action);
-	if (!ev.argument.empty())
-		ev.argument.insert(string::size_type(0), 1, ' ');
-
-	info_map::const_iterator const it = lyx_info_map.find(ev.action);
-
+	info_map::const_iterator const it = lyx_info_map.find(kb_action(action));
 	if (it != lyx_info_map.end())
-		return it->second.name + ev.argument;
+		return it->second.name;
 	return string();
 }
 
Index: src/LyXAction.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/LyXAction.h,v
retrieving revision 1.25
diff -u -p -r1.25 LyXAction.h
--- src/LyXAction.h	5 Sep 2003 17:22:47 -0000	1.25
+++ src/LyXAction.h	21 Sep 2003 16:39:38 -0000
@@ -44,12 +44,6 @@ public:
 	typedef std::map<string, kb_action> func_map;
 	/// type for map between an action and its info
 	typedef std::map<kb_action, func_info> info_map;
-	/// type for a map between a pseudo-action and its stored action/arg
-	typedef std::map<unsigned int, FuncRequest> pseudo_map;
-	/// map from argument to pseudo-action
-	typedef std::map<string, unsigned int> arg_item;
-	/// map from an action to all its dependent pseudo-actions
-	typedef std::map<kb_action, arg_item> arg_map;
 
 	/// possible "permissions" for an action
 	enum func_attrib {
@@ -66,19 +60,7 @@ public:
 	 * If you include arguments in func_name, a new pseudoaction
 	 * will be created if needed.
 	 */
-	int LookupFunc(string const & func_name);
-
-	/// Returns a pseudo-action given an action and its argument.
-	int getPseudoAction(kb_action action, string const & arg);
-
-	/**
-	 * Given a pseudo-action, return the real action and
-	 * associated argument
-	 */
-	FuncRequest retrieveActionArg(int pseudo) const;
-
-	/// Search for an existent pseudoaction, return -1 if it doesn't exist.
-	int searchActionArg(kb_action action, string const & arg) const;
+	kb_action LookupFunc(string const & func_name);
 
 	/// Return the name (and argument) associated with the given (pseudo) action
 	string const getActionName(int action) const;
@@ -114,18 +96,6 @@ private:
 	 * command attributes (ro)
 	 */
 	info_map lyx_info_map;
-
-	/**
-	 * A mapping from the automatically created pseudo action number
-	 * to the real action and its argument.
-	 */
-	pseudo_map lyx_pseudo_map;
-
-	/**
-	 * A (multi) mapping from the lyx action to all the generated
-	 * pseudofuncs and the arguments the action should use.
-	 */
-	arg_map lyx_arg_map;
 };
 
 /// singleton instance
Index: src/MenuBackend.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/MenuBackend.C,v
retrieving revision 1.86
diff -u -p -r1.86 MenuBackend.C
--- src/MenuBackend.C	9 Sep 2003 22:13:22 -0000	1.86
+++ src/MenuBackend.C	21 Sep 2003 16:39:39 -0000
@@ -67,7 +67,8 @@ MenuBackend menubackend;
 
 
 MenuItem::MenuItem(Kind kind, string const & label,
-		   string const & command, bool optional)
+		   string const & command,
+		   string const & argument, bool optional)
 	: kind_(kind), label_(label), optional_(optional)
 {
 	switch (kind) {
@@ -85,9 +86,9 @@ MenuItem::MenuItem(Kind kind, string con
 	case Branches:
 		break;
 	case Command:
-		action_ = lyxaction.LookupFunc(command);
-
-		if (action_ == LFUN_UNKNOWN_ACTION) {
+		func_.action = lyxaction.LookupFunc(command);
+		func_.argument = argument;
+		if (func_.action == LFUN_UNKNOWN_ACTION) {
 			lyxerr << "MenuItem(): LyX command `"
 			       << command << "' does not exist." << endl;
 		}
@@ -102,8 +103,8 @@ MenuItem::MenuItem(Kind kind, string con
 }
 
 
-MenuItem::MenuItem(Kind kind, string const & label, int action, bool optional)
-	: kind_(kind), label_(label), action_(action), submenuname_(),
+MenuItem::MenuItem(Kind kind, string const & label, FuncRequest const & func, bool optional)
+	: kind_(kind), label_(label), func_(func), submenuname_(),
 	  optional_(optional)
 {}
 
@@ -136,7 +137,7 @@ string const MenuItem::binding() const
 
 	// Get the keys bound to this action, but keep only the
 	// first one later
-	string bindings = toplevel_keymap->findbinding(action_);
+	string bindings = toplevel_keymap->findbinding(func_.action);
 
 	if (!bindings.empty()) {
 		return bindings.substr(1, bindings.find(']') - 1);
@@ -156,7 +157,7 @@ Menu & Menu::add(MenuItem const & i, LyX
 	case MenuItem::Command:
 	{
 		FuncStatus status =
-			view->getLyXFunc().getStatus(i.action());
+			view->getLyXFunc().getStatus(i.func());
 		if (status.unknown()
 		    || (status.disabled() && i.optional()))
 			break;
@@ -260,7 +261,7 @@ Menu & Menu::read(LyXLex & lex)
 			lex.next(true);
 			string const command = lex.getString();
 			add(MenuItem(MenuItem::Command, name,
-				     command, optional));
+				     command, string(), optional));
 			optional = false;
 			break;
 		}
@@ -322,7 +323,7 @@ Menu & Menu::read(LyXLex & lex)
 			lex.next(true);
 			string const mname = lex.getString();
 			add(MenuItem(MenuItem::Submenu, mlabel, mname,
-				     optional));
+				     string(), optional));
 			optional = false;
 			break;
 		}
@@ -398,10 +399,7 @@ void expandLastfiles(Menu & tomenu, LyXV
 		string const label = tostr(ii) + ". "
 			+ MakeDisplayPath((*lfit), 30)
 			+ '|' + tostr(ii);
-		int const action = lyxaction.
-			getPseudoAction(LFUN_FILE_OPEN,
-					(*lfit));
-		tomenu.add(MenuItem(MenuItem::Command, label, action), view);
+		tomenu.add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_FILE_OPEN, (*lfit))), view);
 	}
 }
 
@@ -412,7 +410,7 @@ void expandDocuments(Menu & tomenu, LyXV
 
 	if (names.empty()) {
 		tomenu.add(MenuItem(MenuItem::Command, _("No Documents Open!"),
-				    LFUN_NOACTION), view);
+				    FuncRequest(LFUN_NOACTION)), view);
 		return;
 	}
 
@@ -420,12 +418,10 @@ void expandDocuments(Menu & tomenu, LyXV
 	Strings::const_iterator docit = names.begin();
 	Strings::const_iterator end = names.end();
 	for (; docit != end; ++docit, ++ii) {
-		int const action =
-			lyxaction.getPseudoAction(LFUN_SWITCHBUFFER, *docit);
 		string label = MakeDisplayPath(*docit, 20);
 		if (ii < 10)
 			label = tostr(ii) + ". " + label + '|' + tostr(ii);
-		tomenu.add(MenuItem(MenuItem::Command, label, action), view);
+		tomenu.add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_SWITCHBUFFER, *docit)), view);
 	}
 }
 
@@ -434,7 +430,8 @@ void expandFormats(MenuItem::Kind kind, 
 {
 	if (!view->buffer() && kind != MenuItem::ImportFormats) {
 		tomenu.add(MenuItem(MenuItem::Command,
-				    _("No Documents Open!"), LFUN_NOACTION),
+				    _("No Documents Open!"),
+				    FuncRequest(LFUN_NOACTION)),
 				    view);
 		return;
 	}
@@ -483,9 +480,9 @@ void expandFormats(MenuItem::Kind kind, 
 		}
 		if (!(*fit)->shortcut().empty())
 			label += '|' + (*fit)->shortcut();
-		int const action2 = lyxaction.
-			getPseudoAction(action,	(*fit)->name());
-		tomenu.add(MenuItem(MenuItem::Command, label, action2),
+
+		tomenu.add(MenuItem(MenuItem::Command, label,
+				    FuncRequest(action, (*fit)->name())),
 			   view);
 	}
 }
@@ -495,7 +492,8 @@ void expandFloatListInsert(Menu & tomenu
 {
 	if (!view->buffer()) {
 		tomenu.add(MenuItem(MenuItem::Command,
-				    _("No Documents Open!"), LFUN_NOACTION),
+				    _("No Documents Open!"),
+				    FuncRequest(LFUN_NOACTION)),
 			   view);
 		return;
 	}
@@ -505,10 +503,10 @@ void expandFloatListInsert(Menu & tomenu
 	FloatList::const_iterator cit = floats.begin();
 	FloatList::const_iterator end = floats.end();
 	for (; cit != end; ++cit) {
-		int const action =  lyxaction
-			.getPseudoAction(LFUN_FLOAT_LIST, cit->second.type());
 		tomenu.add(MenuItem(MenuItem::Command,
-				    _(cit->second.listName()), action),
+				    _(cit->second.listName()),
+				    FuncRequest(LFUN_FLOAT_LIST,
+						cit->second.type())),
 			   view);
 	}
 }
@@ -518,7 +516,8 @@ void expandFloatInsert(Menu & tomenu, Ly
 {
 	if (!view->buffer()) {
 		tomenu.add(MenuItem(MenuItem::Command,
-				    _("No Documents Open!"), LFUN_NOACTION),
+				    _("No Documents Open!"),
+				    FuncRequest(LFUN_NOACTION)),
 			   view);
 		return;
 	}
@@ -529,11 +528,10 @@ void expandFloatInsert(Menu & tomenu, Ly
 	FloatList::const_iterator end = floats.end();
 	for (; cit != end; ++cit) {
 		// normal float
-		int const action =
-			lyxaction.getPseudoAction(LFUN_INSET_FLOAT,
-						  cit->second.type());
 		string const label = _(cit->second.name());
-		tomenu.add(MenuItem(MenuItem::Command, label, action),
+		tomenu.add(MenuItem(MenuItem::Command, label,
+				    FuncRequest(LFUN_INSET_FLOAT,
+						cit->second.type())),
 			   view);
 	}
 }
@@ -549,14 +547,14 @@ void expandToc2(Menu & tomenu,
 	int shortcut_count = 0;
 	if (to - from <= max_number_of_items) {
 		for (lyx::toc::Toc::size_type i = from; i < to; ++i) {
-			int const action = toc_list[i].action();
 			string label(4 * max(0, toc_list[i].depth - depth),' ');
 			label += limit_string_length(toc_list[i].str);
 			if (toc_list[i].depth == depth
 			    && ++shortcut_count <= 9) {
 				label += '|' + tostr(shortcut_count);
 			}
-			tomenu.add(MenuItem(MenuItem::Command, label, action));
+			tomenu.add(MenuItem(MenuItem::Command, label,
+					    FuncRequest(toc_list[i].action())));
 		}
 	} else {
 		lyx::toc::Toc::size_type pos = from;
@@ -566,7 +564,6 @@ void expandToc2(Menu & tomenu,
 			       toc_list[new_pos].depth > depth)
 				++new_pos;
 
-			int const action = toc_list[pos].action();
 			string label(4 * max(0, toc_list[pos].depth - depth), ' ');
 			label += limit_string_length(toc_list[pos].str);
 			if (toc_list[pos].depth == depth &&
@@ -575,7 +572,7 @@ void expandToc2(Menu & tomenu,
 
 			if (new_pos == pos + 1) {
 				tomenu.add(MenuItem(MenuItem::Command,
-						    label, action));
+						    label, FuncRequest(toc_list[pos].action())));
 			} else {
 				MenuItem item(MenuItem::Submenu, label);
 				item.submenu(new Menu);
@@ -598,7 +595,8 @@ void expandToc(Menu & tomenu, LyXView co
 
 	if (!view->buffer()) {
 		tomenu.add(MenuItem(MenuItem::Command,
-				    _("No Documents Open!"), LFUN_NOACTION),
+				    _("No Documents Open!"),
+				    FuncRequest(LFUN_NOACTION)),
 			   view);
 		return;
 	}
@@ -618,7 +616,8 @@ void expandToc(Menu & tomenu, LyXView co
 		for (; ccit != eend; ++ccit) {
 			string const label = limit_string_length(ccit->str);
 			menu->add(MenuItem(MenuItem::Command,
-					   label, ccit->action()));
+					   label,
+					   FuncRequest(ccit->action())));
 		}
 		string const & floatName = cit->first;
 		// Is the _(...) really needed here? (Lgb)
@@ -651,9 +650,8 @@ void expandPasteRecent(Menu & tomenu, Ly
 	vector<string>::const_iterator end = selL.end();
 
 	for (unsigned int index = 0; cit != end; ++cit, ++index) {
-		int const action = lyxaction.getPseudoAction(LFUN_PASTE,
-							     tostr(index));
-		tomenu.add(MenuItem(MenuItem::Command, *cit, action));
+		tomenu.add(MenuItem(MenuItem::Command, *cit,
+				    FuncRequest(LFUN_PASTE, tostr(index))));
 	}
 }
 
@@ -670,12 +668,11 @@ void expandBranches(Menu & tomenu, LyXVi
 
 	for (int ii = 1; cit != end; ++cit, ++ii) {
 		string label = cit->getBranch();
-		int const action = lyxaction.
-			getPseudoAction(LFUN_INSERT_BRANCH,
-					(cit->getBranch()));
 		if (ii < 10)
 			label = tostr(ii) + ". " + label + "|" + tostr(ii);
-		tomenu.add(MenuItem(MenuItem::Command, label, action), view);
+		tomenu.add(MenuItem(MenuItem::Command, label,
+				    FuncRequest(LFUN_INSERT_BRANCH,
+						cit->getBranch())), view);
 	}
 }
 
Index: src/MenuBackend.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/MenuBackend.h,v
retrieving revision 1.30
diff -u -p -r1.30 MenuBackend.h
--- src/MenuBackend.h	5 Sep 2003 17:22:47 -0000	1.30
+++ src/MenuBackend.h	21 Sep 2003 16:39:39 -0000
@@ -13,14 +13,15 @@
 #ifndef MENUBACKEND_H
 #define MENUBACKEND_H
 
+#include "FuncStatus.h"
+#include "funcrequest.h"
+
 #include "support/std_string.h"
 
 #include <boost/shared_ptr.hpp>
 
 #include <vector>
 
-#include "FuncStatus.h"
-
 class LyXLex;
 class LyXView;
 class Menu;
@@ -72,10 +73,11 @@ public:
 	MenuItem(Kind kind,
 		 string const & label = string(),
 		 string const & command = string(),
+		 string const & argument = string(),
 		 bool optional = false);
 	MenuItem(Kind kind,
 		 string const & label,
-		 int action,
+		 FuncRequest const & func,
 		 bool optional = false);
 
 	/// This one is just to please boost::shared_ptr<>
@@ -89,7 +91,7 @@ public:
 	/// The kind of entry
 	Kind kind() const { return kind_; }
 	/// the action (if relevant)
-	int action() const { return action_; }
+	FuncRequest const & func() const { return func_; }
 	/// returns true if the entry should be ommited when disabled
 	bool optional() const { return optional_; }
 	/// returns the status of the lfun associated with this entry
@@ -116,7 +118,7 @@ private:
 	///
 	string label_;
 	///
-	int action_;
+	FuncRequest func_;
 	///
 	string submenuname_;
 	///
Index: src/ToolbarBackend.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ToolbarBackend.C,v
retrieving revision 1.18
diff -u -p -r1.18 ToolbarBackend.C
--- src/ToolbarBackend.C	9 Sep 2003 22:13:22 -0000	1.18
+++ src/ToolbarBackend.C	21 Sep 2003 16:39:39 -0000
@@ -98,15 +98,15 @@ void ToolbarBackend::read(LyXLex & lex)
 			break;
 
 		case TO_MINIBUFFER:
-			add(tb, MINIBUFFER);
+			add(tb, FuncRequest(kb_action(MINIBUFFER)));
 			break;
 
 		case TO_SEPARATOR:
-			add(tb, SEPARATOR);
+			add(tb, FuncRequest(kb_action(SEPARATOR)));
 			break;
 
 		case TO_LAYOUTS:
-			add(tb, LAYOUTS);
+			add(tb, FuncRequest(kb_action(LAYOUTS)));
 			break;
 
 		case TO_ENDTOOLBAR:
@@ -193,9 +193,9 @@ void ToolbarBackend::readToolbars(LyXLex
 }
 
 
-void ToolbarBackend::add(Toolbar & tb, int action, string const & tooltip)
+void ToolbarBackend::add(Toolbar & tb, FuncRequest const & func, string const & tooltip)
 {
-	tb.items.push_back(make_pair(action, tooltip));
+	tb.items.push_back(make_pair(func, tooltip));
 }
 
 
@@ -207,15 +207,14 @@ void ToolbarBackend::add(Toolbar & tb, s
 		lyxerr << "ToolbarBackend::add: no LyX command called `"
 		       << func << "' exists!" << endl;
 	} else {
-		add(tb, tf, tooltip);
+		add(tb, FuncRequest(kb_action(tf)), tooltip);
 	}
 }
 
 
-string const ToolbarBackend::getIcon(int action)
+string const ToolbarBackend::getIcon(FuncRequest const & f)
 {
 	string fullname;
-	FuncRequest f = lyxaction.retrieveActionArg(action);
 
 	if (f.action == LFUN_INSERT_MATH) {
 		if (!f.argument.empty())
Index: src/ToolbarBackend.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ToolbarBackend.h,v
retrieving revision 1.9
diff -u -p -r1.9 ToolbarBackend.h
--- src/ToolbarBackend.h	7 Sep 2003 21:25:33 -0000	1.9
+++ src/ToolbarBackend.h	21 Sep 2003 16:39:39 -0000
@@ -13,12 +13,15 @@
 #ifndef TOOLBAR_BACKEND_H
 #define TOOLBAR_BACKEND_H
 
+#include "funcrequest.h"
+
 #include <vector>
 
 #include "support/std_string.h"
 
 class LyXLex;
 
+
 ///
 class ToolbarBackend {
 public:
@@ -33,10 +36,10 @@ public:
 	};
 
 	/// action, tooltip
-	typedef std::pair<int, string> Item;
+	typedef std::pair<FuncRequest, string> Item;
 
 	/// the toolbar items
-	typedef std::vector<std::pair<int, string> > Items;
+	typedef std::vector<Item> Items;
 
 	/// toolbar flags
 	enum Flags {
@@ -82,11 +85,12 @@ public:
 	void readToolbars(LyXLex &);
 
 	/// return a full path of an XPM for the given action
-	static string const getIcon(int action);
+	static string const getIcon(FuncRequest const &);
 
 private:
 	/// add the given lfun with tooltip if relevant
-	void add(Toolbar & tb, int, string const & tooltip = string());
+	void add(Toolbar & tb, FuncRequest const &,
+		 string const & tooltip = string());
 
 	/// add the given lfun with tooltip if relevant
 	void add(Toolbar & tb, string const &, string const & tooltip);
Index: src/funcrequest.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/funcrequest.C,v
retrieving revision 1.16
diff -u -p -r1.16 funcrequest.C
--- src/funcrequest.C	15 Sep 2003 10:59:52 -0000	1.16
+++ src/funcrequest.C	21 Sep 2003 16:39:39 -0000
@@ -127,7 +127,7 @@ void split(vector<string> & args, string
 }
 
 
-string FuncRequest::getArg(int i) const
+string FuncRequest::getArg(unsigned int i) const
 {
 	vector<string> args;
 	split(args, argument);
Index: src/funcrequest.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/funcrequest.h,v
retrieving revision 1.12
diff -u -p -r1.12 funcrequest.h
--- src/funcrequest.h	5 Sep 2003 17:22:48 -0000	1.12
+++ src/funcrequest.h	21 Sep 2003 16:39:39 -0000
@@ -57,7 +57,7 @@ public:
 	void errorMessage(string const & msg) const;
 
 	/// argument parsing, extract argument i as string
-	string getArg(int i) const;
+	string getArg(unsigned int i) const;
 
 private:
 	/// the BufferView we are talking to
Index: src/lyxfunc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v
retrieving revision 1.504
diff -u -p -r1.504 lyxfunc.C
--- src/lyxfunc.C	17 Sep 2003 16:44:51 -0000	1.504
+++ src/lyxfunc.C	21 Sep 2003 16:39:39 -0000
@@ -264,17 +264,11 @@ void LyXFunc::processKeySym(LyXKeySymPtr
 				   << argument << "']" << endl;
 		}
 	} else {
-		dispatch(action);
+		dispatch(FuncRequest(kb_action(action)));
 	}
 }
 
 
-FuncStatus LyXFunc::getStatus(int ac) const
-{
-	return getStatus(lyxaction.retrieveActionArg(ac));
-}
-
-
 FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
 {
 	FuncStatus flag;
@@ -809,7 +803,7 @@ FuncStatus LyXFunc::getStatus(FuncReques
 	// solution, we consider only the first action of the sequence
 	if (ev.action == LFUN_SEQUENCE) {
 		// argument contains ';'-terminated commands
-		flag = getStatus(lyxaction.LookupFunc(token(ev.argument, ';', 0)));
+		flag = getStatus(FuncRequest(lyxaction.LookupFunc(token(ev.argument, ';', 0))));
 	}
 
 	return flag;
@@ -825,15 +819,10 @@ void LyXFunc::dispatch(string const & s,
 		return;
 	}
 
-	dispatch(action, verbose);
+	dispatch(FuncRequest(kb_action(action)), verbose);
 }
 
 
-void LyXFunc::dispatch(int ac, bool verbose)
-{
-	dispatch(lyxaction.retrieveActionArg(ac), verbose);
-}
-
 namespace {
 	bool ensureBufferClean(BufferView * bv) {
 
@@ -1093,7 +1082,7 @@ void LyXFunc::dispatch(FuncRequest const
 		meta_fake_bit = key_modifier::none;
 		if (view()->available())
 			// cancel any selection
-			dispatch(LFUN_MARK_OFF);
+			dispatch(FuncRequest(LFUN_MARK_OFF));
 		setMessage(N_("Cancel"));
 		break;
 
@@ -1715,22 +1704,16 @@ void LyXFunc::sendDispatchMessage(string
 
 	string comname = lyxaction.getActionName(ev.action);
 
-	int pseudoaction = ev.action;
 	bool argsadded = false;
 
 	if (!ev.argument.empty()) {
-		// the pseudoaction is useful for the bindings
-		pseudoaction = lyxaction.searchActionArg(ev.action, ev.argument);
-
-		if (pseudoaction == LFUN_UNKNOWN_ACTION) {
-			pseudoaction = ev.action;
-		} else {
+		if (ev.action != LFUN_UNKNOWN_ACTION) {
 			comname += ' ' + ev.argument;
 			argsadded = true;
 		}
 	}
 
-	string const shortcuts = toplevel_keymap->findbinding(pseudoaction);
+	string const shortcuts = toplevel_keymap->findbinding(ev.action);
 
 	if (!shortcuts.empty()) {
 		comname += ": " + shortcuts;
Index: src/lyxfunc.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.h,v
retrieving revision 1.62
diff -u -p -r1.62 lyxfunc.h
--- src/lyxfunc.h	7 Sep 2003 01:45:37 -0000	1.62
+++ src/lyxfunc.h	21 Sep 2003 16:39:39 -0000
@@ -49,9 +49,6 @@ public:
 	/// Dispatch via a string argument
 	void dispatch(string const & s, bool verbose = false);
 
-	/// Dispatch via a pseudo action, also displaying shortcut/command name
-	void dispatch(int ac, bool verbose = false);
-
 	/// return the status bar state string
 	string const view_status_message();
 
@@ -60,9 +57,6 @@ public:
 	///
 	void processKeySym(LyXKeySymPtr key, key_modifier::state state);
 
-	/// we need one internal which is called from inside LyXAction and
-	/// can contain the string argument.
-	FuncStatus getStatus(int ac) const;
 	///
 	FuncStatus getStatus(FuncRequest const & action) const;
 
Index: src/toc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/toc.C,v
retrieving revision 1.34
diff -u -p -r1.34 toc.C
--- src/toc.C	15 Sep 2003 15:51:48 -0000	1.34
+++ src/toc.C	21 Sep 2003 16:39:40 -0000
@@ -47,10 +47,9 @@ void TocItem::goTo(LyXView & lv_) const
 }
 
 
-int TocItem::action() const
+FuncRequest TocItem::action() const
 {
-	return lyxaction.getPseudoAction(LFUN_GOTO_PARAGRAPH,
-					 tostr(id_));
+	return FuncRequest(LFUN_GOTO_PARAGRAPH, tostr(id_));
 }
 
 
Index: src/toc.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/toc.h,v
retrieving revision 1.10
diff -u -p -r1.10 toc.h
--- src/toc.h	7 Sep 2003 21:25:33 -0000	1.10
+++ src/toc.h	21 Sep 2003 16:39:40 -0000
@@ -22,6 +22,7 @@
 class Buffer;
 class LyXView;
 class Paragraph;
+class FuncRequest;
 
 /** Nice functions and objects to handle TOCs
  */
@@ -37,7 +38,7 @@ struct TocItem {
 	/// set cursor in LyXView to this TocItem
 	void goTo(LyXView & lv_) const;
 	/// the action corresponding to the goTo above
-	int action() const;
+	FuncRequest action() const;
 	/// Paragraph ID containing this item
 	int id_;
 	/// nesting depth
Index: src/frontends/LyXView.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/LyXView.C,v
retrieving revision 1.33
diff -u -p -r1.33 LyXView.C
--- src/frontends/LyXView.C	9 Sep 2003 22:13:39 -0000	1.33
+++ src/frontends/LyXView.C	21 Sep 2003 16:39:40 -0000
@@ -106,7 +106,7 @@ void LyXView::updateToolbar()
 {
 	bool const math = mathcursor;
 	bool const table =
-		!getLyXFunc().getStatus(LFUN_LAYOUT_TABULAR).disabled();
+		!getLyXFunc().getStatus(FuncRequest(LFUN_LAYOUT_TABULAR)).disabled();
 	toolbar_->update(math, table);
 }
 
Index: src/frontends/Toolbar.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/Toolbar.h,v
retrieving revision 1.22
diff -u -p -r1.22 Toolbar.h
--- src/frontends/Toolbar.h	9 Sep 2003 18:27:21 -0000	1.22
+++ src/frontends/Toolbar.h	21 Sep 2003 16:39:40 -0000
@@ -32,7 +32,7 @@ public:
 	virtual ~Toolbar();
 
 	/// Initialize toolbar from backend
- 	void init();
+	void init();
 
 	/// update the state of the toolbars
 	void update(bool in_math, bool in_table);
Index: src/frontends/gtk/GMenubar.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/GMenubar.C,v
retrieving revision 1.3
diff -u -p -r1.3 GMenubar.C
--- src/frontends/gtk/GMenubar.C	9 Sep 2003 18:27:22 -0000	1.3
+++ src/frontends/gtk/GMenubar.C	21 Sep 2003 16:39:40 -0000
@@ -137,7 +137,7 @@ bool GMenubar::submenuDisabled(MenuItem 
 		case MenuItem::Command:
 		{
 			FuncStatus const flag =
-				view_->getLyXFunc().getStatus(i->action());
+				view_->getLyXFunc().getStatus(i->func());
 			if (!flag.disabled())
 				return false;
 			break;
@@ -180,7 +180,7 @@ void GMenubar::onSubMenuActivate(MenuIte
 		case MenuItem::Command:
 		{
 			FuncStatus const flag =
-				view_->getLyXFunc().getStatus(i->action());
+				view_->getLyXFunc().getStatus(i->func());
 			bool on, off;
 			on = flag.onoff(true);
 			off = flag.onoff(false);
@@ -224,5 +224,5 @@ void GMenubar::onSubMenuActivate(MenuIte
 void GMenubar::onCommandActivate(MenuItem const * item,
 				       Gtk::MenuItem * /*gitem*/)
 {
-	view_->getLyXFunc().dispatch(item->action(), true);
+	view_->getLyXFunc().dispatch(item->func(), true);
 }
Index: src/frontends/gtk/GToolbar.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/GToolbar.C,v
retrieving revision 1.7
diff -u -p -r1.7 GToolbar.C
--- src/frontends/gtk/GToolbar.C	21 Sep 2003 16:02:53 -0000	1.7
+++ src/frontends/gtk/GToolbar.C	21 Sep 2003 16:39:40 -0000
@@ -81,7 +81,7 @@ void GToolbar::add(ToolbarBackend::Toolb
 	ToolbarBackend::item_iterator it = tb.items.begin();
 	ToolbarBackend::item_iterator end = tb.items.end();
 	for (; it != end; ++it)
-		add(toolbar, it->first, it->second);
+		add(toolbar, *it);
 	toolbar->set_toolbar_style(Gtk::TOOLBAR_ICONS);
 	toolbar->show();
 	vbox_.children().push_back(
@@ -92,10 +92,11 @@ void GToolbar::add(ToolbarBackend::Toolb
 
 
 void GToolbar::add(Gtk::Toolbar * toolbar,
-			 int action,
-			 string const & tooltip)
+		   ToolbarBackend::Item const & item)
 {
-	switch (action) {
+	FuncRequest const & func = item.first;
+	string const & tooltip = item.second;
+	switch (func.action) {
 	case ToolbarBackend::SEPARATOR:
 		toolbar->tools().push_back(Gtk::Toolbar_Helpers::Space());
 		break;
@@ -109,20 +110,20 @@ void GToolbar::add(Gtk::Toolbar * toolba
 			Gtk::Toolbar_Helpers::Element(combo_));
 		toolbar->tools().back().get_widget()->set_data(
 			gToolData,
-			reinterpret_cast<void*>(LFUN_LAYOUT));
+			reinterpret_cast<void*>(&const_cast<ToolbarBackend::Item&>(item)));
 		break;
 	}
 	default:
 	{
 		Glib::ustring xpmName =
-			Glib::locale_to_utf8(toolbarbackend.getIcon(action));
+			Glib::locale_to_utf8(toolbarbackend.getIcon(func));
 		Glib::ustring tip = Glib::locale_to_utf8(tooltip);
 		if (xpmName.size() == 0) {
 			toolbar->tools().push_back(
 				Gtk::Toolbar_Helpers::ButtonElem(
 					"",
 					SigC::bind(SigC::slot(*this, &GToolbar::onButtonClicked),
-						   action),
+						   FuncRequest(func)),
 					tip));
 		} else {
 			Gtk::Image * image =
@@ -133,21 +134,21 @@ void GToolbar::add(Gtk::Toolbar * toolba
 					"",
 					*image,
 					SigC::bind(SigC::slot(*this, &GToolbar::onButtonClicked),
-						   action),
+						   FuncRequest(func)),
 					tip));
 		}
 		toolbar->tools().back().get_content()->set_data(
 			gToolData,
-			reinterpret_cast<void*>(action));
+			reinterpret_cast<void*>(&const_cast<ToolbarBackend::Item&>(item)));
 		break;
 	}
 	}
 }
 
 
-void GToolbar::onButtonClicked(int action)
+void GToolbar::onButtonClicked(FuncRequest func)
 {
-	view_->getLyXFunc().dispatch(action, true);
+	view_->getLyXFunc().dispatch(func, true);
 }
 
 
@@ -202,10 +203,11 @@ void GToolbar::update()
 			default:
 				widget = it->get_content();
 			}
-			int action = reinterpret_cast<int>(
+			ToolbarBackend::Item * item =
+			reinterpret_cast<ToolbarBackend::Item*>(
 				widget->get_data(gToolData));
 			FuncStatus const status = view_->
-				getLyXFunc().getStatus(action);
+				getLyXFunc().getStatus(item->first);
 			bool sensitive = !status.disabled();
 			widget->set_sensitive(sensitive);
 			if (it->get_type() != Gtk::TOOLBAR_CHILD_BUTTON)
Index: src/frontends/gtk/GToolbar.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/gtk/GToolbar.h,v
retrieving revision 1.3
diff -u -p -r1.3 GToolbar.h
--- src/frontends/gtk/GToolbar.h	5 Sep 2003 17:23:01 -0000	1.3
+++ src/frontends/gtk/GToolbar.h	21 Sep 2003 16:39:40 -0000
@@ -17,6 +17,7 @@
 #include "ToolbarBackend.h"
 #include "support/std_string.h"
 
+
 class GToolbar : public Toolbar, public SigC::Object
 {
 public:
@@ -29,8 +30,7 @@ public:
 
 	/// add a new button to the toolbar.
 	void add(Gtk::Toolbar * toolbar,
-		 int action,
-		 string const & tooltip);
+		 ToolbarBackend::Item const & item);
 
 	/// display toolbar, not implemented
 	void displayToolbar(ToolbarBackend::Toolbar const & tb, bool show);
@@ -50,7 +50,7 @@ public:
 	/// Erase the layout list
 	void clearLayoutList();
 private:
-	void onButtonClicked(int action);
+	void onButtonClicked(FuncRequest);
 	void onLayoutSelected();
 	Gtk::VBox vbox_;
 	std::vector<Gtk::Toolbar*> toolbars_;
Index: src/frontends/qt2/QLPopupMenu.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLPopupMenu.C,v
retrieving revision 1.24
diff -u -p -r1.24 QLPopupMenu.C
--- src/frontends/qt2/QLPopupMenu.C	9 Sep 2003 22:13:39 -0000	1.24
+++ src/frontends/qt2/QLPopupMenu.C	21 Sep 2003 16:39:40 -0000
@@ -61,7 +61,7 @@ createMenu(QMenuData * parent, MenuItem 
 {
 	// FIXME: leaks ??
 	QLPopupMenu * pm = new QLPopupMenu(owner, item->submenuname(), is_toplevel);
-	int id = parent->insertItem(toqstr(getLabel(*item)), pm);
+	int const id = parent->insertItem(toqstr(getLabel(*item)), pm);
 	return make_pair(id, pm);
 }
 
@@ -73,12 +73,19 @@ QLPopupMenu::QLPopupMenu(QLMenubar * own
 	if (toplevel)
 		connect(this, SIGNAL(aboutToShow()), this, SLOT(showing()));
 	connect(this, SIGNAL(activated(int)),
-		owner_->view(), SLOT(activated(int)));
+		this, SLOT(fire(int)));
 }
 
 
+void QLPopupMenu::fire(int index)
+{
+	owner_->view()->activated(funcs_[index]);
+}
+
 void QLPopupMenu::populate(Menu * menu)
 {
+	funcs_.clear();
+
 	Menu::const_iterator m = menu->begin();
 	Menu::const_iterator end = menu->end();
 	for (; m != end; ++m) {
@@ -92,9 +99,13 @@ void QLPopupMenu::populate(Menu * menu)
 		} else {
 			FuncStatus const status = m->status();
 
-			insertItem(toqstr(getLabel(*m)), m->action());
-			setItemEnabled(m->action(), !status.disabled());
-			setItemChecked(m->action(), status.onoff(true));
+			Funcs::iterator fit =
+				funcs_.insert(funcs_.end(), m->func());
+			int const index = std::distance(funcs_.begin(), fit);
+
+			insertItem(toqstr(getLabel(*m)), index);
+			setItemEnabled(index, !status.disabled());
+			setItemChecked(index, status.onoff(true));
 		}
 	}
 }
Index: src/frontends/qt2/QLPopupMenu.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLPopupMenu.h,v
retrieving revision 1.12
diff -u -p -r1.12 QLPopupMenu.h
--- src/frontends/qt2/QLPopupMenu.h	8 Sep 2003 16:23:31 -0000	1.12
+++ src/frontends/qt2/QLPopupMenu.h	21 Sep 2003 16:39:40 -0000
@@ -15,8 +15,11 @@
 
 #include <qpopupmenu.h>
 
+#include "funcrequest.h"
+
 #include "support/std_string.h"
 
+#include <vector>
 #include <utility>
 
 class MenuBackend;
@@ -43,12 +46,19 @@ public:
 public slots:
 	/// populate the toplevel menu and all children
 	void showing();
+	///
+	void fire(int);
 private:
 	/// our owning menubar
 	QLMenubar * owner_;
 
 	/// the name of this menu
 	string name_;
+
+	///
+	typedef std::vector<FuncRequest> Funcs;
+	///
+	Funcs funcs_;
 };
 
 #endif // QLPOPUPMENU_H
Index: src/frontends/qt2/QLToolbar.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLToolbar.C,v
retrieving revision 1.9
diff -u -p -r1.9 QLToolbar.C
--- src/frontends/qt2/QLToolbar.C	9 Sep 2003 11:24:24 -0000	1.9
+++ src/frontends/qt2/QLToolbar.C	21 Sep 2003 16:39:40 -0000
@@ -62,17 +62,17 @@ void QLToolbar::update()
 
 	for (; p != end; ++p) {
 		QToolButton * button = p->first;
-		int action = p->second;
+		FuncRequest const & func = p->second;
 
 		FuncStatus const status =
-			owner_->getLyXFunc().getStatus(action);
+			owner_->getLyXFunc().getStatus(func);
 
 		button->setToggleButton(true);
 		button->setOn(status.onoff(true));
 		button->setEnabled(!status.disabled());
 	}
 
-	bool const enable = !owner_->getLyXFunc().getStatus(LFUN_LAYOUT).disabled();
+	bool const enable = !owner_->getLyXFunc().getStatus(FuncRequest(LFUN_LAYOUT)).disabled();
 
 	// Workaround for Qt bug where setEnabled(true) closes
 	// the popup
@@ -225,9 +225,10 @@ void QLToolbar::add(ToolbarBackend::Tool
 }
 
 
-void QLToolbar::add(QToolBar * tb, int action, string const & tooltip)
+void QLToolbar::add(QToolBar * tb,
+		    FuncRequest const & func, string const & tooltip)
 {
-	switch (action) {
+	switch (func.action) {
 	case ToolbarBackend::SEPARATOR:
 		tb->addSeparator();
 		break;
@@ -247,14 +248,14 @@ void QLToolbar::add(QToolBar * tb, int a
 		tb->setHorizontalStretchable(true);
 		break;
 	default: {
-		if (owner_->getLyXFunc().getStatus(action).unknown())
+		if (owner_->getLyXFunc().getStatus(func).unknown())
 			break;
-		QPixmap p = QPixmap(toolbarbackend.getIcon(action).c_str());
+		QPixmap p = QPixmap(toolbarbackend.getIcon(func).c_str());
 		QToolButton * button =
 			new QToolButton(p, toqstr(tooltip), "",
 			proxy_.get(), SLOT(button_selected()), tb);
 
-		map_[button] = action;
+		map_[button] = func;
 		break;
 	}
 	}
Index: src/frontends/qt2/QLToolbar.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLToolbar.h,v
retrieving revision 1.3
diff -u -p -r1.3 QLToolbar.h
--- src/frontends/qt2/QLToolbar.h	7 Sep 2003 21:25:34 -0000	1.3
+++ src/frontends/qt2/QLToolbar.h	21 Sep 2003 16:39:40 -0000
@@ -41,7 +41,7 @@ public:
 	void add(ToolbarBackend::Toolbar const & tb);
 
 	/// add an item to a toolbar
-	void add(QToolBar * tb, int action, string const & tooltip);
+	void add(QToolBar * tb, FuncRequest const &, string const & tooltip);
 
 	/// show or hide a toolbar
 	void displayToolbar(ToolbarBackend::Toolbar const & tb, bool show);
@@ -70,7 +70,7 @@ private:
 
 	QLComboBox * combo_;
 
-	typedef std::map<QToolButton *, int> ButtonMap;
+	typedef std::map<QToolButton *, FuncRequest> ButtonMap;
 
 	ButtonMap map_;
 };
Index: src/frontends/qt2/QtView.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QtView.C,v
retrieving revision 1.40
diff -u -p -r1.40 QtView.C
--- src/frontends/qt2/QtView.C	9 Sep 2003 22:13:39 -0000	1.40
+++ src/frontends/qt2/QtView.C	21 Sep 2003 16:39:40 -0000
@@ -129,9 +129,9 @@ void QtView::update_view_state()
 }
 
 
-void QtView::activated(int id)
+void QtView::activated(FuncRequest const & func)
 {
-	getLyXFunc().dispatch(id, true);
+	getLyXFunc().dispatch(func, true);
 }
 
 
Index: src/frontends/qt2/QtView.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QtView.h,v
retrieving revision 1.16
diff -u -p -r1.16 QtView.h
--- src/frontends/qt2/QtView.h	23 Aug 2003 00:16:39 -0000	1.16
+++ src/frontends/qt2/QtView.h	21 Sep 2003 16:39:40 -0000
@@ -22,6 +22,7 @@
 #include <qtimer.h>
 
 class QCommandBuffer;
+class FuncRequest;
 
 /**
  * QtView - Qt implementation of LyXView
@@ -51,10 +52,10 @@ public:
 	/// add the command buffer
 	void addCommandBuffer(QWidget * parent);
 
-public slots:
 	/// menu item has been selected
-	void activated(int id);
+	void activated(FuncRequest const &);
 
+public slots:
 	/// idle timeout
 	void update_view_state_qt();
 protected:
Index: src/frontends/xforms/XFormsMenubar.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XFormsMenubar.C,v
retrieving revision 1.6
diff -u -p -r1.6 XFormsMenubar.C
--- src/frontends/xforms/XFormsMenubar.C	9 Sep 2003 22:13:41 -0000	1.6
+++ src/frontends/xforms/XFormsMenubar.C	21 Sep 2003 16:39:40 -0000
@@ -192,9 +192,10 @@ string const fixlabel(string const & str
 
 
 int XFormsMenubar::create_submenu(Window win, XFormsView * view,
-				   Menu const & menu, vector<int> & smn)
+				  Menu const & menu,
+				  vector<int> & smn, Funcs & funcs)
 {
-	const int menuid = get_new_submenu(smn, win);
+	int const menuid = get_new_submenu(smn, win);
 	lyxerr[Debug::GUI] << "XFormsMenubar::create_submenu: creating "
 			   << menu.name() << " as menuid=" << menuid << endl;
 
@@ -226,7 +227,7 @@ int XFormsMenubar::create_submenu(Window
 		++count;
 		// add a More... submenu if the menu is too long (but
 		// not just for one extra entry!)
-		if (count > max_number_of_items && (i+1) != end) {
+		if (count > max_number_of_items && (i + 1) != end) {
 			int tmpmenuid = get_new_submenu(smn, win);
 			lyxerr[Debug::GUI] << "Too many items, creating "
 					   << "new menu " << tmpmenuid << endl;
@@ -258,7 +259,7 @@ int XFormsMenubar::create_submenu(Window
 			}
 
 			// Is there a separator after the item?
-			if ((i+1) != end
+			if ((i + 1) != end
 			    && (i + 1)->kind() == MenuItem::Separator)
 				label += "%l";
 
@@ -282,7 +283,7 @@ int XFormsMenubar::create_submenu(Window
 				// create the submenu
 				submenuid =
 					create_submenu(win, view,
-						       *item.submenu(), smn);
+						       *item.submenu(), smn, funcs);
 				if (submenuid == -1)
 					return -1;
 				label += "%x" + tostr(smn.size());
@@ -292,10 +293,16 @@ int XFormsMenubar::create_submenu(Window
 					<< "), ";
 			} else {
 				// Add the action
-				label += "%x" + tostr(item.action()
-						      + action_offset);
+				Funcs::iterator fit =
+					funcs.insert(funcs.end(), item.func());
+				int const action_count =
+					std::distance(funcs.begin(), fit);
+
+				label += "%x" + tostr(action_count + action_offset);
 				lyxerr[Debug::GUI] << "Action: \""
-						   << item.action() << "\", ";
+						   << item.func().action
+						   << "(" << item.func().argument
+						   << ")\", ";
 			}
 
 			// Add everything to the menu
@@ -353,9 +360,10 @@ void XFormsMenubar::MenuCallback(FL_OBJE
 	Menu tomenu;
 	Menu const frommenu = menubackend_->getMenu(item->submenuname());
 	menubackend_->expand(frommenu, tomenu, view);
+	Funcs funcs;
 	vector<int> submenus;
 	int menu = iteminfo->menubar_->create_submenu(FL_ObjWin(ob), view,
-						    tomenu, submenus);
+						    tomenu, submenus, funcs);
 	if (menu != -1) {
 		// place popup
 		fl_setpup_position(view->getForm()->x + ob->x,
@@ -370,8 +378,8 @@ void XFormsMenubar::MenuCallback(FL_OBJE
 
 		// If the action value is too low, then it is not a
 		// valid action, but something else.
-		if (choice >= action_offset + 1) {
-			view->getLyXFunc().dispatch(choice - action_offset, true);
+		if (choice >= action_offset) {
+			view->getLyXFunc().dispatch(funcs[choice - action_offset], true);
 		} else {
 			lyxerr[Debug::GUI]
 				<< "MenuCallback: ignoring bogus action "
Index: src/frontends/xforms/XFormsMenubar.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XFormsMenubar.h,v
retrieving revision 1.4
diff -u -p -r1.4 XFormsMenubar.h
--- src/frontends/xforms/XFormsMenubar.h	7 Sep 2003 21:25:34 -0000	1.4
+++ src/frontends/xforms/XFormsMenubar.h	21 Sep 2003 16:39:40 -0000
@@ -12,6 +12,7 @@
 #ifndef XFORMSMENUBAR_H
 #define XFORMSMENUBAR_H
 
+#include "funcrequest.h"
 #include "frontends/Menubar.h"
 
 #include <boost/shared_ptr.hpp>
@@ -22,6 +23,7 @@
 #include "support/std_string.h"
 #include <vector>
 
+
 class LyXView;
 class XFormsView;
 class Menu;
@@ -31,6 +33,8 @@ class MenuBackend;
 class XFormsMenubar : public Menubar {
 public:
 	///
+	typedef std::vector<FuncRequest> Funcs;
+	///
 	XFormsMenubar(LyXView *, MenuBackend const &);
 	///
 	~XFormsMenubar();
@@ -53,7 +57,8 @@ private:
 			    std::vector<int> & smn, Window win);
 	///
 	int create_submenu(Window win, XFormsView * view,
-			   Menu const & menu, std::vector<int> & smn);
+			   Menu const & menu,
+			   std::vector<int> & smn, Funcs & funcs);
 
 	//
 	void makeMenubar(Menu const & menu);
Index: src/frontends/xforms/XFormsToolbar.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XFormsToolbar.C,v
retrieving revision 1.8
diff -u -p -r1.8 XFormsToolbar.C
--- src/frontends/xforms/XFormsToolbar.C	21 Sep 2003 16:02:54 -0000	1.8
+++ src/frontends/xforms/XFormsToolbar.C	21 Sep 2003 16:39:40 -0000
@@ -40,7 +40,7 @@ const int buttonwidth = 30; // the stand
 const int height = 30; // the height of all items in the toolbar
 
 XFormsToolbar::toolbarItem::toolbarItem()
-	: action(LFUN_NOACTION), icon(0)
+	: icon(0)
 {}
 
 
@@ -81,7 +81,7 @@ XFormsToolbar::toolbarItem::operator=(to
 	// But we don't copy the icon from ti
 	kill_icon();
 
-	action = ti.action;
+	func = ti.func;
 
 	return *this;
 }
@@ -113,10 +113,10 @@ void XFormsToolbar::update()
 	ToolbarList::const_iterator p = toollist_.begin();
 	ToolbarList::const_iterator end = toollist_.end();
 	for (; p != end; ++p) {
-		if (p->action == ToolbarBackend::LAYOUTS && combox_) {
+		if (p->func.action == int(ToolbarBackend::LAYOUTS) && combox_) {
 			LyXFunc const & lf = owner_->getLyXFunc();
 			bool const disable =
-				lf.getStatus(LFUN_LAYOUT).disabled();
+				lf.getStatus(FuncRequest(LFUN_LAYOUT)).disabled();
 			setEnabled(combox_, !disable);
 			continue;
 		}
@@ -124,7 +124,7 @@ void XFormsToolbar::update()
 		if (!p->icon)
 			continue;
 
-		FuncStatus const status = owner_->getLyXFunc().getStatus(p->action);
+		FuncStatus const status = owner_->getLyXFunc().getStatus(p->func);
 		if (status.onoff(true)) {
 			// I'd like to use a different color
 			// here, but then the problem is to
@@ -249,9 +249,12 @@ namespace {
 
 void ToolbarCB(FL_OBJECT * ob, long ac)
 {
-	XFormsView * owner = static_cast<XFormsView *>(ob->u_vdata);
+	if (!ob || !ob->u_vdata)
+		return;
 
-	owner->getLyXFunc().dispatch(int(ac), true);
+	XFormsToolbar * ptr = static_cast<XFormsToolbar *>(ob->u_vdata);
+	XFormsView * owner = ptr->owner_;
+	owner->getLyXFunc().dispatch(ptr->funcs[ac], true);
 }
 
 
@@ -273,6 +276,8 @@ void XFormsToolbar::add(ToolbarBackend::
 	if (!toollist_.empty())
 		return;
 
+	funcs.clear();
+	
 	ToolbarBackend::item_iterator it = tb.items.begin();
 	ToolbarBackend::item_iterator end = tb.items.end();
 	for (; it != end; ++it)
@@ -280,12 +285,12 @@ void XFormsToolbar::add(ToolbarBackend::
 }
 
 
-void XFormsToolbar::add(int action, string const & tooltip)
+void XFormsToolbar::add(FuncRequest const & func, string const & tooltip)
 {
 	toolbarItem item;
-	item.action = action;
+	item.func = func;
 
-	switch (action) {
+	switch (func.action) {
 	case ToolbarBackend::SEPARATOR:
 		xpos += sepspace;
 		break;
@@ -322,17 +327,19 @@ void XFormsToolbar::add(int action, stri
 		fl_set_object_gravity(obj,
 				      NorthWestGravity,
 				      NorthWestGravity);
-		fl_set_object_callback(obj, C_Toolbar_ToolbarCB,
-				       static_cast<long>(action));
+
+		Funcs::iterator fit = funcs.insert(funcs.end(), func);
+		int const index = std::distance(funcs.begin(), fit);
+		fl_set_object_callback(obj, C_Toolbar_ToolbarCB, index);
 		// Remove the blue feedback rectangle
 		fl_set_pixmapbutton_focus_outline(obj, 0);
 
 		tooltip_->init(obj, tooltip);
 
 		// The view that this object belongs to.
-		obj->u_vdata = owner_;
+		obj->u_vdata = this;
 
-		string const xpm = toolbarbackend.getIcon(action);
+		string const xpm = toolbarbackend.getIcon(func);
 		fl_set_pixmapbutton_file(obj, xpm.c_str());
 
 		// we must remember to update the positions
Index: src/frontends/xforms/XFormsToolbar.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XFormsToolbar.h,v
retrieving revision 1.4
diff -u -p -r1.4 XFormsToolbar.h
--- src/frontends/xforms/XFormsToolbar.h	9 Sep 2003 18:27:22 -0000	1.4
+++ src/frontends/xforms/XFormsToolbar.h	21 Sep 2003 16:39:40 -0000
@@ -36,7 +36,7 @@ public:
 	void add(ToolbarBackend::Toolbar const & tb);
 
 	/// add an item to a toolbar
-	void add(int action, string const & tooltip);
+	void add(FuncRequest const &, string const & tooltip);
 
 	/// display toolbar, not implemented
 	void displayToolbar(ToolbarBackend::Toolbar const & tb, bool show);
@@ -67,11 +67,15 @@ public:
 		/// deallocate icon
 		void kill_icon();
 
-		/// lyx action number
-		int action;
+		/// lyx action
+		FuncRequest func;
 		/// icon for this item
 		FL_OBJECT * icon;
 	};
+
+	typedef std::vector<FuncRequest> Funcs;
+
+	Funcs funcs;
 
 	typedef std::vector<toolbarItem> ToolbarList;
 
-- 
        Lgb

Reply via email to