http://bugzilla.lyx.org/show_bug.cgi?id=5709

This long standing bug is now easy to fix by means of command-alternatives. 
However, the toolbar is not yet prepared to command-alternatives. The attached 
patch implements a simple solution: just use the icon for the first of the 
alternative commands in the sequence. This works well for the case in question 
(the icons just need to be renamed to their "m-*" counterparts).

Objections?

Jürgen
Index: lib/ui/stdtoolbars.inc
===================================================================
--- lib/ui/stdtoolbars.inc	(Revision 28269)
+++ lib/ui/stdtoolbars.inc	(Arbeitskopie)
@@ -126,13 +126,13 @@
 		Item "Set all lines" "tabular-feature set-all-lines"
 		Item "Unset all lines" "tabular-feature unset-all-lines"
 		Separator
-		Item "Align left" "tabular-feature align-left"
-		Item "Align center" "tabular-feature align-center"
-		Item "Align right" "tabular-feature align-right"
+		Item "Align left" "command-alternatives tabular-feature m-align-left;tabular-feature align-left"
+		Item "Align center" "command-alternatives tabular-feature m-align-center;tabular-feature align-center"
+		Item "Align right" "command-alternatives tabular-feature m-align-right;tabular-feature align-right"
 		Separator
-		Item "Align top" "tabular-feature valign-top"
-		Item "Align middle" "tabular-feature valign-middle"
-		Item "Align bottom" "tabular-feature valign-bottom"
+		Item "Align top" "command-alternatives tabular-feature m-valign-top;tabular-feature valign-top"
+		Item "Align middle" "command-alternatives tabular-feature m-valign-middle;tabular-feature valign-middle"
+		Item "Align bottom" "command-alternatives tabular-feature m-valign-bottom;tabular-feature valign-bottom"
 		Separator
 		Item "Rotate cell" "tabular-feature toggle-rotate-cell"
 		Item "Rotate table" "tabular-feature toggle-rotate-tabular"
Index: src/frontends/qt4/GuiApplication.cpp
===================================================================
--- src/frontends/qt4/GuiApplication.cpp	(Revision 28269)
+++ src/frontends/qt4/GuiApplication.cpp	(Arbeitskopie)
@@ -310,6 +310,14 @@
 		path = "commands/";
 		name1 = toqstr(f.argument());
 		break;
+	case LFUN_COMMAND_ALTERNATIVES: {
+		// use the first command
+		docstring firstcom;
+		docstring dummy = split(f.argument(), firstcom, ';');
+		name1 = toqstr(firstcom);
+		name1.replace(' ', '_');
+		break;
+	}
 	default:
 		name2 = toqstr(lyxaction.getActionName(f.action));
 		name1 = name2;

Reply via email to