... attached is the patch I was trying to make at the start of all 
this. With this all inset dialogs can be opened from the command 
line:

dialog-show-new-inset bibitem
dialog-show-new-inset bibtex
dialog-show-new-inset box Boxed
dialog-show-new-inset box Doublebox
dialog-show-new-inset box Frameless
dialog-show-new-inset box ovalbox
dialog-show-new-inset box Ovalbox
dialog-show-new-inset box Shadowbox
dialog-show-new-inset branch
dialog-show-new-inset citation
dialog-show-new-inset ert
dialog-show-new-inset external
dialog-show-new-inset float
dialog-show-new-inset graphics
dialog-show-new-inset include
dialog-show-new-inset index
dialog-show-new-inset label
dialog-show-new-inset minipage
dialog-show-new-inset note
dialog-show-new-inset ref
dialog-show-new-inset toc
dialog-show-new-inset url
dialog-show-new-inset vspace
dialog-show-new-inset wrap

The insetcollapsable-derived insets don't actually do anything on 
'Apply' (don't create an inset) but that's a separate issue.

-- 
Angus
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.1744
diff -u -p -r1.1744 ChangeLog
--- src/ChangeLog	10 Dec 2003 21:48:37 -0000	1.1744
+++ src/ChangeLog	10 Dec 2003 22:02:21 -0000
@@ -1,5 +1,10 @@
 2003-12-10  Angus Leeming  <[EMAIL PROTECTED]>
 
+	* lyxfunc.C (dispatch): enable all inset dialogs to be opened with
+	'dialog-show-new-inset <inset name>'
+
+2003-12-10  Angus Leeming  <[EMAIL PROTECTED]>
+
 	* buffer.C: up the format to 227.
 
 	* factory.C: the box inset is now identified simply by 'Box'.
Index: src/lyxfunc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v
retrieving revision 1.549
diff -u -p -r1.549 lyxfunc.C
--- src/lyxfunc.C	5 Dec 2003 13:37:20 -0000	1.549
+++ src/lyxfunc.C	10 Dec 2003 22:02:22 -0000
@@ -51,10 +51,18 @@
 #include "ParagraphParameters.h"
 #include "undo.h"
 
+#include "insets/insetbox.h"
+#include "insets/insetbranch.h"
 #include "insets/insetcommand.h"
+#include "insets/insetert.h"
 #include "insets/insetexternal.h"
+#include "insets/insetfloat.h"
+#include "insets/insetgraphics.h"
+#include "insets/insetminipage.h"
+#include "insets/insetnote.h"
 #include "insets/insettabular.h"
 #include "insets/insetvspace.h"
+#include "insets/insetwrap.h"
 
 #include "mathed/math_cursor.h"
 
@@ -559,6 +567,10 @@ FuncStatus LyXFunc::getStatus(FuncReques
 			code = InsetOld::BIBITEM_CODE;
 		else if (ev.argument == "bibtex")
 			code = InsetOld::BIBTEX_CODE;
+		else if (ev.argument == "box")
+			code = InsetOld::BOX_CODE;
+		else if (ev.argument == "branch")
+			code = InsetOld::BRANCH_CODE;
 		else if (ev.argument == "citation")
 			code = InsetOld::CITE_CODE;
 		else if (ev.argument == "ert")
@@ -577,6 +589,8 @@ FuncStatus LyXFunc::getStatus(FuncReques
 			code = InsetOld::LABEL_CODE;
 		else if (ev.argument == "minipage")
 			code = InsetOld::MINIPAGE_CODE;
+		else if (ev.argument == "note")
+			code = InsetOld::NOTE_CODE;
 		else if (ev.argument == "ref")
 			code = InsetOld::REF_CODE;
 		else if (ev.argument == "toc")
@@ -1237,23 +1251,53 @@ void LyXFunc::dispatch(FuncRequest const
 		}
 
 		case LFUN_DIALOG_SHOW_NEW_INSET: {
-			string const & name = argument;
-			string data;
+			string const name = func.getArg(0);
+			string data = trim(func.argument.substr(name.size()));
 			if (name == "bibitem" ||
-					name == "bibtex" ||
-					name == "include" ||
-					name == "index" ||
-					name == "ref" ||
-					name == "toc" ||
-					name == "url") {
+			    name == "bibtex" ||
+			    name == "include" ||
+			    name == "index" ||
+			    name == "label" ||
+			    name == "ref" ||
+			    name == "toc" ||
+			    name == "url") {
 				InsetCommandParams p(name);
 				data = InsetCommandMailer::params2string(name, p);
+			} else if (name == "box") {
+				// \c data == "Boxed" || "Frameless" etc
+				InsetBoxParams p(data);
+				data = InsetBoxMailer::params2string(p);
+			} else if (name == "branch") {
+				InsetBranchParams p;
+				data = InsetBranchMailer::params2string(p);
 			} else if (name == "citation") {
 				InsetCommandParams p("cite");
 				data = InsetCommandMailer::params2string(name, p);
+			} else if (name == "ert") {
+				data = InsetERTMailer::params2string(InsetCollapsable::Open);
+			} else if (name == "external") {
+				InsetExternalParams p;
+				Buffer const & buffer = *owner->buffer();
+				data = InsetExternalMailer::params2string(p, buffer);
+			} else if (name == "float") {
+				InsetFloatParams p;
+				data = InsetFloatMailer::params2string(p);
+			} else if (name == "graphics") {
+				InsetGraphicsParams p;
+				Buffer const & buffer = *owner->buffer();
+				data = InsetGraphicsMailer::params2string(p, buffer);
+			} else if (name == "minipage") {
+				InsetMinipage::Params p;
+				data = InsetMinipageMailer::params2string(p);
+			} else if (name == "note") {
+				InsetNoteParams p;
+				data = InsetNoteMailer::params2string(p);
 			} else if (name == "vspace") {
 				VSpace space;
 				data = InsetVSpaceMailer::params2string(space);
+			} else if (name == "wrap") {
+				InsetWrapParams p;
+				data = InsetWrapMailer::params2string(p);
 			}
 			owner->getDialogs().show(name, data, 0);
 			break;

Reply via email to