]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt2/QCharacter.C
Some string(widget->text()) fixes. Weirdness
[lyx.git] / src / frontends / qt2 / QCharacter.C
index 2d7a64bc3290dcb6ba426339603e2a30dc63dc9d..b6ebdf7b1d69ba5e6f32f9c96987baa97fc5ef5c 100644 (file)
@@ -1,34 +1,42 @@
 /**
  * \file QCharacter.C
- * Copyright 2001 the LyX Team
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * \author Edwin Leuven, leuven@fee.uva.nl
- * \author John Levon <moz@compsoc.man.ac.uk>
+ * \author Edwin Leuven
+ * \author John Levon
+ *
+ * Full author contact details are available in file CREDITS
  */
 
 #include <config.h>
 
-#include <vector>
-
-#include "gettext.h"
-#include "support/lstrings.h"
+#ifdef __GNUG__
+#pragma implementation
+#endif
 
 #include "ControlCharacter.h"
 #include "QCharacterDialog.h"
 #include "QCharacter.h"
 #include "Qt2BC.h"
+
+#include "gettext.h"
+#include "support/lstrings.h"
+
 #include <qcombobox.h>
 #include <qcheckbox.h>
 #include <qpushbutton.h>
 
+#include <vector>
+
 using namespace frnt;
 using std::vector;
 
 typedef Qt2CB<ControlCharacter, Qt2DB<QCharacterDialog> > base_class;
 
-QCharacter::QCharacter(ControlCharacter & c, Dialogs &)
-       : base_class(c, _("Character"))
+
+QCharacter::QCharacter()
+       : base_class(_("Character"))
 {
 }
 
@@ -49,6 +57,7 @@ void QCharacter::build_dialog()
                cit != family.end(); ++cit) {
                dialog_->familyCO->insertItem(cit->first.c_str(), -1);
        }
+
        for (vector<SeriesPair>::const_iterator cit = series.begin();
                cit != series.end(); ++cit) {
                dialog_->seriesCO->insertItem(cit->first.c_str(), -1);
@@ -94,7 +103,10 @@ namespace {
 template<class A, class B>
 int findPos2nd(vector<std::pair<A,B> > const & vec, B const & val)
 {
-       vector<std::pair<A,B> >::const_iterator cit = vec.begin();
+       typedef typename vector<std::pair<A, B> >::const_iterator
+               const_iterator;
+
+       const_iterator cit = vec.begin();
        for (; cit != vec.end(); ++cit) {
                if (cit->second == val)
                        return int(cit - vec.begin());
@@ -107,27 +119,34 @@ int findPos2nd(vector<std::pair<A,B> > const & vec, B const & val)
 
 void QCharacter::update_contents()
 {
-       dialog_->familyCO->setCurrentItem(findPos2nd(family, controller().getFamily()));
-       dialog_->seriesCO->setCurrentItem(findPos2nd(series, controller().getSeries()));
-       dialog_->shapeCO->setCurrentItem(findPos2nd(shape, controller().getShape()));
-       dialog_->sizeCO->setCurrentItem(findPos2nd(size, controller().getSize()));
-       dialog_->miscCO->setCurrentItem(findPos2nd(bar, controller().getBar()));
-       dialog_->colorCO->setCurrentItem(findPos2nd(color, controller().getColor()));
-       dialog_->langCO->setCurrentItem(findPos2nd(language, controller().getLanguage()));
-
-       dialog_->toggleallCB->setChecked(controller().getToggleAll());
+       ControlCharacter const & ctrl = controller();
+
+       dialog_->familyCO->setCurrentItem(findPos2nd(family,
+                                                    ctrl.getFamily()));
+       dialog_->seriesCO->setCurrentItem(findPos2nd(series,
+                                                    ctrl.getSeries()));
+       dialog_->shapeCO->setCurrentItem(findPos2nd(shape, ctrl.getShape()));
+       dialog_->sizeCO->setCurrentItem(findPos2nd(size, ctrl.getSize()));
+       dialog_->miscCO->setCurrentItem(findPos2nd(bar, ctrl.getBar()));
+       dialog_->colorCO->setCurrentItem(findPos2nd(color, ctrl.getColor()));
+       dialog_->langCO->setCurrentItem(findPos2nd(language,
+                                                  ctrl.getLanguage()));
+
+       dialog_->toggleallCB->setChecked(ctrl.getToggleAll());
 }
 
 
 void QCharacter::apply()
 {
-       controller().setFamily(family[dialog_->familyCO->currentItem()].second);
-       controller().setSeries(series[dialog_->seriesCO->currentItem()].second);
-       controller().setShape(shape[dialog_->shapeCO->currentItem()].second);
-       controller().setSize(size[dialog_->sizeCO->currentItem()].second);
-       controller().setBar(bar[dialog_->miscCO->currentItem()].second);
-       controller().setColor(color[dialog_->colorCO->currentItem()].second);
-       controller().setLanguage(language[dialog_->langCO->currentItem()].second);
-
-       controller().setToggleAll(dialog_->toggleallCB->isChecked());
+       ControlCharacter & ctrl = controller();
+
+       ctrl.setFamily(family[dialog_->familyCO->currentItem()].second);
+       ctrl.setSeries(series[dialog_->seriesCO->currentItem()].second);
+       ctrl.setShape(shape[dialog_->shapeCO->currentItem()].second);
+       ctrl.setSize(size[dialog_->sizeCO->currentItem()].second);
+       ctrl.setBar(bar[dialog_->miscCO->currentItem()].second);
+       ctrl.setColor(color[dialog_->colorCO->currentItem()].second);
+       ctrl.setLanguage(language[dialog_->langCO->currentItem()].second);
+
+       ctrl.setToggleAll(dialog_->toggleallCB->isChecked());
 }