On 5/23/07, Juergen Spitzmueller <[EMAIL PROTECTED]> wrote:
Herbert Voss wrote:

> from the manual *tbph for float and tbp for floatplacement

Then here comes the patch:

1. disallow h in floatplacement and allow * in float

-       { "float", "false", true,  SUBSETOF, "tbph", "" },
-       { "floatplacement", "tbp", false, SUBSETOF, "tbph", "" },
+       { "float", "false", true,  SUBSETOF, "*tbph", "" },
+       { "floatplacement", "tbp", false, SUBSETOF, "tbp", "" },

2. allow input of * in the placement text editor.

Index: src/frontends/qt4/QListings.cpp
===================================================================
--- src/frontends/qt4/QListings.cpp     (revision 18476)
+++ src/frontends/qt4/QListings.cpp     (working copy)
@@ -208,7 +208,7 @@
       numberStepLE->setValidator(new QIntValidator(0, 1000000, this));
       firstlineLE->setValidator(new QIntValidator(0, 1000000, this));
       lastlineLE->setValidator(new QIntValidator(0, 1000000, this));
-       placementLE->setValidator(new
QRegExpValidator(QRegExp("[tbph]*"), this));
+       placementLE->setValidator(new
QRegExpValidator(QRegExp("[\*tbph]*"), this));

3. output float=xxx. I.e. treat placement as the editor for float.
(previously, we output float,floatplacement=xxx).

-       if (float_)
-               par.addParam("float", "");
-       if (!placement.empty())
-               par.addParam("floatplacement", placement);
+       // this dialog uses float=placement instead of
float,floatplacement=placement
+       // because float accepts *tbph and floatplacement accepts bph.
+       // our placement textedit is actually for the float parameter
+       if (float_) {
+               if (placement.empty())
+                       par.addParam("float", "");
+               else
+                       par.addParam("float", placement);
+       }

4. Leave floatplacement to 'advanced'.

-               } else if (prefixIs(*it, "floatplacement=")) {
-                       dialog_->floatCB->setChecked(true);
-                       dialog_->placementLE->setEnabled(true);
-                       dialog_->placementLE->setText(
-                               toqstr(plainParam(it->substr(15))));
-                       dialog_->inlineCB->setChecked(false);
-                       *it = "";

Please test.

Bo
Index: src/insets/InsetListingsParams.cpp
===================================================================
--- src/insets/InsetListingsParams.cpp	(revision 18476)
+++ src/insets/InsetListingsParams.cpp	(working copy)
@@ -72,7 +72,7 @@
 	//     info is a \n separated string with allowed values
 	// SUBSETOF
 	//     info is a string from which par is composed of
-	//     (e.g. floatplacement can be one or more of tbph)
+	//     (e.g. floatplacement can be one or more of *tbph)
 	param_type type;
 	/// parameter info, meaning depending on parameter type
 	char const * info;
@@ -115,8 +115,8 @@
 /// options copied from page 26 of listings manual
 // FIXME: add default parameters ... (which is not used now)
 listings_param_info const listings_param_table[] = {
-	{ "float", "false", true,  SUBSETOF, "tbph", "" },
-	{ "floatplacement", "tbp", false, SUBSETOF, "tbph", "" },
+	{ "float", "false", true,  SUBSETOF, "*tbph", "" },
+	{ "floatplacement", "tbp", false, SUBSETOF, "tbp", "" },
 	{ "aboveskip", "\\medskipamount", false, LENGTH, "", "" },
 	{ "belowskip", "\\medskipamount", false, LENGTH, "", "" },
 	{ "lineskip", "", false, LENGTH, "", "" },
Index: src/frontends/qt4/QListings.cpp
===================================================================
--- src/frontends/qt4/QListings.cpp	(revision 18476)
+++ src/frontends/qt4/QListings.cpp	(working copy)
@@ -208,7 +208,7 @@
 	numberStepLE->setValidator(new QIntValidator(0, 1000000, this));
 	firstlineLE->setValidator(new QIntValidator(0, 1000000, this));
 	lastlineLE->setValidator(new QIntValidator(0, 1000000, this));
-	placementLE->setValidator(new QRegExpValidator(QRegExp("[tbph]*"), this));
+	placementLE->setValidator(new QRegExpValidator(QRegExp("[\*tbph]*"), this));
 }
 
 
@@ -287,10 +287,15 @@
 		else
 			par.addParam("language", "{[" + dialect + "]" + language + "}");
 	}
-	if (float_)
-		par.addParam("float", "");
-	if (!placement.empty())
-		par.addParam("floatplacement", placement);
+	// this dialog uses float=placement instead of float,floatplacement=placement
+	// because float accepts *tbph and floatplacement accepts bph.
+	// our placement textedit is actually for the float parameter
+	if (float_) {
+		if (placement.empty())
+			par.addParam("float", "");
+		else
+			par.addParam("float", placement);
+	}
 	if (numberSide != "none")
 		par.addParam("numbers", numberSide);
 	if (numberfontsize != "default" && numberSide != "none")
@@ -505,13 +510,6 @@
 			dialog_->languageCO->setEnabled(in_gui);
 			dialog_->dialectCO->setEnabled(
 				in_gui && dialog_->dialectCO->count() > 1);
-		} else if (prefixIs(*it, "floatplacement=")) {
-			dialog_->floatCB->setChecked(true);
-			dialog_->placementLE->setEnabled(true);
-			dialog_->placementLE->setText(
-				toqstr(plainParam(it->substr(15))));
-			dialog_->inlineCB->setChecked(false);
-			*it = "";
 		} else if (prefixIs(*it, "float")) {
 			dialog_->floatCB->setChecked(true);
 			dialog_->inlineCB->setChecked(false);

Reply via email to