]> git.lyx.org Git - features.git/commitdiff
somewhat more uniform naming
authorAndré Pönitz <poenitz@gmx.net>
Fri, 31 Aug 2007 22:37:05 +0000 (22:37 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 31 Aug 2007 22:37:05 +0000 (22:37 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19962 a592a061-630c-0410-9148-cb99ea01b6c8

21 files changed:
development/qmake/qt4/qt4.pro
development/scons/scons_manifest.py
po/POTFILES.in
src/frontends/qt4/Dialogs.cpp
src/frontends/qt4/GuiCitation.cpp
src/frontends/qt4/GuiCitation.h
src/frontends/qt4/GuiCitationDialog.cpp [deleted file]
src/frontends/qt4/GuiCitationDialog.h [deleted file]
src/frontends/qt4/GuiDelimiter.cpp [new file with mode: 0644]
src/frontends/qt4/GuiDelimiter.h [new file with mode: 0644]
src/frontends/qt4/GuiDelimiterDialog.cpp [deleted file]
src/frontends/qt4/GuiDelimiterDialog.h [deleted file]
src/frontends/qt4/GuiMathMatrix.cpp [new file with mode: 0644]
src/frontends/qt4/GuiMathMatrix.h [new file with mode: 0644]
src/frontends/qt4/GuiMathMatrixDialog.cpp [deleted file]
src/frontends/qt4/GuiMathMatrixDialog.h [deleted file]
src/frontends/qt4/GuiURL.cpp [new file with mode: 0644]
src/frontends/qt4/GuiURL.h [new file with mode: 0644]
src/frontends/qt4/GuiURLDialog.cpp [deleted file]
src/frontends/qt4/GuiURLDialog.h [deleted file]
src/frontends/qt4/Makefile.am

index ce046c1b6e75cce73ad3b9fd5d5012acca29c315..96a39bee125c89fc2c528c00973da9b38e427deb 100644 (file)
@@ -30,12 +30,11 @@ HPP += GuiBranches.h
 HPP += GuiBranch.h
 HPP += GuiChanges.h
 HPP += GuiCharacter.h
-HPP += GuiCitationDialog.h
 HPP += GuiCitation.h
 HPP += GuiClipboard.h
 HPP += GuiCommandBuffer.h
 HPP += GuiCommandEdit.h
-HPP += GuiDelimiterDialog.h
+HPP += GuiDelimiter.h
 HPP += GuiDialogView.h
 HPP += GuiDocument.h
 HPP += GuiErrorList.h
@@ -53,7 +52,7 @@ HPP += GuiIndex.h
 HPP += GuiKeySymbol.h
 HPP += GuiListings.h
 HPP += GuiLog.h
-HPP += GuiMathMatrixDialog.h
+HPP += GuiMathMatrix.h
 HPP += GuiMenubar.h
 HPP += GuiNomencl.h
 HPP += GuiNote.h
@@ -61,7 +60,6 @@ HPP += GuiPainter.h
 HPP += GuiParagraph.h
 HPP += GuiPopupMenu.h
 HPP += GuiPrefs.h
-HPP += GuiPrintDialog.h
 HPP += GuiPrint.h
 HPP += GuiRef.h
 HPP += GuiSearch.h
@@ -77,7 +75,7 @@ HPP += GuiTexinfo.h
 HPP += GuiThesaurus.h
 HPP += GuiToc.h
 HPP += GuiToolbar.h
-HPP += GuiURLDialog.h
+HPP += GuiURL.h
 HPP += GuiView.h
 HPP += GuiViewSource.h
 HPP += GuiVSpace.h
@@ -115,11 +113,10 @@ CPP += GuiBranches.cpp
 CPP += GuiChanges.cpp
 CPP += GuiCharacter.cpp
 CPP += GuiCitation.cpp
-CPP += GuiCitationDialog.cpp
 CPP += GuiClipboard.cpp
 CPP += GuiCommandBuffer.cpp
 CPP += GuiCommandEdit.cpp
-CPP += GuiDelimiterDialog.cpp
+CPP += GuiDelimiter.cpp
 CPP += GuiDialogView.cpp
 CPP += GuiDocument.cpp
 CPP += GuiErrorList.cpp
@@ -137,7 +134,7 @@ CPP += GuiIndex.cpp
 CPP += GuiKeySymbol.cpp
 CPP += GuiListings.cpp
 CPP += GuiLog.cpp
-CPP += GuiMathMatrixDialog.cpp
+CPP += GuiMathMatrix.cpp
 CPP += GuiMenubar.cpp
 CPP += GuiNomencl.cpp
 CPP += GuiNote.cpp
@@ -146,7 +143,6 @@ CPP += GuiParagraph.cpp
 CPP += GuiPopupMenu.cpp
 CPP += GuiPrefs.cpp
 CPP += GuiPrint.cpp
-CPP += GuiPrintDialog.cpp
 CPP += GuiRef.cpp
 CPP += GuiSearch.cpp
 CPP += GuiSelection.cpp
@@ -161,7 +157,7 @@ CPP += GuiTexinfo.cpp
 CPP += GuiThesaurus.cpp
 CPP += GuiToc.cpp
 CPP += GuiToolbar.cpp
-CPP += GuiURLDialog.cpp
+CPP += GuiURL.cpp
 CPP += GuiView.cpp
 CPP += GuiViewSource.cpp
 CPP += GuiVSpace.cpp
index 899dacd47cbce15f3f336fb942183f26c8954be3..49ab43ab4d81e069ac7f3a0cec48bdaee2207e24 100644 (file)
@@ -859,12 +859,11 @@ src_frontends_qt4_header_files = Split('''
     GuiChanges.h
     GuiCharacter.h
     GuiCharacter.h
-    GuiCitationDialog.h
     GuiCitation.h
     GuiClipboard.h
     GuiCommandBuffer.h
     GuiCommandEdit.h
-    GuiDelimiterDialog.h
+    GuiDelimiter.h
     GuiDialogView.h
     GuiDocument.h
     GuiEmbeddedFiles.h
@@ -883,7 +882,7 @@ src_frontends_qt4_header_files = Split('''
     GuiKeySymbol.h
     GuiListings.h
     GuiLog.h
-    GuiMathMatrixDialog.h
+    GuiMathMatrix.h
     GuiMenubar.h
     GuiNomencl.h
     GuiNote.h
@@ -891,7 +890,6 @@ src_frontends_qt4_header_files = Split('''
     GuiParagraph.h
     GuiPopupMenu.h
     GuiPrefs.h
-    GuiPrintDialog.h
     GuiPrint.h
     GuiRef.h
     GuiSearch.h
@@ -907,7 +905,7 @@ src_frontends_qt4_header_files = Split('''
     GuiThesaurus.h
     GuiToc.h
     GuiToolbar.h
-    GuiURLDialog.h
+    GuiURL.h
     GuiView.h
     GuiViewSource.h
     GuiVSpace.h
@@ -947,11 +945,10 @@ src_frontends_qt4_files = Split('''
     GuiChanges.cpp
     GuiCharacter.cpp
     GuiCitation.cpp
-    GuiCitationDialog.cpp
     GuiClipboard.cpp
     GuiCommandBuffer.cpp
     GuiCommandEdit.cpp
-    GuiDelimiterDialog.cpp
+    GuiDelimiter.cpp
     GuiDialogView.cpp
     GuiDocument.cpp
     GuiEmbeddedFiles.cpp
@@ -970,7 +967,7 @@ src_frontends_qt4_files = Split('''
     GuiKeySymbol.cpp
     GuiListings.cpp
     GuiLog.cpp
-    GuiMathMatrixDialog.cpp
+    GuiMathMatrix.cpp
     GuiMenubar.cpp
     GuiNomencl.cpp
     GuiNote.cpp
@@ -979,7 +976,6 @@ src_frontends_qt4_files = Split('''
     GuiPopupMenu.cpp
     GuiPrefs.cpp
     GuiPrint.cpp
-    GuiPrintDialog.cpp
     GuiRef.cpp
     GuiSearch.cpp
     GuiSelection.cpp
@@ -994,7 +990,7 @@ src_frontends_qt4_files = Split('''
     GuiThesaurus.cpp
     GuiToc.cpp
     GuiToolbar.cpp
-    GuiURLDialog.cpp
+    GuiURL.cpp
     GuiView.cpp
     GuiViewSource.cpp
     GuiVSpace.cpp
index b3b61268d2e4b6e952f10aa9a3c2c8acc9a41e7b..bcd9d336a9897f26ce17fef231439425e0ad29be 100644 (file)
@@ -59,9 +59,9 @@ src/frontends/qt4/GuiBranch.cpp
 src/frontends/qt4/GuiBranches.cpp
 src/frontends/qt4/GuiChanges.cpp
 src/frontends/qt4/GuiCharacter.cpp
-src/frontends/qt4/GuiCitationDialog.cpp
+src/frontends/qt4/GuiCitation.cpp
 src/frontends/qt4/GuiCommandBuffer.cpp
-src/frontends/qt4/GuiDelimiterDialog.cpp
+src/frontends/qt4/GuiDelimiter.cpp
 src/frontends/qt4/GuiDocument.cpp
 src/frontends/qt4/GuiERT.cpp
 src/frontends/qt4/GuiExternal.cpp
@@ -69,7 +69,7 @@ src/frontends/qt4/GuiFloat.cpp
 src/frontends/qt4/GuiGraphics.cpp
 src/frontends/qt4/GuiInclude.cpp
 src/frontends/qt4/GuiListings.cpp
-src/frontends/qt4/GuiMathMatrixDialog.cpp
+src/frontends/qt4/GuiMathMatrix.cpp
 src/frontends/qt4/GuiNote.cpp
 src/frontends/qt4/GuiParagraph.cpp
 src/frontends/qt4/GuiPrefs.cpp
@@ -83,12 +83,12 @@ src/frontends/qt4/GuiTabular.cpp
 src/frontends/qt4/GuiTabularCreate.cpp
 src/frontends/qt4/GuiTexinfo.cpp
 src/frontends/qt4/GuiThesaurus.cpp
+src/frontends/qt4/GuiUrl.cpp
 src/frontends/qt4/GuiVSpace.cpp
 src/frontends/qt4/GuiView.cpp
 src/frontends/qt4/GuiWrap.cpp
 src/frontends/qt4/IconPalette.cpp
 src/frontends/qt4/Qt2BC.h
-src/frontends/qt4/UrlView.cpp
 src/frontends/qt4/Validator.cpp
 src/frontends/qt4/alert_pimpl.cpp
 src/gettext.h
index 5a29b438831750e1dc2f7f6ddba377f52e6d29d0..918cd1e636ce5968a47adf522a5107d14b7a8ca0 100644 (file)
@@ -56,8 +56,7 @@
 #include "GuiChanges.h"
 #include "GuiCharacter.h"
 #include "GuiCitation.h"
-#include "GuiCitationDialog.h"
-#include "GuiDelimiterDialog.h"
+#include "GuiDelimiter.h"
 #include "GuiDocument.h"
 #include "GuiEmbeddedFiles.h"
 #include "GuiErrorList.h"
@@ -67,7 +66,7 @@
 #include "GuiGraphics.h"
 #include "GuiInclude.h"
 #include "GuiIndex.h"
-#include "GuiMathMatrixDialog.h"
+#include "GuiMathMatrix.h"
 #include "GuiNomencl.h"
 #include "GuiListings.h"
 #include "GuiLog.h"
@@ -86,7 +85,7 @@
 #include "GuiTexinfo.h"
 #include "GuiToc.h"
 #include "TocWidget.h"
-#include "GuiURLDialog.h"
+#include "GuiURL.h"
 #include "GuiVSpace.h"
 #include "GuiWrap.h"
 
index 84bc19e6ed2bdb999e12d3e83ff7a81848b22b7d..1bf47e6d802cf4e740812287c34c9156bb20528d 100644 (file)
@@ -6,7 +6,7 @@
  * \author Angus Leeming
  * \author Kalle Dalheimer
  * \author Abdelrazak Younes
- * \author Richard Heck (adapted to QSelectionManager)
+ * \author Richard Heck
  *
  * Full author contact details are available in file CREDITS.
  */
 
 #include "GuiCitation.h"
 
+#include "debug.h"
+#include "gettext.h"
+#include "frontend_helpers.h"
 #include "qt_helpers.h"
 
 #include "support/lstrings.h"
 #include "support/docstring.h"
 
-#include "debug.h"
-
 #include <vector>
 #include <string>
 
+#include <QCloseEvent>
+
+#undef KeyPress
+
+#include <algorithm>
+#include <string>
+#include <vector>
+
 using std::vector;
 using std::string;
 
 
-template<typename String> static QStringList to_qstring_list(vector<String> const & v)
+template<typename String>
+static QStringList to_qstring_list(vector<String> const & v)
 {
        QStringList qlist;
 
@@ -42,7 +52,7 @@ template<typename String> static QStringList to_qstring_list(vector<String> cons
 }
 
 
-static vector<lyx::docstring> const to_docstring_vector(QStringList const & qlist)
+static vector<lyx::docstring> to_docstring_vector(QStringList const & qlist)
 {
        vector<lyx::docstring> v;
        for (int i = 0; i != qlist.size(); ++i) {
@@ -57,6 +67,400 @@ static vector<lyx::docstring> const to_docstring_vector(QStringList const & qlis
 namespace lyx {
 namespace frontend {
 
+///////////////////////////////////////////////////////////////////////
+//
+// GuiCitationDialog
+//
+///////////////////////////////////////////////////////////////////////
+
+
+GuiCitationDialog::GuiCitationDialog(Dialog & dialog, GuiCitation * form)
+       : Dialog::View(dialog, _("Citation")), form_(form)
+{
+       setupUi(this);
+
+       setWindowTitle(toqstr("LyX: " + getTitle()));
+
+       connect(citationStyleCO, SIGNAL(activated(int)),
+               this, SLOT(changed()));
+       connect(fulllistCB, SIGNAL(clicked()),
+               this, SLOT(changed()));
+       connect(forceuppercaseCB, SIGNAL(clicked()),
+               this, SLOT(changed()));
+       connect(textBeforeED, SIGNAL(textChanged(const QString&)),
+               this, SLOT(changed()));
+       connect(textAfterED, SIGNAL(textChanged(const QString&)),
+               this, SLOT(changed()));
+       connect(clearPB, SIGNAL(clicked()),
+               findLE, SLOT(clear()));
+       connect(this, SIGNAL(rejected()), this, SLOT(cleanUp()));
+
+       selectionManager = 
+               new GuiSelectionManager(availableLV, selectedLV, 
+                                     addPB, deletePB, upPB, downPB, 
+                                     form_->available(), form_->selected());
+       connect(selectionManager, SIGNAL(selectionChanged()),
+               this, SLOT(setCitedKeys()));
+       connect(selectionManager, SIGNAL(updateHook()),
+               this, SLOT(updateDialog()));
+       connect(selectionManager, SIGNAL(okHook()),
+                                       this, SLOT(on_okPB_clicked()));
+
+}
+
+
+GuiCitationDialog::~GuiCitationDialog()
+{}
+
+
+void GuiCitationDialog::cleanUp() 
+{
+       form_->clearSelection();
+       form_->clearParams();
+       close();
+}
+
+
+void GuiCitationDialog::closeEvent(QCloseEvent * e)
+{
+       form_->clearSelection();
+       form_->clearParams();
+       e->accept();
+}
+
+
+void GuiCitationDialog::apply()
+{
+       int  const choice = std::max(0, citationStyleCO->currentIndex());
+       style_ = choice;
+       bool const full  = fulllistCB->isChecked();
+       bool const force = forceuppercaseCB->isChecked();
+
+       QString const before = textBeforeED->text();
+       QString const after = textAfterED->text();
+
+       form_->apply(choice, full, force, before, after);
+}
+
+
+void GuiCitationDialog::hide()
+{
+       form_->clearParams();
+       accept();
+}
+
+
+void GuiCitationDialog::show()
+{
+       findLE->clear();
+       availableLV->setFocus();
+       QDialog::show();
+       raise();
+       activateWindow();
+}
+
+
+bool GuiCitationDialog::isVisible() const
+{
+       return QDialog::isVisible();
+}
+
+
+void GuiCitationDialog::on_okPB_clicked()
+{
+       apply();
+       form_->clearSelection();
+       hide();
+}
+
+
+void GuiCitationDialog::on_cancelPB_clicked()
+{
+       form_->clearSelection();
+       hide();
+}
+
+
+void GuiCitationDialog::on_applyPB_clicked()
+{
+       apply();
+}
+
+
+void GuiCitationDialog::on_restorePB_clicked()
+{
+       form_->init();
+       update();
+}
+
+
+void GuiCitationDialog::update()
+{
+       fillFields();
+       fillEntries();
+       updateDialog();
+}
+
+
+//The main point of separating this out is that the fill*() methods
+//called in update() do not need to be called for INTERNAL updates,
+//such as when addPB is pressed, as the list of fields, entries, etc,
+//will not have changed. At the moment, however, the division between
+//fillStyles() and updateStyles() doesn't lend itself to dividing the
+//two methods, though they should be divisible.
+void GuiCitationDialog::updateDialog()
+{
+       if (selectionManager->selectedFocused()) { 
+               if (selectedLV->selectionModel()->selectedIndexes().isEmpty())
+                       updateInfo(availableLV->currentIndex());
+               else
+                       updateInfo(selectedLV->currentIndex());
+       } else {
+               if (availableLV->selectionModel()->selectedIndexes().isEmpty())
+                       updateInfo(QModelIndex());
+               else
+                       updateInfo(availableLV->currentIndex());
+       }
+       setButtons();
+
+       textBeforeED->setText(form_->textBefore());
+       textAfterED->setText(form_->textAfter());
+       fillStyles();
+       updateStyle();
+}
+
+
+void GuiCitationDialog::updateStyle()
+{
+       biblio::CiteEngine const engine = form_->getEngine();
+       bool const natbib_engine =
+               engine == biblio::ENGINE_NATBIB_AUTHORYEAR ||
+               engine == biblio::ENGINE_NATBIB_NUMERICAL;
+       bool const basic_engine = engine == biblio::ENGINE_BASIC;
+
+       bool const haveSelection = 
+               selectedLV->model()->rowCount() > 0;
+       fulllistCB->setEnabled(natbib_engine && haveSelection);
+       forceuppercaseCB->setEnabled(natbib_engine && haveSelection);
+       textBeforeED->setEnabled(!basic_engine && haveSelection);
+       textBeforeLA->setEnabled(!basic_engine && haveSelection);
+       textAfterED->setEnabled(haveSelection);
+       textAfterLA->setEnabled(haveSelection);
+       citationStyleCO->setEnabled(!basic_engine && haveSelection);
+       citationStyleLA->setEnabled(!basic_engine && haveSelection);
+
+       string const & command = form_->params().getCmdName();
+
+       // Find the style of the citekeys
+       vector<biblio::CiteStyle> const & styles =
+               ControlCitation::getCiteStyles();
+       biblio::CitationStyle const cs(command);
+
+       vector<biblio::CiteStyle>::const_iterator cit =
+               std::find(styles.begin(), styles.end(), cs.style);
+
+       // restore the latest natbib style
+       if (style_ >= 0 && style_ < citationStyleCO->count())
+               citationStyleCO->setCurrentIndex(style_);
+       else
+               citationStyleCO->setCurrentIndex(0);
+
+       if (cit != styles.end()) {
+               int const i = int(cit - styles.begin());
+               citationStyleCO->setCurrentIndex(i);
+               fulllistCB->setChecked(cs.full);
+               forceuppercaseCB->setChecked(cs.forceUCase);
+       } else {
+               fulllistCB->setChecked(false);
+               forceuppercaseCB->setChecked(false);
+       }
+}
+
+
+//This one needs to be called whenever citationStyleCO needs
+//to be updated---and this would be on anything that changes the
+//selection in selectedLV, or on a general update.
+void GuiCitationDialog::fillStyles()
+{
+       int const oldIndex = citationStyleCO->currentIndex();
+
+       citationStyleCO->clear();
+
+       QStringList selected_keys = form_->selected()->stringList();
+       if (selected_keys.empty()) {
+               citationStyleCO->setEnabled(false);
+               citationStyleLA->setEnabled(false);
+               return;
+       }
+
+       int curr = selectedLV->model()->rowCount() - 1;
+       if (curr < 0)
+               return;
+
+       if (!selectedLV->selectionModel()->selectedIndexes().empty())
+               curr = selectedLV->selectionModel()->selectedIndexes()[0].row();
+
+       QStringList sty = form_->citationStyles(curr);
+
+       bool const basic_engine =
+                       (form_->getEngine() == biblio::ENGINE_BASIC);
+
+       citationStyleCO->setEnabled(!sty.isEmpty() && !basic_engine);
+       citationStyleLA->setEnabled(!sty.isEmpty() && !basic_engine);
+
+       if (sty.isEmpty() || basic_engine)
+               return;
+
+       citationStyleCO->insertItems(0, sty);
+
+       if (oldIndex != -1 && oldIndex < citationStyleCO->count())
+               citationStyleCO->setCurrentIndex(oldIndex);
+}
+
+
+void GuiCitationDialog::fillFields()
+{
+       fieldsCO->blockSignals(true);
+       int const oldIndex = fieldsCO->currentIndex();
+       fieldsCO->clear();
+       QStringList const & fields = form_->getFieldsAsQStringList();
+       fieldsCO->insertItem(0, qt_("All Fields"));
+       fieldsCO->insertItem(1, qt_("Keys"));
+       fieldsCO->insertItems(2, fields);
+       if (oldIndex != -1 && oldIndex < fieldsCO->count())
+               fieldsCO->setCurrentIndex(oldIndex);
+       fieldsCO->blockSignals(false);
+}
+
+
+void GuiCitationDialog::fillEntries()
+{
+       entriesCO->blockSignals(true);
+       int const oldIndex = entriesCO->currentIndex();
+       entriesCO->clear();
+       QStringList const & entries = form_->getEntriesAsQStringList();
+       entriesCO->insertItem(0, qt_("All Entry Types"));
+       entriesCO->insertItems(1, entries);
+       if (oldIndex != -1 && oldIndex < entriesCO->count())
+               entriesCO->setCurrentIndex(oldIndex);
+       entriesCO->blockSignals(false);
+}
+
+
+bool GuiCitationDialog::isSelected(const QModelIndex & idx)
+{
+       QString const str = idx.data().toString();
+       return form_->selected()->stringList().contains(str);
+}
+
+
+void GuiCitationDialog::setButtons()
+{
+       selectionManager->update();
+       int const srows = selectedLV->model()->rowCount();
+       applyPB->setEnabled(srows > 0);
+       okPB->setEnabled(srows > 0);
+}
+
+
+void GuiCitationDialog::updateInfo(QModelIndex const & idx)
+{
+       if (idx.isValid()) {
+               QString const keytxt = form_->getKeyInfo(idx.data().toString());
+               infoML->document()->setPlainText(keytxt);
+       } else
+               infoML->document()->clear();
+}
+
+
+void GuiCitationDialog::setCitedKeys() 
+{
+       form_->setCitedKeys();
+}
+
+
+void GuiCitationDialog::findText(QString const & text, bool reset)
+{
+       //"All Fields" and "Keys" are the first two
+       int index = fieldsCO->currentIndex() - 2; 
+       vector<docstring> const & fields = form_->availableFields();
+       docstring field;
+       
+       if (index <= -1 || index >= int(fields.size()))
+               //either "All Fields" or "Keys" or an invalid value
+               field = from_ascii("");
+       else
+               field = fields[index];
+       
+       //Was it "Keys"?
+       bool const onlyKeys = index == -1;
+       
+       //"All Entry Types" is first.
+       index = entriesCO->currentIndex() - 1; 
+       vector<docstring> const & entries = form_->availableEntries();
+       docstring entryType;
+       if (index < 0 || index >= int(entries.size()))
+               entryType = from_ascii("");
+       else 
+               entryType = entries[index];
+       
+       bool const case_sentitive = caseCB->checkState();
+       bool const reg_exp = regexCB->checkState();
+       form_->findKey(text, onlyKeys, field, entryType, 
+                      case_sentitive, reg_exp, reset);
+       //FIXME
+       //It'd be nice to save and restore the current selection in 
+       //availableLV. Currently, we get an automatic reset, since the
+       //model is reset.
+       
+       updateDialog();
+}
+
+
+void GuiCitationDialog::on_fieldsCO_currentIndexChanged(int /*index*/)
+{
+       findText(findLE->text(), true);
+}
+
+
+void GuiCitationDialog::on_entriesCO_currentIndexChanged(int /*index*/)
+{
+       findText(findLE->text(), true);
+}
+
+
+void GuiCitationDialog::on_findLE_textChanged(const QString & text)
+{
+       clearPB->setDisabled(text.isEmpty());
+       if (text.isEmpty())
+               findLE->setFocus();
+       findText(text);
+}
+
+
+void GuiCitationDialog::on_caseCB_stateChanged(int)
+{
+       findText(findLE->text());
+}
+
+
+void GuiCitationDialog::on_regexCB_stateChanged(int)
+{
+       findText(findLE->text());
+}
+
+
+void GuiCitationDialog::changed()
+{
+       fillStyles();
+       setButtons();
+}
+
+///////////////////////////////////////////////////////////////////////
+//
+// GuiCitation
+//
+///////////////////////////////////////////////////////////////////////
 
 GuiCitation::GuiCitation(Dialog & parent)
        : ControlCitation(parent)
@@ -166,8 +570,8 @@ void GuiCitation::findKey(QString const & str, bool only_keys,
 
        QStringList result;
        
-       //First, filter by entryType, which will be faster than 
-       //what follows, so we may get to do that on less.
+       // First, filter by entryType, which will be faster than 
+       // what follows, so we may get to do that on less.
        vector<docstring> keyVector = to_docstring_vector(keys);
        filterByEntryType(keyVector, entryType);
        
@@ -181,12 +585,14 @@ void GuiCitation::findKey(QString const & str, bool only_keys,
 }
 
 
-QStringList GuiCitation::getFieldsAsQStringList() {
+QStringList GuiCitation::getFieldsAsQStringList()
+{
        return to_qstring_list(availableFields());
 }
 
 
-QStringList GuiCitation::getEntriesAsQStringList() {
+QStringList GuiCitation::getEntriesAsQStringList()
+{
        return to_qstring_list(availableEntries());
 }
 
@@ -208,6 +614,8 @@ void GuiCitation::setCitedKeys()
        cited_keys_ = selected_model_.stringList();
 }
 
-
 } // namespace frontend
 } // namespace lyx
+
+#include "GuiCitation_moc.cpp"
+
index 7059106ef87427e32b391f8aab4a366b08ffa420..573525cc31c444a6b2e91f31ec0ed4386ee4cbda 100644 (file)
 #ifndef GUICITATION_H
 #define GUICITATION_H
 
+#include "Dialog.h"
+#include "GuiSelectionManager.h"
+#include "ui_CitationUi.h"
 #include "ControlCitation.h"
 #include "support/docstring.h"
 
+#include <QKeyEvent>
 #include <QStringList>
 #include <QStringListModel>
 
 namespace lyx {
 namespace frontend {
 
+class GuiCitation;
+
+class GuiCitationDialog : public QDialog,
+       public Ui::CitationUi, public Dialog::View
+{
+       Q_OBJECT
+
+public:
+       GuiCitationDialog(Dialog &, GuiCitation * form );
+
+       virtual ~GuiCitationDialog();
+
+       virtual void apply();
+
+       /// Hide the dialog from sight
+       void hide();
+
+       /// Redraw the dialog (e.g. if the colors have been remapped).
+       void redraw() {}
+
+       /// Create the dialog if necessary, update it and display it.
+       void show();
+
+       /// \return true if the dialog is visible.
+       bool isVisible() const;
+
+public Q_SLOTS:
+       /// Update the display of the dialog whilst it is still visible.
+       void update();
+
+protected:
+       void closeEvent(QCloseEvent * e);
+       /// prepares a call to GuiCitation::searchKeys when we
+       /// are ready to search the BibTeX entries
+       void findText(QString const & text, bool reset = false);
+       /// check whether key is already selected
+       bool isSelected(const QModelIndex &);
+       /// update the display of BibTeX information
+       void updateInfo(QModelIndex const &);
+
+protected Q_SLOTS:
+       void cleanUp();
+       void on_okPB_clicked();
+       void on_cancelPB_clicked();
+       void on_restorePB_clicked();
+       void on_applyPB_clicked();
+       void on_findLE_textChanged(const QString & text);
+       void on_fieldsCO_currentIndexChanged(int index);
+       void on_entriesCO_currentIndexChanged(int index);
+       void on_caseCB_stateChanged(int);
+       void on_regexCB_stateChanged(int);
+       virtual void changed();
+       ///
+       void setCitedKeys();
+       /// performs a limited update, suitable for internal call
+       void updateDialog();
+       
+private:
+       /// enable/disable buttons
+       void setButtons();
+       /// fill the styles combo
+       void fillStyles();
+       /// fill the fields combo
+       void fillFields();
+       /// fill the entries combo
+       void fillEntries();
+       /// set the styles combo
+       void updateStyle();
+       /// last used citation style
+       int style_;
+       
+       GuiCitation * form_;
+
+       GuiSelectionManager * selectionManager;
+};
+
+
 class GuiCitation : public ControlCitation
 {
 public:
diff --git a/src/frontends/qt4/GuiCitationDialog.cpp b/src/frontends/qt4/GuiCitationDialog.cpp
deleted file mode 100644 (file)
index 4d2b50e..0000000
+++ /dev/null
@@ -1,432 +0,0 @@
-/**
- * \file GuiCitationDialog.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Kalle Dalheimer
- * \author John Levon
- * \author Jürgen Spitzmüller
- * \author Abdelrazak Younes
- * \author Richard Heck
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "GuiCitationDialog.h"
-
-#include "GuiCitation.h"
-
-#include "frontends/controllers/frontend_helpers.h"
-#include "frontends/controllers/ControlCitation.h"
-#include "qt_helpers.h"
-
-#include "support/docstring.h"
-
-#include "debug.h"
-#include "gettext.h"
-
-#include <algorithm>
-#include <vector>
-#include <string>
-
-#include <QCloseEvent>
-#include <QKeyEvent>
-
-#undef KeyPress
-
-using std::vector;
-using std::string;
-
-namespace lyx {
-namespace frontend {
-
-
-GuiCitationDialog::GuiCitationDialog(Dialog & dialog, GuiCitation * form)
-       : Dialog::View(dialog, _("Citation")), form_(form)
-{
-       setupUi(this);
-
-       setWindowTitle(toqstr("LyX: " + getTitle()));
-
-       connect(citationStyleCO, SIGNAL(activated(int)),
-               this, SLOT(changed()));
-       connect(fulllistCB, SIGNAL(clicked()),
-               this, SLOT(changed()));
-       connect(forceuppercaseCB, SIGNAL(clicked()),
-               this, SLOT(changed()));
-       connect(textBeforeED, SIGNAL(textChanged(const QString&)),
-               this, SLOT(changed()));
-       connect(textAfterED, SIGNAL(textChanged(const QString&)),
-               this, SLOT(changed()));
-       connect(clearPB, SIGNAL(clicked()),
-               findLE, SLOT(clear()));
-       connect(this, SIGNAL(rejected()), this, SLOT(cleanUp()));
-
-       selectionManager = 
-               new GuiSelectionManager(availableLV, selectedLV, 
-                                     addPB, deletePB, upPB, downPB, 
-                                     form_->available(), form_->selected());
-       connect(selectionManager, SIGNAL(selectionChanged()),
-               this, SLOT(setCitedKeys()));
-       connect(selectionManager, SIGNAL(updateHook()),
-               this, SLOT(updateDialog()));
-       connect(selectionManager, SIGNAL(okHook()),
-                                       this, SLOT(on_okPB_clicked()));
-
-}
-
-
-GuiCitationDialog::~GuiCitationDialog()
-{}
-
-
-void GuiCitationDialog::cleanUp() 
-{
-       form_->clearSelection();
-       form_->clearParams();
-       close();
-}
-
-
-void GuiCitationDialog::closeEvent(QCloseEvent * e)
-{
-       form_->clearSelection();
-       form_->clearParams();
-       e->accept();
-}
-
-
-void GuiCitationDialog::apply()
-{
-       int  const choice = std::max(0, citationStyleCO->currentIndex());
-       style_ = choice;
-       bool const full  = fulllistCB->isChecked();
-       bool const force = forceuppercaseCB->isChecked();
-
-       QString const before = textBeforeED->text();
-       QString const after = textAfterED->text();
-
-       form_->apply(choice, full, force, before, after);
-}
-
-
-void GuiCitationDialog::hide()
-{
-       form_->clearParams();
-       accept();
-}
-
-
-void GuiCitationDialog::show()
-{
-       findLE->clear();
-       availableLV->setFocus();
-       QDialog::show();
-       raise();
-       activateWindow();
-}
-
-
-bool GuiCitationDialog::isVisible() const
-{
-       return QDialog::isVisible();
-}
-
-
-void GuiCitationDialog::on_okPB_clicked()
-{
-       apply();
-       form_->clearSelection();
-       hide();
-}
-
-
-void GuiCitationDialog::on_cancelPB_clicked()
-{
-       form_->clearSelection();
-       hide();
-}
-
-
-void GuiCitationDialog::on_applyPB_clicked()
-{
-       apply();
-}
-
-
-void GuiCitationDialog::on_restorePB_clicked()
-{
-       form_->init();
-       update();
-}
-
-
-void GuiCitationDialog::update()
-{
-       fillFields();
-       fillEntries();
-       updateDialog();
-}
-
-
-//The main point of separating this out is that the fill*() methods
-//called in update() do not need to be called for INTERNAL updates,
-//such as when addPB is pressed, as the list of fields, entries, etc,
-//will not have changed. At the moment, however, the division between
-//fillStyles() and updateStyles() doesn't lend itself to dividing the
-//two methods, though they should be divisible.
-void GuiCitationDialog::updateDialog()
-{
-       if (selectionManager->selectedFocused()) { 
-               if (selectedLV->selectionModel()->selectedIndexes().isEmpty())
-                       updateInfo(availableLV->currentIndex());
-               else
-                       updateInfo(selectedLV->currentIndex());
-       } else {
-               if (availableLV->selectionModel()->selectedIndexes().isEmpty())
-                       updateInfo(QModelIndex());
-               else
-                       updateInfo(availableLV->currentIndex());
-       }
-       setButtons();
-
-       textBeforeED->setText(form_->textBefore());
-       textAfterED->setText(form_->textAfter());
-       fillStyles();
-       updateStyle();
-}
-
-
-void GuiCitationDialog::updateStyle()
-{
-       biblio::CiteEngine const engine = form_->getEngine();
-       bool const natbib_engine =
-               engine == biblio::ENGINE_NATBIB_AUTHORYEAR ||
-               engine == biblio::ENGINE_NATBIB_NUMERICAL;
-       bool const basic_engine = engine == biblio::ENGINE_BASIC;
-
-       bool const haveSelection = 
-               selectedLV->model()->rowCount() > 0;
-       fulllistCB->setEnabled(natbib_engine && haveSelection);
-       forceuppercaseCB->setEnabled(natbib_engine && haveSelection);
-       textBeforeED->setEnabled(!basic_engine && haveSelection);
-       textBeforeLA->setEnabled(!basic_engine && haveSelection);
-       textAfterED->setEnabled(haveSelection);
-       textAfterLA->setEnabled(haveSelection);
-       citationStyleCO->setEnabled(!basic_engine && haveSelection);
-       citationStyleLA->setEnabled(!basic_engine && haveSelection);
-
-       string const & command = form_->params().getCmdName();
-
-       // Find the style of the citekeys
-       vector<biblio::CiteStyle> const & styles =
-               ControlCitation::getCiteStyles();
-       biblio::CitationStyle const cs(command);
-
-       vector<biblio::CiteStyle>::const_iterator cit =
-               std::find(styles.begin(), styles.end(), cs.style);
-
-       // restore the latest natbib style
-       if (style_ >= 0 && style_ < citationStyleCO->count())
-               citationStyleCO->setCurrentIndex(style_);
-       else
-               citationStyleCO->setCurrentIndex(0);
-
-       if (cit != styles.end()) {
-               int const i = int(cit - styles.begin());
-               citationStyleCO->setCurrentIndex(i);
-               fulllistCB->setChecked(cs.full);
-               forceuppercaseCB->setChecked(cs.forceUCase);
-       } else {
-               fulllistCB->setChecked(false);
-               forceuppercaseCB->setChecked(false);
-       }
-}
-
-
-//This one needs to be called whenever citationStyleCO needs
-//to be updated---and this would be on anything that changes the
-//selection in selectedLV, or on a general update.
-void GuiCitationDialog::fillStyles()
-{
-       int const oldIndex = citationStyleCO->currentIndex();
-
-       citationStyleCO->clear();
-
-       QStringList selected_keys = form_->selected()->stringList();
-       if (selected_keys.empty()) {
-               citationStyleCO->setEnabled(false);
-               citationStyleLA->setEnabled(false);
-               return;
-       }
-
-       int curr = selectedLV->model()->rowCount() - 1;
-       if (curr < 0)
-               return;
-
-       if (!selectedLV->selectionModel()->selectedIndexes().empty())
-               curr = selectedLV->selectionModel()->selectedIndexes()[0].row();
-
-       QStringList sty = form_->citationStyles(curr);
-
-       bool const basic_engine =
-                       (form_->getEngine() == biblio::ENGINE_BASIC);
-
-       citationStyleCO->setEnabled(!sty.isEmpty() && !basic_engine);
-       citationStyleLA->setEnabled(!sty.isEmpty() && !basic_engine);
-
-       if (sty.isEmpty() || basic_engine)
-               return;
-
-       citationStyleCO->insertItems(0, sty);
-
-       if (oldIndex != -1 && oldIndex < citationStyleCO->count())
-               citationStyleCO->setCurrentIndex(oldIndex);
-}
-
-
-void GuiCitationDialog::fillFields()
-{
-       fieldsCO->blockSignals(true);
-       int const oldIndex = fieldsCO->currentIndex();
-       fieldsCO->clear();
-       QStringList const & fields = form_->getFieldsAsQStringList();
-       fieldsCO->insertItem(0, qt_("All Fields"));
-       fieldsCO->insertItem(1, qt_("Keys"));
-       fieldsCO->insertItems(2, fields);
-       if (oldIndex != -1 && oldIndex < fieldsCO->count())
-               fieldsCO->setCurrentIndex(oldIndex);
-       fieldsCO->blockSignals(false);
-}
-
-
-void GuiCitationDialog::fillEntries()
-{
-       entriesCO->blockSignals(true);
-       int const oldIndex = entriesCO->currentIndex();
-       entriesCO->clear();
-       QStringList const & entries = form_->getEntriesAsQStringList();
-       entriesCO->insertItem(0, qt_("All Entry Types"));
-       entriesCO->insertItems(1, entries);
-       if (oldIndex != -1 && oldIndex < entriesCO->count())
-               entriesCO->setCurrentIndex(oldIndex);
-       entriesCO->blockSignals(false);
-}
-
-
-bool GuiCitationDialog::isSelected(const QModelIndex & idx)
-{
-       QString const str = idx.data().toString();
-       return form_->selected()->stringList().contains(str);
-}
-
-
-void GuiCitationDialog::setButtons()
-{
-       selectionManager->update();
-       int const srows = selectedLV->model()->rowCount();
-       applyPB->setEnabled(srows > 0);
-       okPB->setEnabled(srows > 0);
-}
-
-
-void GuiCitationDialog::updateInfo(QModelIndex const & idx)
-{
-       if (idx.isValid()) {
-               QString const keytxt = form_->getKeyInfo(idx.data().toString());
-               infoML->document()->setPlainText(keytxt);
-       } else
-               infoML->document()->clear();
-}
-
-
-void GuiCitationDialog::setCitedKeys() 
-{
-       form_->setCitedKeys();
-}
-
-
-void GuiCitationDialog::findText(QString const & text, bool reset)
-{
-       //"All Fields" and "Keys" are the first two
-       int index = fieldsCO->currentIndex() - 2; 
-       vector<docstring> const & fields = form_->availableFields();
-       docstring field;
-       
-       if (index <= -1 || index >= int(fields.size()))
-               //either "All Fields" or "Keys" or an invalid value
-               field = from_ascii("");
-       else
-               field = fields[index];
-       
-       //Was it "Keys"?
-       bool const onlyKeys = index == -1;
-       
-       //"All Entry Types" is first.
-       index = entriesCO->currentIndex() - 1; 
-       vector<docstring> const & entries = form_->availableEntries();
-       docstring entryType;
-       if (index < 0 || index >= int(entries.size()))
-               entryType = from_ascii("");
-       else 
-               entryType = entries[index];
-       
-       bool const case_sentitive = caseCB->checkState();
-       bool const reg_exp = regexCB->checkState();
-       form_->findKey(text, onlyKeys, field, entryType, 
-                      case_sentitive, reg_exp, reset);
-       //FIXME
-       //It'd be nice to save and restore the current selection in 
-       //availableLV. Currently, we get an automatic reset, since the
-       //model is reset.
-       
-       updateDialog();
-}
-
-
-void GuiCitationDialog::on_fieldsCO_currentIndexChanged(int /*index*/)
-{
-       findText(findLE->text(), true);
-}
-
-
-void GuiCitationDialog::on_entriesCO_currentIndexChanged(int /*index*/)
-{
-       findText(findLE->text(), true);
-}
-
-
-void GuiCitationDialog::on_findLE_textChanged(const QString & text)
-{
-       clearPB->setDisabled(text.isEmpty());
-       if (text.isEmpty())
-               findLE->setFocus();
-       findText(text);
-}
-
-
-void GuiCitationDialog::on_caseCB_stateChanged(int)
-{
-       findText(findLE->text());
-}
-
-
-void GuiCitationDialog::on_regexCB_stateChanged(int)
-{
-       findText(findLE->text());
-}
-
-
-void GuiCitationDialog::changed()
-{
-       fillStyles();
-       setButtons();
-}
-
-
-} // namespace frontend
-} // namespace lyx
-
-#include "GuiCitationDialog_moc.cpp"
diff --git a/src/frontends/qt4/GuiCitationDialog.h b/src/frontends/qt4/GuiCitationDialog.h
deleted file mode 100644 (file)
index d4e5050..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-// -*- C++ -*-
-/**
- * \file GuiCitationDialog.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Kalle Dalheimer
- * \author Abdelrazak Younes
- * \author Richard Heck
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#ifndef GUICITATIONDIALOG_H
-#define GUICITATIONDIALOG_H
-
-#include "Dialog.h"
-#include "GuiSelectionManager.h"
-#include "ui_CitationUi.h"
-
-#include <QCloseEvent>
-#include <QKeyEvent>
-#include <QStringList>
-#include <QStringListModel>
-
-namespace lyx {
-namespace frontend {
-
-class GuiCitation;
-
-class GuiCitationDialog : public QDialog,
-       public Ui::CitationUi, public Dialog::View
-{
-       Q_OBJECT
-
-public:
-       GuiCitationDialog(Dialog &, GuiCitation * form );
-
-       virtual ~GuiCitationDialog();
-
-       virtual void apply();
-
-       /// Hide the dialog from sight
-       void hide();
-
-       /// Redraw the dialog (e.g. if the colors have been remapped).
-       void redraw() {}
-
-       /// Create the dialog if necessary, update it and display it.
-       void show();
-
-       /// \return true if the dialog is visible.
-       bool isVisible() const;
-
-public Q_SLOTS:
-       /// Update the display of the dialog whilst it is still visible.
-       void update();
-
-protected:
-       void closeEvent (QCloseEvent * e);
-       /// prepares a call to GuiCitation::searchKeys when we
-       /// are ready to search the BibTeX entries
-       void findText(QString const & text, bool reset = false);
-       /// check whether key is already selected
-       bool isSelected(const QModelIndex &);
-       /// update the display of BibTeX information
-       void updateInfo(QModelIndex const &);
-
-protected Q_SLOTS:
-       void cleanUp();
-       void on_okPB_clicked();
-       void on_cancelPB_clicked();
-       void on_restorePB_clicked();
-       void on_applyPB_clicked();
-       void on_findLE_textChanged(const QString & text);
-       void on_fieldsCO_currentIndexChanged(int index);
-       void on_entriesCO_currentIndexChanged(int index);
-       void on_caseCB_stateChanged(int);
-       void on_regexCB_stateChanged(int);
-       virtual void changed();
-       ///
-       void setCitedKeys();
-       /// performs a limited update, suitable for internal call
-       void updateDialog();
-       
-private:
-       /// enable/disable buttons
-       void setButtons();
-       /// fill the styles combo
-       void fillStyles();
-       /// fill the fields combo
-       void fillFields();
-       /// fill the entries combo
-       void fillEntries();
-       /// set the styles combo
-       void updateStyle();
-       /// last used citation style
-       int style_;
-       
-       GuiCitation * form_;
-
-       GuiSelectionManager * selectionManager;
-};
-
-} // namespace frontend
-} // namespace lyx
-
-#endif // GUICITATIOINDIALOG_H
diff --git a/src/frontends/qt4/GuiDelimiter.cpp b/src/frontends/qt4/GuiDelimiter.cpp
new file mode 100644 (file)
index 0000000..40eb280
--- /dev/null
@@ -0,0 +1,249 @@
+/**
+ * \file GuiDelimiter.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author John Levon
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "GuiDelimiter.h"
+
+#include "GuiApplication.h"
+#include "GuiView.h"
+
+#include "qt_helpers.h"
+#include "gettext.h"
+
+#include <QPixmap>
+#include <QCheckBox>
+#include <QListWidgetItem>
+
+// Set to zero if unicode symbols are preferred.
+#define USE_PIXMAP 1
+
+using std::string;
+
+namespace lyx {
+namespace frontend {
+
+namespace {
+
+QString const bigleft[]  = {"", "bigl", "Bigl", "biggl", "Biggl"};
+
+
+QString const bigright[] = {"", "bigr", "Bigr", "biggr", "Biggr"};
+
+
+char const * const biggui[]   = {N_("big[[delimiter size]]"), N_("Big[[delimiter size]]"),
+       N_("bigg[[delimiter size]]"), N_("Bigg[[delimiter size]]"), ""};
+
+
+// FIXME: It might be better to fix the big delim LFUN to not require
+// additional '\' prefix.
+QString fix_name(QString const & str, bool big)
+{
+       if (str.isEmpty())
+               return ".";
+       if (!big || str == "(" || str == ")" || str == "[" || str == "]"
+           || str == "|" || str == "/")
+               return str;
+
+       return "\\" + str;
+}
+
+} // namespace anon
+
+
+GuiDelimiter::GuiDelimiter(Dialog & parent)
+       : GuiView<GuiDelimiterDialog>(parent, _("Math Delimiter"))
+{}
+
+
+void GuiDelimiter::build_dialog()
+{
+       dialog_.reset(new GuiDelimiterDialog(this,
+               static_cast<GuiViewBase *>(controller().view())));
+}
+
+
+char_type GuiDelimiterDialog::doMatch(char_type const symbol) const
+{
+       string const & str = form_->controller().texName(symbol);
+       string match;
+       if (str == "(") match = ")";
+       else if (str == ")") match = "(";
+       else if (str == "[") match = "]";
+       else if (str == "]") match = "[";
+       else if (str == "{") match = "}";
+       else if (str == "}") match = "{";
+       else if (str == "l") match = "r";
+       else if (str == "rceil") match = "lceil";
+       else if (str == "lceil") match = "rceil";
+       else if (str == "rfloor") match = "lfloor";
+       else if (str == "lfloor") match = "rfloor";
+       else if (str == "rangle") match = "langle";
+       else if (str == "langle") match = "rangle";
+       else if (str == "backslash") match = "/";
+       else if (str == "/") match = "backslash";
+       else return symbol;
+
+       return form_->controller().mathSymbol(match).unicode;
+}
+
+
+GuiDelimiterDialog::GuiDelimiterDialog(GuiDelimiter * form, QWidget * parent)
+       : QDialog(parent), form_(form)
+{
+       setupUi(this);
+
+       connect(closePB, SIGNAL(clicked()), this, SLOT(accept()));
+
+       setWindowTitle(qt_("LyX: Delimiters"));
+       setFocusProxy(leftLW);
+
+       leftLW->setViewMode(QListView::IconMode);
+       rightLW->setViewMode(QListView::IconMode);
+
+       typedef std::map<char_type, QListWidgetItem *> ListItems;
+       ListItems list_items;
+       // The last element is the empty one.
+       int const end = nr_latex_delimiters - 1;
+       for (int i = 0; i < end; ++i) {
+               string const delim = latex_delimiters[i];
+               MathSymbol const & ms = form_->controller().mathSymbol(delim);
+               QString symbol(ms.fontcode?
+                       QChar(ms.fontcode) : toqstr(docstring(1, ms.unicode)));
+               QListWidgetItem * lwi = new QListWidgetItem(symbol);
+               lwi->setToolTip(toqstr(delim));
+               Font lyxfont;
+               lyxfont.setFamily(ms.fontfamily);
+               QFont const & symbol_font = guiApp->guiFontLoader().get(lyxfont);
+               lwi->setFont(symbol_font);
+               list_items[ms.unicode] = lwi;
+               leftLW->addItem(lwi);
+       }
+
+       for (int i = 0; i != leftLW->count(); ++i) {
+               MathSymbol const & ms = form_->controller().mathSymbol(
+                       fromqstr(leftLW->item(i)->toolTip()));
+               rightLW->addItem(list_items[doMatch(ms.unicode)]->clone());
+       }
+
+       // The last element is the empty one.
+       leftLW->addItem(qt_("(None)"));
+       rightLW->addItem(qt_("(None)"));
+
+       sizeCO->addItem(qt_("Variable"));
+
+       for (int i = 0; *biggui[i]; ++i)
+               sizeCO->addItem(qt_(biggui[i]));
+
+       on_leftLW_currentRowChanged(0);
+}
+
+
+void GuiDelimiterDialog::updateTeXCode(int size)
+{
+       bool const bigsize = size != 0;
+
+       QString left_str = fix_name(leftLW->currentItem()->toolTip(), bigsize);
+       QString right_str = fix_name(rightLW->currentItem()->toolTip(), bigsize);
+
+       if (!bigsize)
+               tex_code_ = left_str + ' ' + right_str;
+       else {
+               tex_code_ = bigleft[size] + ' '
+                       + left_str + ' '
+                       + bigright[size] + ' '
+                       + right_str;
+       }
+
+       // Generate TeX-code for GUI display.
+       // FIXME: Instead of reconstructing the TeX code it would be nice to
+       // FIXME: retrieve the LateX code directly from mathed.
+       // In all cases, we want the '\' prefix if needed, so we pass 'true'
+       // to fix_name.
+       left_str = fix_name(leftLW->currentItem()->toolTip(), true);
+       right_str = fix_name(rightLW->currentItem()->toolTip(), true);
+       QString code_str;
+       if (!bigsize)
+               code_str = "\\left" + left_str + " \\right" + right_str;
+       else {
+               // There should be nothing in the TeX-code when the delimiter is "None".
+               if (left_str != ".")
+                       code_str = "\\" + bigleft[size] + left_str + ' ';
+               if (right_str != ".")
+                       code_str += "\\" + bigright[size] + right_str;
+       }
+
+       texCodeL->setText(qt_("TeX Code: ") + code_str);
+}
+
+
+void GuiDelimiterDialog::on_insertPB_clicked()
+{
+       if (sizeCO->currentIndex() == 0)
+               form_->controller().dispatchDelim(fromqstr(tex_code_));
+       else {
+               QString command = '"' + tex_code_ + '"';
+               command.replace(' ', "\" \"");
+               form_->controller().dispatchBigDelim(fromqstr(command));
+       }
+ }
+
+
+void GuiDelimiterDialog::on_sizeCO_activated(int index)
+{
+       updateTeXCode(index);
+}
+
+
+void GuiDelimiterDialog::on_leftLW_itemActivated(QListWidgetItem *)
+{
+       on_insertPB_clicked();
+       accept();
+}
+
+
+void GuiDelimiterDialog::on_rightLW_itemActivated(QListWidgetItem *)
+{
+       on_insertPB_clicked();
+       accept();
+}
+
+
+void GuiDelimiterDialog::on_leftLW_currentRowChanged(int item)
+{
+       if (matchCB->isChecked())
+               rightLW->setCurrentRow(item);
+
+       updateTeXCode(sizeCO->currentIndex());
+}
+
+
+void GuiDelimiterDialog::on_rightLW_currentRowChanged(int item)
+{
+       if (matchCB->isChecked())
+               leftLW->setCurrentRow(item);
+
+       updateTeXCode(sizeCO->currentIndex());
+}
+
+
+void GuiDelimiterDialog::on_matchCB_stateChanged(int state)
+{
+       if (state == Qt::Checked)
+               on_leftLW_currentRowChanged(leftLW->currentRow());
+
+       updateTeXCode(sizeCO->currentIndex());
+}
+
+
+} // namespace frontend
+} // namespace lyx
+
+#include "GuiDelimiter_moc.cpp"
diff --git a/src/frontends/qt4/GuiDelimiter.h b/src/frontends/qt4/GuiDelimiter.h
new file mode 100644 (file)
index 0000000..301eabc
--- /dev/null
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+/**
+ * \file GuiDelimiterDialog.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author John Levon
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef GUIDELIMITERDIALOG_H
+#define GUIDELIMITERDIALOG_H
+
+#include "GuiDialogView.h"
+#include "ControlMath.h"
+#include "ui_DelimiterUi.h"
+
+class QListWidgetItem;
+
+namespace lyx {
+namespace frontend {
+
+class ControlMath;
+class GuiDelimiter;
+
+class GuiDelimiterDialog : public QDialog, public Ui::DelimiterUi
+{
+       Q_OBJECT
+public:
+       GuiDelimiterDialog(GuiDelimiter * form, QWidget * parent);
+public Q_SLOTS:
+       void on_leftLW_itemActivated(QListWidgetItem *);
+       void on_rightLW_itemActivated(QListWidgetItem *);
+       void on_leftLW_currentRowChanged(int);
+       void on_rightLW_currentRowChanged(int);
+       void on_matchCB_stateChanged(int);
+       void on_insertPB_clicked();
+       void on_sizeCO_activated(int);
+private:
+       ///
+       char_type doMatch(char_type const symbol) const;
+       ///
+       void updateTeXCode(int size);
+       /// owning form
+       GuiDelimiter * form_;
+       /// TeX code that will be inserted.
+       QString tex_code_;
+};
+
+
+class GuiDelimiter : public GuiView<GuiDelimiterDialog>
+{
+public:
+       friend class GuiDelimiterDialog;
+       ///
+       GuiDelimiter(Dialog &);
+       /// parent controller
+       ControlMath & controller()
+       { return static_cast<ControlMath &>(this->getController()); }
+       /// parent controller
+       ControlMath const & controller() const
+       { return static_cast<ControlMath const &>(this->getController()); }
+private:
+       virtual void apply() {}
+       virtual void update_contents() {}
+       /// Build the dialog.
+       virtual void build_dialog();
+};
+
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // GUIDELIMITERDIALOG_H
diff --git a/src/frontends/qt4/GuiDelimiterDialog.cpp b/src/frontends/qt4/GuiDelimiterDialog.cpp
deleted file mode 100644 (file)
index a9690aa..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-/**
- * \file GuiDelimiterDialog.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author John Levon
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "GuiDelimiterDialog.h"
-
-#include "GuiApplication.h"
-#include "GuiView.h"
-
-#include "qt_helpers.h"
-#include "gettext.h"
-
-#include <QPixmap>
-#include <QCheckBox>
-#include <QListWidgetItem>
-
-#include <sstream>
-
-// Set to zero if unicode symbols are preferred.
-#define USE_PIXMAP 1
-
-using std::string;
-
-namespace lyx {
-namespace frontend {
-
-namespace {
-
-QString const bigleft[]  = {"", "bigl", "Bigl", "biggl", "Biggl"};
-
-
-QString const bigright[] = {"", "bigr", "Bigr", "biggr", "Biggr"};
-
-
-char const * const biggui[]   = {N_("big[[delimiter size]]"), N_("Big[[delimiter size]]"),
-       N_("bigg[[delimiter size]]"), N_("Bigg[[delimiter size]]"), ""};
-
-
-// FIXME: It might be better to fix the big delim LFUN to not require
-// additional '\' prefix.
-QString fix_name(QString const & str, bool big)
-{
-       if (str.isEmpty())
-               return ".";
-       if (!big || str == "(" || str == ")" || str == "[" || str == "]"
-           || str == "|" || str == "/")
-               return str;
-
-       return "\\" + str;
-}
-
-} // namespace anon
-
-
-GuiDelimiter::GuiDelimiter(Dialog & parent)
-       : GuiView<GuiDelimiterDialog>(parent, _("Math Delimiter"))
-{}
-
-
-void GuiDelimiter::build_dialog()
-{
-       dialog_.reset(new GuiDelimiterDialog(this,
-               static_cast<GuiViewBase *>(controller().view())));
-}
-
-
-char_type GuiDelimiterDialog::doMatch(char_type const symbol) const
-{
-       string const & str = form_->controller().texName(symbol);
-       string match;
-       if (str == "(") match = ")";
-       else if (str == ")") match = "(";
-       else if (str == "[") match = "]";
-       else if (str == "]") match = "[";
-       else if (str == "{") match = "}";
-       else if (str == "}") match = "{";
-       else if (str == "l") match = "r";
-       else if (str == "rceil") match = "lceil";
-       else if (str == "lceil") match = "rceil";
-       else if (str == "rfloor") match = "lfloor";
-       else if (str == "lfloor") match = "rfloor";
-       else if (str == "rangle") match = "langle";
-       else if (str == "langle") match = "rangle";
-       else if (str == "backslash") match = "/";
-       else if (str == "/") match = "backslash";
-       else return symbol;
-
-       return form_->controller().mathSymbol(match).unicode;
-}
-
-
-GuiDelimiterDialog::GuiDelimiterDialog(GuiDelimiter * form, QWidget * parent)
-       : QDialog(parent), form_(form)
-{
-       setupUi(this);
-
-       connect(closePB, SIGNAL(clicked()), this, SLOT(accept()));
-
-       setWindowTitle(qt_("LyX: Delimiters"));
-       setFocusProxy(leftLW);
-
-       leftLW->setViewMode(QListView::IconMode);
-       rightLW->setViewMode(QListView::IconMode);
-
-       typedef std::map<char_type, QListWidgetItem *> ListItems;
-       ListItems list_items;
-       // The last element is the empty one.
-       int const end = nr_latex_delimiters - 1;
-       for (int i = 0; i < end; ++i) {
-               string const delim = latex_delimiters[i];
-               MathSymbol const & ms = form_->controller().mathSymbol(delim);
-               QString symbol(ms.fontcode?
-                       QChar(ms.fontcode) : toqstr(docstring(1, ms.unicode)));
-               QListWidgetItem * lwi = new QListWidgetItem(symbol);
-               lwi->setToolTip(toqstr(delim));
-               Font lyxfont;
-               lyxfont.setFamily(ms.fontfamily);
-               QFont const & symbol_font = guiApp->guiFontLoader().get(lyxfont);
-               lwi->setFont(symbol_font);
-               list_items[ms.unicode] = lwi;
-               leftLW->addItem(lwi);
-       }
-
-       for (int i = 0; i != leftLW->count(); ++i) {
-               MathSymbol const & ms = form_->controller().mathSymbol(
-                       fromqstr(leftLW->item(i)->toolTip()));
-               rightLW->addItem(list_items[doMatch(ms.unicode)]->clone());
-       }
-
-       // The last element is the empty one.
-       leftLW->addItem(qt_("(None)"));
-       rightLW->addItem(qt_("(None)"));
-
-       sizeCO->addItem(qt_("Variable"));
-
-       for (int i = 0; *biggui[i]; ++i)
-               sizeCO->addItem(qt_(biggui[i]));
-
-       on_leftLW_currentRowChanged(0);
-}
-
-
-void GuiDelimiterDialog::updateTeXCode(int size)
-{
-       bool const bigsize = size != 0;
-
-       QString left_str = fix_name(leftLW->currentItem()->toolTip(), bigsize);
-       QString right_str = fix_name(rightLW->currentItem()->toolTip(), bigsize);
-
-       if (!bigsize)
-               tex_code_ = left_str + ' ' + right_str;
-       else {
-               tex_code_ = bigleft[size] + ' '
-                       + left_str + ' '
-                       + bigright[size] + ' '
-                       + right_str;
-       }
-
-       // Generate TeX-code for GUI display.
-       // FIXME: Instead of reconstructing the TeX code it would be nice to
-       // FIXME: retrieve the LateX code directly from mathed.
-       // In all cases, we want the '\' prefix if needed, so we pass 'true'
-       // to fix_name.
-       left_str = fix_name(leftLW->currentItem()->toolTip(), true);
-       right_str = fix_name(rightLW->currentItem()->toolTip(), true);
-       QString code_str;
-       if (!bigsize)
-               code_str = "\\left" + left_str + " \\right" + right_str;
-       else {
-               // There should be nothing in the TeX-code when the delimiter is "None".
-               if (left_str != ".")
-                       code_str = "\\" + bigleft[size] + left_str + ' ';
-               if (right_str != ".")
-                       code_str += "\\" + bigright[size] + right_str;
-       }
-
-       texCodeL->setText(qt_("TeX Code: ") + code_str);
-}
-
-
-void GuiDelimiterDialog::on_insertPB_clicked()
-{
-       if (sizeCO->currentIndex() == 0)
-               form_->controller().dispatchDelim(fromqstr(tex_code_));
-       else {
-               QString command = '"' + tex_code_ + '"';
-               command.replace(' ', "\" \"");
-               form_->controller().dispatchBigDelim(fromqstr(command));
-       }
- }
-
-
-void GuiDelimiterDialog::on_sizeCO_activated(int index)
-{
-       updateTeXCode(index);
-}
-
-
-void GuiDelimiterDialog::on_leftLW_itemActivated(QListWidgetItem *)
-{
-       on_insertPB_clicked();
-       accept();
-}
-
-
-void GuiDelimiterDialog::on_rightLW_itemActivated(QListWidgetItem *)
-{
-       on_insertPB_clicked();
-       accept();
-}
-
-
-void GuiDelimiterDialog::on_leftLW_currentRowChanged(int item)
-{
-       if (matchCB->isChecked())
-               rightLW->setCurrentRow(item);
-
-       updateTeXCode(sizeCO->currentIndex());
-}
-
-
-void GuiDelimiterDialog::on_rightLW_currentRowChanged(int item)
-{
-       if (matchCB->isChecked())
-               leftLW->setCurrentRow(item);
-
-       updateTeXCode(sizeCO->currentIndex());
-}
-
-
-void GuiDelimiterDialog::on_matchCB_stateChanged(int state)
-{
-       if (state == Qt::Checked)
-               on_leftLW_currentRowChanged(leftLW->currentRow());
-
-       updateTeXCode(sizeCO->currentIndex());
-}
-
-
-} // namespace frontend
-} // namespace lyx
-
-#include "GuiDelimiterDialog_moc.cpp"
diff --git a/src/frontends/qt4/GuiDelimiterDialog.h b/src/frontends/qt4/GuiDelimiterDialog.h
deleted file mode 100644 (file)
index 301eabc..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-// -*- C++ -*-
-/**
- * \file GuiDelimiterDialog.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author John Levon
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#ifndef GUIDELIMITERDIALOG_H
-#define GUIDELIMITERDIALOG_H
-
-#include "GuiDialogView.h"
-#include "ControlMath.h"
-#include "ui_DelimiterUi.h"
-
-class QListWidgetItem;
-
-namespace lyx {
-namespace frontend {
-
-class ControlMath;
-class GuiDelimiter;
-
-class GuiDelimiterDialog : public QDialog, public Ui::DelimiterUi
-{
-       Q_OBJECT
-public:
-       GuiDelimiterDialog(GuiDelimiter * form, QWidget * parent);
-public Q_SLOTS:
-       void on_leftLW_itemActivated(QListWidgetItem *);
-       void on_rightLW_itemActivated(QListWidgetItem *);
-       void on_leftLW_currentRowChanged(int);
-       void on_rightLW_currentRowChanged(int);
-       void on_matchCB_stateChanged(int);
-       void on_insertPB_clicked();
-       void on_sizeCO_activated(int);
-private:
-       ///
-       char_type doMatch(char_type const symbol) const;
-       ///
-       void updateTeXCode(int size);
-       /// owning form
-       GuiDelimiter * form_;
-       /// TeX code that will be inserted.
-       QString tex_code_;
-};
-
-
-class GuiDelimiter : public GuiView<GuiDelimiterDialog>
-{
-public:
-       friend class GuiDelimiterDialog;
-       ///
-       GuiDelimiter(Dialog &);
-       /// parent controller
-       ControlMath & controller()
-       { return static_cast<ControlMath &>(this->getController()); }
-       /// parent controller
-       ControlMath const & controller() const
-       { return static_cast<ControlMath const &>(this->getController()); }
-private:
-       virtual void apply() {}
-       virtual void update_contents() {}
-       /// Build the dialog.
-       virtual void build_dialog();
-};
-
-
-} // namespace frontend
-} // namespace lyx
-
-#endif // GUIDELIMITERDIALOG_H
diff --git a/src/frontends/qt4/GuiMathMatrix.cpp b/src/frontends/qt4/GuiMathMatrix.cpp
new file mode 100644 (file)
index 0000000..5a83b0d
--- /dev/null
@@ -0,0 +1,124 @@
+/**
+ * \file GuiMathMatrix.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Jürgen Spitzmüller
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "GuiMathMatrix.h"
+
+#include "EmptyTable.h"
+#include "qt_helpers.h"
+#include "gettext.h"
+
+#include <sstream>
+
+#include <QLineEdit>
+#include <QPushButton>
+#include <QSpinBox>
+
+using std::ostringstream;
+using std::string;
+
+namespace lyx {
+namespace frontend {
+
+GuiMathMatrix::GuiMathMatrix(Dialog & parent)
+       : GuiView<GuiMathMatrixDialog>(parent, _("Math Matrix"))
+{}
+
+
+void GuiMathMatrix::build_dialog()
+{
+       dialog_.reset(new GuiMathMatrixDialog(this));
+}
+
+
+GuiMathMatrixDialog::GuiMathMatrixDialog(GuiMathMatrix * form)
+       : form_(form)
+{
+       setupUi(this);
+
+       setWindowTitle(qt_("LyX: Insert Matrix"));
+
+       table->setMinimumSize(100, 100);
+       rowsSB->setValue(5);
+       columnsSB->setValue(5);
+       valignCO->setCurrentIndex(1);
+
+       connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
+       connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
+
+       connect(table, SIGNAL(rowsChanged(int)),
+               rowsSB, SLOT(setValue(int)));
+       connect(table, SIGNAL(colsChanged(int)),
+               columnsSB, SLOT(setValue(int)));
+       connect(rowsSB, SIGNAL(valueChanged(int)),
+               table, SLOT(setNumberRows(int)));
+       connect(columnsSB, SIGNAL(valueChanged(int)),
+               table, SLOT(setNumberColumns(int)));
+       connect(rowsSB, SIGNAL(valueChanged(int)),
+               this, SLOT(rowsChanged(int)));
+       connect(columnsSB, SIGNAL(valueChanged(int)),
+               this, SLOT(columnsChanged(int)) );
+       connect(valignCO, SIGNAL(highlighted(const QString&)),
+               this, SLOT(change_adaptor()));
+       connect(halignED, SIGNAL(textChanged(const QString&)),
+               this, SLOT(change_adaptor()));
+}
+
+
+void GuiMathMatrixDialog::columnsChanged(int)
+{
+       char h_align_str[80] = "c";
+       int const nx = int(columnsSB->value());
+       for (int i = 0; i < nx; ++i)
+               h_align_str[i] = 'c';
+
+       h_align_str[nx] = '\0';
+       halignED->setText(h_align_str);
+}
+
+
+void GuiMathMatrixDialog::rowsChanged(int)
+{
+}
+
+
+void GuiMathMatrixDialog::change_adaptor()
+{
+       // FIXME: We need a filter for the halign input
+}
+
+
+void GuiMathMatrixDialog::slotOK()
+{
+       char v_align_c[] = "tcb";
+       char const c = v_align_c[valignCO->currentIndex()];
+       string const sh = fromqstr(halignED->text());
+       int const nx = int(columnsSB->value());
+       int const ny = int(rowsSB->value());
+
+       ostringstream os;
+       os << nx << ' ' << ny << ' ' << c << ' ' << sh;
+       form_->controller().dispatchMatrix(os.str().c_str());
+
+       // close the dialog
+       close();
+}
+
+
+void GuiMathMatrixDialog::slotClose()
+{
+       close();
+}
+
+} // namespace frontend
+} // namespace lyx
+
+#include "GuiMathMatrix_moc.cpp"
diff --git a/src/frontends/qt4/GuiMathMatrix.h b/src/frontends/qt4/GuiMathMatrix.h
new file mode 100644 (file)
index 0000000..050f20f
--- /dev/null
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+/**
+ * \file GuiMathMatrixDialog.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author John Levon
+ * \author Edwin Leuven
+ * \author Jürgen Spitzmüller
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef GUIMATHMATRIXDIALOG_H
+#define GUIMATHMATRIXDIALOG_H
+
+#include "GuiDialogView.h"
+#include "ControlMath.h"
+#include "ui_MathMatrixUi.h"
+
+#include <QDialog>
+
+namespace lyx {
+namespace frontend {
+
+class GuiMathMatrix;
+class ControlMath;
+
+
+class GuiMathMatrixDialog : public QDialog, public Ui::MathMatrixUi {
+       Q_OBJECT
+public:
+       GuiMathMatrixDialog(GuiMathMatrix * form);
+public Q_SLOTS:
+       void slotOK();
+       void slotClose();
+protected Q_SLOTS:
+       virtual void columnsChanged(int);
+       virtual void rowsChanged(int);
+       virtual void change_adaptor();
+private:
+       GuiMathMatrix * form_;
+};
+
+
+class GuiMathMatrix : public GuiView<GuiMathMatrixDialog> {
+public:
+       friend class GuiMathMatrixDialog;
+
+       GuiMathMatrix(Dialog &);
+       /// parent controller
+       ControlMath & controller()
+       { return static_cast<ControlMath &>(this->getController()); }
+       /// parent controller
+       ControlMath const & controller() const
+       { return static_cast<ControlMath const &>(this->getController()); }
+private:
+       virtual void apply() {}
+       virtual void update_contents() {}
+       /// Build the dialog.
+       virtual void build_dialog();
+};
+
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // GUIMATHMATRIXDIALOG_H
diff --git a/src/frontends/qt4/GuiMathMatrixDialog.cpp b/src/frontends/qt4/GuiMathMatrixDialog.cpp
deleted file mode 100644 (file)
index ba88f54..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- * \file GuiMathMatrixDialog.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Jürgen Spitzmüller
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "GuiMathMatrixDialog.h"
-
-#include "EmptyTable.h"
-#include "qt_helpers.h"
-#include "gettext.h"
-
-#include <sstream>
-
-#include <QLineEdit>
-#include <QPushButton>
-#include <QSpinBox>
-
-using std::ostringstream;
-using std::string;
-
-namespace lyx {
-namespace frontend {
-
-GuiMathMatrix::GuiMathMatrix(Dialog & parent)
-       : GuiView<GuiMathMatrixDialog>(parent, _("Math Matrix"))
-{}
-
-
-void GuiMathMatrix::build_dialog()
-{
-       dialog_.reset(new GuiMathMatrixDialog(this));
-}
-
-
-GuiMathMatrixDialog::GuiMathMatrixDialog(GuiMathMatrix * form)
-       : form_(form)
-{
-       setupUi(this);
-
-       setWindowTitle(qt_("LyX: Insert Matrix"));
-
-       table->setMinimumSize(100, 100);
-       rowsSB->setValue(5);
-       columnsSB->setValue(5);
-       valignCO->setCurrentIndex(1);
-
-       connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
-       connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
-
-       connect(table, SIGNAL(rowsChanged(int)),
-               rowsSB, SLOT(setValue(int)));
-       connect(table, SIGNAL(colsChanged(int)),
-               columnsSB, SLOT(setValue(int)));
-       connect(rowsSB, SIGNAL(valueChanged(int)),
-               table, SLOT(setNumberRows(int)));
-       connect(columnsSB, SIGNAL(valueChanged(int)),
-               table, SLOT(setNumberColumns(int)));
-       connect(rowsSB, SIGNAL(valueChanged(int)),
-               this, SLOT(rowsChanged(int)));
-       connect(columnsSB, SIGNAL(valueChanged(int)),
-               this, SLOT(columnsChanged(int)) );
-       connect(valignCO, SIGNAL(highlighted(const QString&)),
-               this, SLOT(change_adaptor()));
-       connect(halignED, SIGNAL(textChanged(const QString&)),
-               this, SLOT(change_adaptor()));
-}
-
-
-void GuiMathMatrixDialog::columnsChanged(int)
-{
-       char h_align_str[80] = "c";
-       int const nx = int(columnsSB->value());
-       for (int i = 0; i < nx; ++i)
-               h_align_str[i] = 'c';
-
-       h_align_str[nx] = '\0';
-       halignED->setText(h_align_str);
-}
-
-
-void GuiMathMatrixDialog::rowsChanged(int)
-{
-}
-
-
-void GuiMathMatrixDialog::change_adaptor()
-{
-       // FIXME: We need a filter for the halign input
-}
-
-
-void GuiMathMatrixDialog::slotOK()
-{
-       char v_align_c[] = "tcb";
-       char const c = v_align_c[valignCO->currentIndex()];
-       string const sh = fromqstr(halignED->text());
-       int const nx = int(columnsSB->value());
-       int const ny = int(rowsSB->value());
-
-       ostringstream os;
-       os << nx << ' ' << ny << ' ' << c << ' ' << sh;
-       form_->controller().dispatchMatrix(os.str().c_str());
-
-       // close the dialog
-       close();
-}
-
-
-void GuiMathMatrixDialog::slotClose()
-{
-       close();
-}
-
-} // namespace frontend
-} // namespace lyx
-
-#include "GuiMathMatrixDialog_moc.cpp"
diff --git a/src/frontends/qt4/GuiMathMatrixDialog.h b/src/frontends/qt4/GuiMathMatrixDialog.h
deleted file mode 100644 (file)
index 050f20f..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-// -*- C++ -*-
-/**
- * \file GuiMathMatrixDialog.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author John Levon
- * \author Edwin Leuven
- * \author Jürgen Spitzmüller
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#ifndef GUIMATHMATRIXDIALOG_H
-#define GUIMATHMATRIXDIALOG_H
-
-#include "GuiDialogView.h"
-#include "ControlMath.h"
-#include "ui_MathMatrixUi.h"
-
-#include <QDialog>
-
-namespace lyx {
-namespace frontend {
-
-class GuiMathMatrix;
-class ControlMath;
-
-
-class GuiMathMatrixDialog : public QDialog, public Ui::MathMatrixUi {
-       Q_OBJECT
-public:
-       GuiMathMatrixDialog(GuiMathMatrix * form);
-public Q_SLOTS:
-       void slotOK();
-       void slotClose();
-protected Q_SLOTS:
-       virtual void columnsChanged(int);
-       virtual void rowsChanged(int);
-       virtual void change_adaptor();
-private:
-       GuiMathMatrix * form_;
-};
-
-
-class GuiMathMatrix : public GuiView<GuiMathMatrixDialog> {
-public:
-       friend class GuiMathMatrixDialog;
-
-       GuiMathMatrix(Dialog &);
-       /// parent controller
-       ControlMath & controller()
-       { return static_cast<ControlMath &>(this->getController()); }
-       /// parent controller
-       ControlMath const & controller() const
-       { return static_cast<ControlMath const &>(this->getController()); }
-private:
-       virtual void apply() {}
-       virtual void update_contents() {}
-       /// Build the dialog.
-       virtual void build_dialog();
-};
-
-
-} // namespace frontend
-} // namespace lyx
-
-#endif // GUIMATHMATRIXDIALOG_H
diff --git a/src/frontends/qt4/GuiURL.cpp b/src/frontends/qt4/GuiURL.cpp
new file mode 100644 (file)
index 0000000..518987c
--- /dev/null
@@ -0,0 +1,115 @@
+/**
+ * \file GuiURL.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author John Levon
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "GuiURL.h"
+#include "Qt2BC.h"
+#include "qt_helpers.h"
+#include "ButtonController.h"
+
+#include <QCheckBox>
+#include <QCloseEvent>
+#include <QLineEdit>
+#include <QPushButton>
+
+
+namespace lyx {
+namespace frontend {
+
+GuiURLDialog::GuiURLDialog(UrlView * form)
+       : form_(form)
+{
+       setupUi(this);
+
+       connect(okPB, SIGNAL(clicked()), form_, SLOT(slotOK()));
+       connect(closePB, SIGNAL(clicked()), form_, SLOT(slotClose()));
+       connect(urlED, SIGNAL(textChanged(const QString &)),
+               this, SLOT(changed_adaptor()));
+       connect(hyperlinkCB, SIGNAL(clicked()),
+               this, SLOT(changed_adaptor()));
+       connect(nameED, SIGNAL(textChanged(const QString &)),
+               this, SLOT(changed_adaptor()));
+
+       setFocusProxy(urlED);
+}
+
+
+void GuiURLDialog::changed_adaptor()
+{
+       form_->changed();
+}
+
+
+void GuiURLDialog::closeEvent(QCloseEvent * e)
+{
+       form_->slotWMHide();
+       e->accept();
+}
+
+
+
+UrlView::UrlView(Dialog & parent)
+       : GuiView<GuiURLDialog>(parent, _("URL"))
+{
+}
+
+
+void UrlView::build_dialog()
+{
+       dialog_.reset(new GuiURLDialog(this));
+
+       bcview().setOK(dialog_->okPB);
+       bcview().setCancel(dialog_->closePB);
+       bcview().addReadOnly(dialog_->urlED);
+       bcview().addReadOnly(dialog_->nameED);
+       bcview().addReadOnly(dialog_->hyperlinkCB);
+}
+
+
+void UrlView::update_contents()
+{
+       InsetCommandParams const & params = controller().params();
+
+       dialog_->urlED->setText(toqstr(params["target"]));
+       dialog_->nameED->setText(toqstr(params["name"]));
+       dialog_->hyperlinkCB->setChecked(params.getCmdName() != "url");
+
+       bc().valid(isValid());
+}
+
+
+void UrlView::apply()
+{
+       InsetCommandParams & params = controller().params();
+
+       params["target"] = qstring_to_ucs4(dialog_->urlED->text());
+       params["name"] = qstring_to_ucs4(dialog_->nameED->text());
+
+       if (dialog_->hyperlinkCB->isChecked())
+               params.setCmdName("htmlurl");
+       else
+               params.setCmdName("url");
+}
+
+
+bool UrlView::isValid()
+{
+       QString const u = dialog_->urlED->text();
+       QString const n = dialog_->nameED->text();
+
+       return !u.isEmpty() || !n.isEmpty();
+}
+
+} // namespace frontend
+} // namespace lyx
+
+
+#include "GuiURL_moc.cpp"
diff --git a/src/frontends/qt4/GuiURL.h b/src/frontends/qt4/GuiURL.h
new file mode 100644 (file)
index 0000000..6c9c5ff
--- /dev/null
@@ -0,0 +1,65 @@
+// -*- C++ -*-
+/**
+ * \file GuiURLDialog.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author John Levon
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef GUIURLDIALOG_H
+#define GUIURLDIALOG_H
+
+#include "GuiDialogView.h"
+#include "ControlCommand.h"
+#include "ui_URLUi.h"
+
+#include <QDialog>
+
+namespace lyx {
+namespace frontend {
+
+class UrlView;
+
+class GuiURLDialog : public QDialog, public Ui::URLUi
+{
+       Q_OBJECT
+public:
+       GuiURLDialog(UrlView * form);
+public Q_SLOTS:
+       void changed_adaptor();
+protected:
+       void closeEvent(QCloseEvent *);
+private:
+       UrlView * form_;
+};
+
+
+class UrlView : public GuiView<GuiURLDialog> 
+{
+public:
+       friend class QURLDialog;
+       UrlView(Dialog &);
+       /// parent controller
+       ControlCommand & controller()
+       { return static_cast<ControlCommand &>(this->getController()); }
+       /// parent controller
+       ControlCommand const & controller() const
+       { return static_cast<ControlCommand const &>(this->getController()); }
+protected:
+       virtual bool isValid();
+private:
+       /// apply dialog
+       virtual void apply();
+       /// build dialog
+       virtual void build_dialog();
+       /// update dialog
+       virtual void update_contents();
+};
+
+} // namespace frontend
+} // namespace lyx
+
+#endif // GUIURLDIALOG_H
diff --git a/src/frontends/qt4/GuiURLDialog.cpp b/src/frontends/qt4/GuiURLDialog.cpp
deleted file mode 100644 (file)
index 2728fa2..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * \file GuiURLDialog.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author John Levon
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "GuiURLDialog.h"
-#include "Qt2BC.h"
-#include "qt_helpers.h"
-#include "ButtonController.h"
-
-#include <QCheckBox>
-#include <QCloseEvent>
-#include <QLineEdit>
-#include <QPushButton>
-
-
-namespace lyx {
-namespace frontend {
-
-GuiURLDialog::GuiURLDialog(UrlView * form)
-       : form_(form)
-{
-       setupUi(this);
-
-       connect(okPB, SIGNAL(clicked()), form_, SLOT(slotOK()));
-       connect(closePB, SIGNAL(clicked()), form_, SLOT(slotClose()));
-       connect(urlED, SIGNAL(textChanged(const QString &)),
-               this, SLOT(changed_adaptor()));
-       connect(hyperlinkCB, SIGNAL(clicked()),
-               this, SLOT(changed_adaptor()));
-       connect(nameED, SIGNAL(textChanged(const QString &)),
-               this, SLOT(changed_adaptor()));
-
-       setFocusProxy(urlED);
-}
-
-
-void GuiURLDialog::changed_adaptor()
-{
-       form_->changed();
-}
-
-
-void GuiURLDialog::closeEvent(QCloseEvent * e)
-{
-       form_->slotWMHide();
-       e->accept();
-}
-
-
-
-UrlView::UrlView(Dialog & parent)
-       : GuiView<GuiURLDialog>(parent, _("URL"))
-{
-}
-
-
-void UrlView::build_dialog()
-{
-       dialog_.reset(new GuiURLDialog(this));
-
-       bcview().setOK(dialog_->okPB);
-       bcview().setCancel(dialog_->closePB);
-       bcview().addReadOnly(dialog_->urlED);
-       bcview().addReadOnly(dialog_->nameED);
-       bcview().addReadOnly(dialog_->hyperlinkCB);
-}
-
-
-void UrlView::update_contents()
-{
-       InsetCommandParams const & params = controller().params();
-
-       dialog_->urlED->setText(toqstr(params["target"]));
-       dialog_->nameED->setText(toqstr(params["name"]));
-       dialog_->hyperlinkCB->setChecked(params.getCmdName() != "url");
-
-       bc().valid(isValid());
-}
-
-
-void UrlView::apply()
-{
-       InsetCommandParams & params = controller().params();
-
-       params["target"] = qstring_to_ucs4(dialog_->urlED->text());
-       params["name"] = qstring_to_ucs4(dialog_->nameED->text());
-
-       if (dialog_->hyperlinkCB->isChecked())
-               params.setCmdName("htmlurl");
-       else
-               params.setCmdName("url");
-}
-
-
-bool UrlView::isValid()
-{
-       QString const u = dialog_->urlED->text();
-       QString const n = dialog_->nameED->text();
-
-       return !u.isEmpty() || !n.isEmpty();
-}
-
-} // namespace frontend
-} // namespace lyx
-
-#include "GuiURLDialog_moc.cpp"
diff --git a/src/frontends/qt4/GuiURLDialog.h b/src/frontends/qt4/GuiURLDialog.h
deleted file mode 100644 (file)
index 6c9c5ff..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-// -*- C++ -*-
-/**
- * \file GuiURLDialog.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author John Levon
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#ifndef GUIURLDIALOG_H
-#define GUIURLDIALOG_H
-
-#include "GuiDialogView.h"
-#include "ControlCommand.h"
-#include "ui_URLUi.h"
-
-#include <QDialog>
-
-namespace lyx {
-namespace frontend {
-
-class UrlView;
-
-class GuiURLDialog : public QDialog, public Ui::URLUi
-{
-       Q_OBJECT
-public:
-       GuiURLDialog(UrlView * form);
-public Q_SLOTS:
-       void changed_adaptor();
-protected:
-       void closeEvent(QCloseEvent *);
-private:
-       UrlView * form_;
-};
-
-
-class UrlView : public GuiView<GuiURLDialog> 
-{
-public:
-       friend class QURLDialog;
-       UrlView(Dialog &);
-       /// parent controller
-       ControlCommand & controller()
-       { return static_cast<ControlCommand &>(this->getController()); }
-       /// parent controller
-       ControlCommand const & controller() const
-       { return static_cast<ControlCommand const &>(this->getController()); }
-protected:
-       virtual bool isValid();
-private:
-       /// apply dialog
-       virtual void apply();
-       /// build dialog
-       virtual void build_dialog();
-       /// update dialog
-       virtual void update_contents();
-};
-
-} // namespace frontend
-} // namespace lyx
-
-#endif // GUIURLDIALOG_H
index c331f7f0b862c345179c11b44a3ecdd91a46fd85..2835115028955d84c8d9cab6681748415d8b2111 100644 (file)
@@ -54,11 +54,10 @@ SOURCEFILES = \
        GuiChanges.cpp \
        GuiCharacter.cpp \
        GuiCitation.cpp \
-       GuiCitationDialog.cpp \
        GuiClipboard.cpp \
        GuiCommandBuffer.cpp \
        GuiCommandEdit.cpp \
-       GuiDelimiterDialog.cpp \
+       GuiDelimiter.cpp \
        GuiDialogView.cpp \
        GuiDocument.cpp \
        GuiEmbeddedFiles.cpp \
@@ -78,7 +77,7 @@ SOURCEFILES = \
        GuiKeySymbol.cpp \
        GuiListings.cpp \
        GuiLog.cpp \
-       GuiMathMatrixDialog.cpp \
+       GuiMathMatrix.cpp \
        GuiMenubar.cpp \
        GuiNomencl.cpp \
        GuiNote.cpp \
@@ -101,7 +100,7 @@ SOURCEFILES = \
        GuiThesaurus.cpp \
        GuiToc.cpp \
        GuiToolbar.cpp \
-       GuiURLDialog.cpp \
+       GuiURL.cpp \
        GuiView.cpp \
        GuiViewSource.cpp \
        GuiVSpace.cpp \
@@ -146,11 +145,10 @@ MOCHEADER = \
        GuiBranch.h \
        GuiChanges.h \
        GuiCharacter.h \
-       GuiCitationDialog.h \
        GuiCitation.h \
        GuiCommandBuffer.h \
        GuiCommandEdit.h \
-       GuiDelimiterDialog.h \
+       GuiDelimiter.h \
        GuiDialogView.h \
        GuiDocument.h \
        GuiEmbeddedFiles.h \
@@ -166,7 +164,7 @@ MOCHEADER = \
        GuiKeySymbol.h \
        GuiListings.h \
        GuiLog.h \
-       GuiMathMatrixDialog.h \
+       GuiMathMatrix.h \
        GuiMenubar.h \
        GuiNomencl.h \
        GuiNote.h \
@@ -187,7 +185,7 @@ MOCHEADER = \
        GuiThesaurus.h \
        GuiToc.h \
        GuiToolbar.h \
-       GuiURLDialog.h \
+       GuiURL.h \
        GuiView.h \
        GuiViewSource.h \
        GuiVSpace.h \