/**
* \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()
: base_class(_("Character"))
{
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);
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());
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());
}