]> git.lyx.org Git - features.git/commitdiff
InsetListings: use float for placements because of the handling differences between...
authorBo Peng <bpeng@lyx.org>
Fri, 25 May 2007 14:38:22 +0000 (14:38 +0000)
committerBo Peng <bpeng@lyx.org>
Fri, 25 May 2007 14:38:22 +0000 (14:38 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18508 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/QListings.cpp
src/insets/InsetListingsParams.cpp

index 1324f806481ed242f9f4b869d4d02538690517c6..25606e02c71cdaaba37366d61ae5653a4073f1e3 100644 (file)
@@ -208,7 +208,7 @@ QListingsDialog::QListingsDialog(QListings * form)
        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,11 @@ string QListingsDialog::construct_params()
                else
                        par.addParam("language", "{[" + dialect + "]" + language + "}");
        }
+       // 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_)
-               par.addParam("float", "");
-       if (!placement.empty())
-               par.addParam("floatplacement", placement);
+               par.addParam("float", placement);
        if (numberSide != "none")
                par.addParam("numbers", numberSide);
        if (numberfontsize != "default" && numberSide != "none")
@@ -505,13 +506,6 @@ void QListings::update_contents()
                        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);
index 2a43111a1c0555324a6e41a71be1f4eff0cf233c..86f27c69152cdb9d13dca12161a9526d1ab5d9a6 100644 (file)
@@ -77,7 +77,7 @@ struct listings_param_info {
        //     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;
@@ -120,8 +120,8 @@ char const * color_hint = N_("Enter something like \\color{white}");
 /// 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, "", "" },