--- /dev/null
+/**
+ * \file QMathMatrixDialog.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Juergen Spitzmueller
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "gettext.h"
+
+#include "support/lstrings.h"
+
+#include "QMath.h"
+#include "QMathMatrixDialog.h"
+
+#include <qcombobox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qspinbox.h>
+#include "emptytable.h"
+
+
+static char h_align_str[80] = "c";
+static char v_align_c[] = "tcb";
+
+
+QMathMatrixDialog::QMathMatrixDialog(QMath * form)
+ : QMathMatrixDialogBase(0, 0, false, 0),
+ form_(form)
+{
+ setCaption(_("LyX: Insert matrix"));
+
+ table->setMinimumSize(100,100);
+ rowsSB->setValue(2);
+ columnsSB->setValue(2);
+ valignCO->setCurrentItem(1);
+
+ connect(okPB, SIGNAL(clicked()),
+ this, SLOT(slotOK()));
+ connect(closePB, SIGNAL(clicked()),
+ this, SLOT(slotClose()));
+}
+
+
+void QMathMatrixDialog::columnsChanged(int)
+{
+ 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);
+
+ return;
+}
+
+
+void QMathMatrixDialog::rowsChanged(int)
+{
+}
+
+
+void QMathMatrixDialog::change_adaptor()
+{
+ // FIXME: We need a filter for the halign input
+}
+
+
+void QMathMatrixDialog::slotOK()
+{
+ char const c = v_align_c[valignCO->currentItem()];
+ char const * sh = halignED->text().latin1();
+ int const nx = int(rowsSB->value());
+ int const ny = int(columnsSB->value());
+
+ ostringstream os;
+ os << nx << ' ' << ny << ' ' << c << ' ' << sh;
+ form_->insertMatrix(os.str().c_str());
+
+ // close the dialog
+ close();
+}
+
+
+void QMathMatrixDialog::slotClose()
+{
+ close();
+}
--- /dev/null
+<!DOCTYPE UI><UI>
+<class>QMathMatrixDialogBase</class>
+<include location="global">config.h</include>
+<include location="local">gettext.h</include>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>QMathMatrixDialogBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>248</width>
+ <height>371</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Insert matrix</string>
+ </property>
+ <property stdset="1">
+ <name>sizeGripEnabled</name>
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" rowspan="1" colspan="2" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>rowsL</cstring>
+ </property>
+ <property stdset="1">
+ <name>frameShape</name>
+ <enum>MShape</enum>
+ </property>
+ <property stdset="1">
+ <name>frameShadow</name>
+ <enum>MShadow</enum>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Rows:</string>
+ </property>
+ <property>
+ <name>buddy</name>
+ <cstring>rowsSB</cstring>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Number of rows</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>rowsSB</cstring>
+ </property>
+ <property stdset="1">
+ <name>buttonSymbols</name>
+ <enum>PlusMinus</enum>
+ </property>
+ <property stdset="1">
+ <name>maxValue</name>
+ <number>511</number>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>1</number>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Number of rows</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>columnsL</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Columns:</string>
+ </property>
+ <property>
+ <name>buddy</name>
+ <cstring>columnsSB</cstring>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Number of columns</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>columnsSB</cstring>
+ </property>
+ <property stdset="1">
+ <name>buttonSymbols</name>
+ <enum>PlusMinus</enum>
+ </property>
+ <property stdset="1">
+ <name>maxValue</name>
+ <number>511</number>
+ </property>
+ <property stdset="1">
+ <name>minValue</name>
+ <number>1</number>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Number of columns</string>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer1</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <spacer row="1" column="1" >
+ <property>
+ <name>name</name>
+ <cstring>Spacer1_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>MinimumExpanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget row="1" column="0" >
+ <class>EmptyTable</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>table</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ </sizepolicy>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Resize this to the correct table dimensions</string>
+ </property>
+ </widget>
+ <widget row="4" column="0" rowspan="1" colspan="2" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout2</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer2</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>okPB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&OK</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>closePB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Close</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer row="2" column="0" >
+ <property>
+ <name>name</name>
+ <cstring>Spacer2_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>MinimumExpanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget row="3" column="0" rowspan="1" colspan="2" >
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>alignmentG</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Alignment</string>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="1" column="0" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Top</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Center</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Bottom</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>valignCO</cstring>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Vertical alignment</string>
+ </property>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>valignLA</cstring>
+ </property>
+ <property stdset="1">
+ <name>frameShape</name>
+ <enum>MShape</enum>
+ </property>
+ <property stdset="1">
+ <name>frameShadow</name>
+ <enum>MShadow</enum>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Vertical:</string>
+ </property>
+ <property stdset="1">
+ <name>alignment</name>
+ <set>AlignVCenter|AlignLeft</set>
+ </property>
+ <property>
+ <name>buddy</name>
+ <cstring>valignCO</cstring>
+ </property>
+ <property>
+ <name>wordwrap</name>
+ </property>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>halignED</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Horizontal alignment per column (t,c,b)</string>
+ </property>
+ </widget>
+ <widget row="0" column="1" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>widthLA_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>frameShape</name>
+ <enum>MShape</enum>
+ </property>
+ <property stdset="1">
+ <name>frameShadow</name>
+ <enum>MShadow</enum>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Horizontal:</string>
+ </property>
+ <property>
+ <name>buddy</name>
+ <cstring>halignED</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>EmptyTable</class>
+ <header location="local">emptytable.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ <signal>colsChanged(int)</signal>
+ <signal>rowsChanged(int)</signal>
+ <slot access="public">setNumberColumns(int)</slot>
+ <slot access="public">setNumberRows(int)</slot>
+ </customwidget>
+</customwidgets>
+<images>
+ <image>
+ <name>image0</name>
+ <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>table</sender>
+ <signal>rowsChanged(int)</signal>
+ <receiver>rowsSB</receiver>
+ <slot>setValue(int)</slot>
+ </connection>
+ <connection>
+ <sender>table</sender>
+ <signal>colsChanged(int)</signal>
+ <receiver>columnsSB</receiver>
+ <slot>setValue(int)</slot>
+ </connection>
+ <connection>
+ <sender>rowsSB</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>table</receiver>
+ <slot>setNumberRows(int)</slot>
+ </connection>
+ <connection>
+ <sender>columnsSB</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>table</receiver>
+ <slot>setNumberColumns(int)</slot>
+ </connection>
+ <connection>
+ <sender>rowsSB</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>QMathMatrixDialogBase</receiver>
+ <slot>rowsChanged(int)</slot>
+ </connection>
+ <connection>
+ <sender>columnsSB</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>QMathMatrixDialogBase</receiver>
+ <slot>columnsChanged(int)</slot>
+ </connection>
+ <connection>
+ <sender>valignCO</sender>
+ <signal>highlighted(const QString&)</signal>
+ <receiver>QMathMatrixDialogBase</receiver>
+ <slot>change_adaptor()</slot>
+ </connection>
+ <connection>
+ <sender>halignED</sender>
+ <signal>textChanged(const QString&)</signal>
+ <receiver>QMathMatrixDialogBase</receiver>
+ <slot>change_adaptor()</slot>
+ </connection>
+ <slot access="public">change_adaptor()</slot>
+ <slot access="public">columnsChanged(int)</slot>
+ <slot access="public">rowsChanged(int)</slot>
+</connections>
+</UI>