The attached patch does this making the xforms and Qt frontends similar in 
this respect. What do xforms users think?

(Note, I haven't culled the preamble dialog yet, just given the document 
dialog a preamble tab. If you like it, however, then I will remove the 
preamble dialog entirely.)

-- 
Angus
Index: src/frontends/xforms/FormDocument.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormDocument.C,v
retrieving revision 1.132
diff -u -p -r1.132 FormDocument.C
--- src/frontends/xforms/FormDocument.C	10 Mar 2003 03:13:26 -0000	1.132
+++ src/frontends/xforms/FormDocument.C	26 Mar 2003 13:09:28 -0000
@@ -87,6 +87,18 @@ void FormDocument::build()
 	bcview().setCancel(dialog_->button_close);
 	bcview().setRestore(dialog_->button_restore);
 
+	// the document preamble form
+	preamble_.reset(build_document_preamble(this));
+
+	// trigger an input event for cut&paste with middle mouse button.
+	setPrehandler(preamble_->input_preamble);
+
+	// for activate ok/apply immediately upon input
+	fl_set_input_return(preamble_->input_preamble, FL_RETURN_CHANGED);
+
+	// disable for read-only documents
+	bcview().addReadOnly(preamble_->input_preamble);
+
 	// the document class form
 	class_.reset(build_document_class(this));
 
@@ -347,6 +359,8 @@ void FormDocument::build()
 			   options_->form);
 	fbullet = fl_addto_tabfolder(dialog_->tabfolder,_("Bullets"),
 				     bullets_->form);
+	fl_addto_tabfolder(dialog_->tabfolder,_("Preamble"),
+			   preamble_->form);
 
 	// work-around xforms bug re update of folder->x, folder->y coords.
 	setPrehandler(dialog_->tabfolder);
@@ -365,6 +379,8 @@ void FormDocument::apply()
 {
 	BufferParams & params = controller().params();
 
+	params.preamble = getString(preamble_->input_preamble);
+
 	class_apply(params);
 	paper_apply(params);
 	language_apply(params);
@@ -381,6 +397,8 @@ void FormDocument::update()
 	checkReadOnly();
 
 	BufferParams const & params = controller().params();
+
+	fl_set_input(preamble_->input_preamble, params.preamble.c_str());
 
 	class_update(params);
 	paper_update(params);
Index: src/frontends/xforms/FormDocument.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormDocument.h,v
retrieving revision 1.35
diff -u -p -r1.35 FormDocument.h
--- src/frontends/xforms/FormDocument.h	13 Feb 2003 16:52:55 -0000	1.35
+++ src/frontends/xforms/FormDocument.h	26 Mar 2003 13:09:28 -0000
@@ -30,6 +30,7 @@ struct FD_document_class;
 struct FD_document_language;
 struct FD_document_options;
 struct FD_document_bullet;
+struct FD_document_preamble;
 
 /** This class provides an XForms implementation of the FormDocument dialog.
     The table-layout-form here changes values for latex-tabulars
@@ -103,6 +104,8 @@ private:
 	boost::scoped_ptr<FD_document_options>  options_;
 	///
 	boost::scoped_ptr<FD_document_bullet>   bullets_;
+	///
+	boost::scoped_ptr<FD_document_preamble> preamble_;
 	///
 	int ActCell;
 	///
Index: src/frontends/xforms/forms/form_document.fd
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/forms/form_document.fd,v
retrieving revision 1.33
diff -u -p -r1.33 form_document.fd
--- src/frontends/xforms/forms/form_document.fd	6 Mar 2003 11:07:55 -0000	1.33
+++ src/frontends/xforms/forms/form_document.fd	26 Mar 2003 13:09:30 -0000
@@ -3,7 +3,7 @@ Magic: 13000
 Internal Form Definition File
     (do not change)
 
-Number of forms: 6
+Number of forms: 7
 Unit of measure: FL_COORD_PIXEL
 SnapGrid: 5
 
@@ -1853,6 +1853,48 @@ gravity: FL_NoGravity FL_NoGravity
 name: 
 callback: 
 argument: 
+
+=============== FORM ===============
+Name: form_document_preamble
+Width: 395
+Height: 310
+Number of Objects: 2
+
+--------------------
+class: FL_BOX
+type: FLAT_BOX
+box: 0 0 395 310
+boxtype: FL_FLAT_BOX
+colors: FL_COL1 FL_COL1
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NoGravity FL_NoGravity
+name: 
+callback: 
+argument: 
+
+--------------------
+class: FL_INPUT
+type: MULTILINE_INPUT
+box: 5 5 385 300
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_MCOL
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: 
+shortcut: 
+resize: FL_RESIZE_ALL
+gravity: FL_NorthWest FL_SouthEast
+name: input_preamble
+callback: C_FormBaseInputCB
+argument: 0
 
 ==============================
 create_the_forms

Reply via email to