Fix symbol insert.

Add matrix dialog.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5534 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-10-28 16:43:58 +00:00
parent 35c861a201
commit 86a6517e51
11 changed files with 671 additions and 13 deletions

View File

@ -1,3 +1,18 @@
2002-10-28 John Levon <levon@movementarian.org>
* iconpalette.C:
* QMathDialog.C: fix symbol insert breakage from Lars' patch
2002-10-26 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* ui/QMathMatrixDialog.ui:
* QMathMatrixDialog.[Ch]:
* Makefile.dialogs:
* QMath.C:
* QMathDialog.C: implement Matrix dialog
* QMathDialog.C: enlarge Symbols combox (prevent scrollbar)
2002-10-28 Dekel Tsur <dekelts@tau.ac.il>
* qfont_loader.C (font_info): Add xfonts to the font path if

View File

@ -131,6 +131,18 @@ void Dialogs::createIndex()
}
void Dialogs::showListing(InsetCommand * ic)
{
pimpl_->listing.controller().showInset(ic);
}
void Dialogs::createListing(string const & s)
{
pimpl_->listing.controller().createInset(s);
}
void Dialogs::showLogFile()
{
pimpl_->logfile.controller().show();

View File

@ -66,6 +66,7 @@ DIALOGSOURCES = \
QLog.C QLogDialog.C \
QMath.h QMathDialog.h \
QMath.C QMathDialog.C \
QMathMatrixDialog.h QMathMatrixDialog.C \
QMinipage.h QMinipageDialog.h \
QMinipage.C QMinipageDialog.C \
QParagraph.h QParagraphDialog.h \
@ -116,6 +117,7 @@ MOCDIALOGS = \
QIndexDialog_moc.C \
QLogDialog_moc.C \
QMathDialog_moc.C \
QMathMatrixDialog_moc.C \
QMinipageDialog_moc.C \
QParagraphDialog_moc.C \
QPreambleDialog_moc.C \
@ -168,6 +170,8 @@ UIDIALOGS = \
QLogDialogBase.C \
QMathDialogBase.h \
QMathDialogBase.C \
QMathMatrixDialogBase.h \
QMathMatrixDialogBase.C \
QMinipageDialogBase.h \
QMinipageDialogBase.C \
QParagraphDialogBase.h \
@ -228,6 +232,7 @@ UIMOCDIALOGS = \
QIndexDialogBase_moc.C \
QLogDialogBase_moc.C \
QMathDialogBase_moc.C \
QMathMatrixDialogBase_moc.C \
QMinipageDialogBase_moc.C \
QParagraphDialogBase_moc.C \
QPreambleDialogBase_moc.C \

View File

@ -85,9 +85,9 @@ void QMath::insertCubeRoot()
}
void QMath::insertMatrix()
void QMath::insertMatrix(string const & str)
{
current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATRIX, "2 2"));
current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATRIX, str));
}

View File

@ -39,7 +39,7 @@ public:
void insertCubeRoot();
/// insert a matrix
void insertMatrix();
void insertMatrix(string const & str);
/// insert delim
void insertDelim(string const & str);

View File

@ -24,6 +24,7 @@
#include "ControlMath.h"
#include "iconpalette.h"
#include "QDelimiterDialog.h"
#include "QMathMatrixDialog.h"
#include <qapplication.h>
#include <qwidgetstack.h>
@ -92,6 +93,9 @@ QMathDialog::QMathDialog(QMath * form)
: QMathDialogBase(0, 0, false, 0),
form_(form)
{
// enlarge the symbols ComboBox (no scrollbar)
symbolsCO->setSizeLimit(13);
connect(symbolsCO, SIGNAL(activated(int)), symbolsWS, SLOT(raiseWidget(int)));
for (int i = 0; *function_names[i]; ++i) {
@ -179,7 +183,7 @@ IconPalette * QMathDialog::makePanel(QWidget * parent, char const ** entries)
string xpm_name = LibFileSearch("images/math/", entries[i], "xpm");
p->add(QPixmap(xpm_name.c_str()), entries[i], string("\\") + entries[i]);
}
connect(p, SIGNAL(button_clicked(string)), this, SLOT(symbol_clicked(string)));
connect(p, SIGNAL(button_clicked(string const &)), this, SLOT(symbol_clicked(string const &)));
return p;
}
@ -234,7 +238,9 @@ void QMathDialog::functionSelected(const QString & str)
void QMathDialog::matrixClicked()
{
form_->insertMatrix();
// FIXME: leak?
QMathMatrixDialog * d = new QMathMatrixDialog(form_);
d->show();
}

View File

@ -0,0 +1,97 @@
/**
* \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();
}

View File

@ -0,0 +1,40 @@
// -*- C++ -*-
/**
* \file QMathMatrixDialog.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 Juergen Spitzmueller
*
* Full author contact details are available in file CREDITS
*/
#ifndef QMATHMATRIXDIALOG_H
#define QMATHMATRIXDIALOG_H
#ifdef __GNUG__
#pragma interface
#endif
#include "ui/QMathMatrixDialogBase.h"
class QMath;
class QMathMatrixDialog : public QMathMatrixDialogBase {
Q_OBJECT
public:
QMathMatrixDialog(QMath * form);
public slots:
void slotOK();
void slotClose();
protected slots:
virtual void columnsChanged(int);
virtual void rowsChanged(int);
virtual void change_adaptor();
private:
QMath * form_;
};
#endif // QMATHMATRIXDIALOG_H

View File

@ -7,7 +7,6 @@ Those with asterisks are what I perceive as being "big jobs"
lyx_gui (qt)
- move out lyxserver
- do dpi (cannot easily fix)
QDocument
@ -19,7 +18,7 @@ QDocument
qfont_loader
- use lyxrc, check for failure, implement available()
- use lyxrc, check for failure
QForks
@ -41,7 +40,6 @@ QLPainter
QLyXKeySym
- getISOEncoded - get this to work (*)
QMathDialog
@ -51,10 +49,6 @@ QPreferences
- implement me (*)
QSendTo
- implement me
QTabular
- implement me (need MVC) (*)

View File

@ -36,7 +36,7 @@ public:
/// add a button
void add(QPixmap const & pixmap, string name, string tooltip);
signals:
void button_clicked(string);
void button_clicked(string const &);
protected:
virtual void resizeEvent(QResizeEvent * e);
protected slots:

View File

@ -0,0 +1,489 @@
<!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>&amp;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>&amp;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>&amp;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>&amp;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>&amp;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&amp;)</signal>
<receiver>QMathMatrixDialogBase</receiver>
<slot>change_adaptor()</slot>
</connection>
<connection>
<sender>halignED</sender>
<signal>textChanged(const QString&amp;)</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>