]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt2/QDocument.C
better selection and scrolling behaviour
[lyx.git] / src / frontends / qt2 / QDocument.C
index b5fcad6416249e1ce1478ab118884218681dfe0d..e40c10ebf76c2b6cfefb10b13f991f5b3c652756 100644 (file)
@@ -85,10 +85,10 @@ void QDocument::build_dialog()
        dialog_->langModule->quoteStyleCO->insertItem(_("»text«"));
 
        // packages
-       char const * items[] = {"default","auto","latin1","latin2",
-                            "latin3","latin4","latin5","latin9",
-                            "koi8-r","koi8-u","cp866","cp1251",
-                            "iso88595","pt154",0};
+       char const * items[] = {"default", "auto", "latin1", "latin2",
+                            "latin3", "latin4", "latin5", "latin9",
+                            "koi8-r", "koi8-u", "cp866", "cp1251",
+                            "iso88595", "pt154", 0};
        dialog_->packagesModule->encodingCO->insertStrList(items);
 
        dialog_->packagesModule->lspacingCO->insertItem(
@@ -106,10 +106,10 @@ void QDocument::build_dialog()
        }
 
        // paper
-       char const * sizes[] = { 
+       char const * sizes[] = {
                _("Default") , _("Custom") , _("US letter") , _("US legal")
                   , _("US executive") , _("A3") , _("A4") , _("A5")
-                  , _("B3") , _("B4") , _("B5") };
+                  , _("B3") , _("B4") , _("B5"), 0 };
        dialog_->paperModule->papersizeCO->insertStrList(sizes);
 
        // layout
@@ -208,7 +208,7 @@ void QDocument::apply()
        params.user_defined_bullets[1].setText(dialog_->bulletsModule->bullet2LE->text().latin1());
        params.user_defined_bullets[2].setText(dialog_->bulletsModule->bullet3LE->text().latin1());
        params.user_defined_bullets[3].setText(dialog_->bulletsModule->bullet4LE->text().latin1());
-       
+
        params.user_defined_bullets[0].setSize(dialog_->bulletsModule->bulletsize1CO->currentItem()-1);
        params.user_defined_bullets[1].setSize(dialog_->bulletsModule->bulletsize2CO->currentItem()-1);
        params.user_defined_bullets[2].setSize(dialog_->bulletsModule->bulletsize3CO->currentItem()-1);
@@ -336,7 +336,7 @@ void QDocument::apply()
        params.paperpackage = char(margin);
 
        MarginsModuleBase const * m(dialog_->marginsModule);
+
        params.leftmargin =
                LyXLength(m->innerLE->text().toDouble(),
                          m->innerUnit->currentLengthItem()
@@ -439,7 +439,7 @@ void QDocument::update_contents()
        dialog_->bulletsModule->bullet3LE->setText(s);
        s = params.user_defined_bullets[3].getText().c_str();
        dialog_->bulletsModule->bullet4LE->setText(s);
-       
+
        dialog_->bulletsModule->bulletsize1CO->setCurrentItem(
                params.user_defined_bullets[0].getSize() + 1);
        dialog_->bulletsModule->bulletsize2CO->setCurrentItem(
@@ -448,9 +448,9 @@ void QDocument::update_contents()
                params.user_defined_bullets[2].getSize() + 1);
        dialog_->bulletsModule->bulletsize4CO->setCurrentItem(
                params.user_defined_bullets[3].getSize() + 1);
-       
+
        // packages
-       char const * enc[] = { 
+       char const * enc[] = {
                "default" , "auto" , "latin1" , "latin2" , "latin3" ,
                "latin4" , "latin5" , "latin9" , "koi8-r" , "koi8-u" ,
                "cp866" , "cp1251" , "iso88595" , "pt154" };
@@ -472,11 +472,14 @@ void QDocument::update_contents()
        dialog_->packagesModule->amsCB->setChecked(
                params.use_amsmath);
 
-       // FIXME: this is wrong
-       // QComboBox::setCurrentItem: (lspacingCO) Index 4 out of range
-       dialog_->packagesModule->lspacingCO->
-               setCurrentItem(params.spacing.getSpace());
+       switch (params.spacing.getSpace()) {
+               case Spacing::Other: nitem = 3; break;
+               case Spacing::Double: nitem = 2; break;
+               case Spacing::Onehalf: nitem = 1; break;
+               case Spacing::Default: case Spacing::Single: nitem = 0; break;
+       }
+
+       dialog_->packagesModule->lspacingCO->setCurrentItem(nitem);
        if (params.spacing.getSpace() == Spacing::Other) {
                dialog_->packagesModule->lspacingLE->setText(
                        tostr(params.spacing.getValue()).c_str());
@@ -575,9 +578,9 @@ void QDocument::update_contents()
                tostr(LyXLength(params.paperheight).value()).c_str());
 
        // margins
+
        MarginsModuleBase * m(dialog_->marginsModule);
+
        int item = params.paperpackage;
        if (params.use_geometry) {
                item = 1;