]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiMathMatrix.cpp
fix completion painting for RTL (inline completion and completion list)
[lyx.git] / src / frontends / qt4 / GuiMathMatrix.cpp
index f4ba1b142b7d9152005336fd0e08aee730f00f68..24722b00e835bfb21a62391083e015e6fa027478 100644 (file)
 
 #include "GuiMathMatrix.h"
 
-#include "ControlMath.h"
 #include "EmptyTable.h"
 #include "qt_helpers.h"
-#include "gettext.h"
 
-#include <sstream>
+#include "FuncRequest.h"
 
 #include <QLineEdit>
 #include <QPushButton>
 #include <QSpinBox>
 
-using std::ostringstream;
-using std::string;
+using namespace std;
 
 namespace lyx {
 namespace frontend {
 
-GuiMathMatrixDialog::GuiMathMatrixDialog(LyXView & lv)
-       : GuiDialog(lv, "mathmatrix")
+GuiMathMatrix::GuiMathMatrix(GuiView & lv)
+       : GuiDialog(lv, "mathmatrix", qt_("Math Matrix"))
 {
        setupUi(this);
-       setViewTitle(_("Math Matrix"));
-       setController(new ControlMath(*this));
-
-       setWindowTitle(qt_("LyX: Insert Matrix"));
 
        table->setMinimumSize(100, 100);
        rowsSB->setValue(5);
@@ -58,22 +51,16 @@ GuiMathMatrixDialog::GuiMathMatrixDialog(LyXView & lv)
                this, SLOT(rowsChanged(int)));
        connect(columnsSB, SIGNAL(valueChanged(int)),
                this, SLOT(columnsChanged(int)) );
-       connect(valignCO, SIGNAL(highlighted(const QString&)),
+       connect(valignCO, SIGNAL(highlighted(QString)),
                this, SLOT(change_adaptor()));
-       connect(halignED, SIGNAL(textChanged(const QString&)),
+       connect(halignED, SIGNAL(textChanged(QString)),
                this, SLOT(change_adaptor()));
 
        bc().setPolicy(ButtonPolicy::IgnorantPolicy);
 }
 
 
-ControlMath & GuiMathMatrixDialog::controller() const
-{
-       return static_cast<ControlMath &>(Dialog::controller());
-}
-
-
-void GuiMathMatrixDialog::columnsChanged(int)
+void GuiMathMatrix::columnsChanged(int)
 {
        char h_align_str[80] = "c";
        int const nx = int(columnsSB->value());
@@ -85,39 +72,40 @@ void GuiMathMatrixDialog::columnsChanged(int)
 }
 
 
-void GuiMathMatrixDialog::rowsChanged(int)
+void GuiMathMatrix::rowsChanged(int)
 {
 }
 
 
-void GuiMathMatrixDialog::change_adaptor()
+void GuiMathMatrix::change_adaptor()
 {
        // FIXME: We need a filter for the halign input
 }
 
 
-void GuiMathMatrixDialog::slotOK()
+void GuiMathMatrix::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;
-       controller().dispatchMatrix(os.str().c_str());
-
-       // close the dialog
+       QString const sh = halignED->text();
+       int const nx = columnsSB->value();
+       int const ny = rowsSB->value();
+       string const str = fromqstr(
+               QString("%1 %2 %3 %4").arg(nx).arg(ny).arg(c).arg(sh));
+       dispatch(FuncRequest(LFUN_MATH_MATRIX, str));
        close();
 }
 
 
-void GuiMathMatrixDialog::slotClose()
+void GuiMathMatrix::slotClose()
 {
        close();
 }
 
+
+Dialog * createGuiMathMatrix(GuiView & lv) { return new GuiMathMatrix(lv); }
+
+
 } // namespace frontend
 } // namespace lyx