From: John Levon Date: Mon, 28 Oct 2002 16:43:58 +0000 (+0000) Subject: Fix symbol insert. X-Git-Tag: 1.6.10~18066 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=86a6517e516826fecfbf5b687d383094d37d078e;p=features.git Fix symbol insert. Add matrix dialog. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5534 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index a7a1d6d91f..6152a6bd31 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,18 @@ +2002-10-28 John Levon + + * iconpalette.C: + * QMathDialog.C: fix symbol insert breakage from Lars' patch + +2002-10-26 Juergen Spitzmueller + + * 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 * qfont_loader.C (font_info): Add xfonts to the font path if diff --git a/src/frontends/qt2/Dialogs2.C b/src/frontends/qt2/Dialogs2.C index 0c5cb49adc..4b0f9cf231 100644 --- a/src/frontends/qt2/Dialogs2.C +++ b/src/frontends/qt2/Dialogs2.C @@ -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(); diff --git a/src/frontends/qt2/Makefile.dialogs b/src/frontends/qt2/Makefile.dialogs index a24279e122..6ed774bc3a 100644 --- a/src/frontends/qt2/Makefile.dialogs +++ b/src/frontends/qt2/Makefile.dialogs @@ -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 \ diff --git a/src/frontends/qt2/QMath.C b/src/frontends/qt2/QMath.C index a031238b94..cd0e417047 100644 --- a/src/frontends/qt2/QMath.C +++ b/src/frontends/qt2/QMath.C @@ -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)); } diff --git a/src/frontends/qt2/QMath.h b/src/frontends/qt2/QMath.h index 5fd1763d72..b1497365ae 100644 --- a/src/frontends/qt2/QMath.h +++ b/src/frontends/qt2/QMath.h @@ -39,7 +39,7 @@ public: void insertCubeRoot(); /// insert a matrix - void insertMatrix(); + void insertMatrix(string const & str); /// insert delim void insertDelim(string const & str); diff --git a/src/frontends/qt2/QMathDialog.C b/src/frontends/qt2/QMathDialog.C index 99a612e4c8..492035d932 100644 --- a/src/frontends/qt2/QMathDialog.C +++ b/src/frontends/qt2/QMathDialog.C @@ -24,6 +24,7 @@ #include "ControlMath.h" #include "iconpalette.h" #include "QDelimiterDialog.h" +#include "QMathMatrixDialog.h" #include #include @@ -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(); } diff --git a/src/frontends/qt2/QMathMatrixDialog.C b/src/frontends/qt2/QMathMatrixDialog.C new file mode 100644 index 0000000000..8efea25891 --- /dev/null +++ b/src/frontends/qt2/QMathMatrixDialog.C @@ -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 + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "gettext.h" + +#include "support/lstrings.h" + +#include "QMath.h" +#include "QMathMatrixDialog.h" + +#include +#include +#include +#include +#include +#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(); +} diff --git a/src/frontends/qt2/QMathMatrixDialog.h b/src/frontends/qt2/QMathMatrixDialog.h new file mode 100644 index 0000000000..6f75b92231 --- /dev/null +++ b/src/frontends/qt2/QMathMatrixDialog.h @@ -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 diff --git a/src/frontends/qt2/TODO b/src/frontends/qt2/TODO index 0d630b89a2..0f3790db7a 100644 --- a/src/frontends/qt2/TODO +++ b/src/frontends/qt2/TODO @@ -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) (*) diff --git a/src/frontends/qt2/iconpalette.h b/src/frontends/qt2/iconpalette.h index a4f6af76d1..7f1b9d9ee9 100644 --- a/src/frontends/qt2/iconpalette.h +++ b/src/frontends/qt2/iconpalette.h @@ -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: diff --git a/src/frontends/qt2/ui/QMathMatrixDialog.ui b/src/frontends/qt2/ui/QMathMatrixDialog.ui new file mode 100644 index 0000000000..a5d63251da --- /dev/null +++ b/src/frontends/qt2/ui/QMathMatrixDialog.ui @@ -0,0 +1,489 @@ + +QMathMatrixDialogBase +config.h +gettext.h + + QDialog + + name + QMathMatrixDialogBase + + + geometry + + 0 + 0 + 248 + 371 + + + + caption + Insert matrix + + + sizeGripEnabled + true + + + + margin + 11 + + + spacing + 6 + + + QLayoutWidget + + name + Layout1 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + rowsL + + + frameShape + MShape + + + frameShadow + MShadow + + + text + &Rows: + + + buddy + rowsSB + + + toolTip + Number of rows + + + + QSpinBox + + name + rowsSB + + + buttonSymbols + PlusMinus + + + maxValue + 511 + + + minValue + 1 + + + toolTip + Number of rows + + + + QLabel + + name + columnsL + + + text + &Columns: + + + buddy + columnsSB + + + toolTip + Number of columns + + + + QSpinBox + + name + columnsSB + + + buttonSymbols + PlusMinus + + + maxValue + 511 + + + minValue + 1 + + + toolTip + Number of columns + + + + + name + Spacer1 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + + + + name + Spacer1_2 + + + orientation + Horizontal + + + sizeType + MinimumExpanding + + + sizeHint + + 20 + 20 + + + + + EmptyTable + + name + table + + + sizePolicy + + 5 + 5 + + + + toolTip + Resize this to the correct table dimensions + + + + QLayoutWidget + + name + Layout2 + + + + margin + 0 + + + spacing + 6 + + + + name + Spacer2 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QPushButton + + name + okPB + + + text + &OK + + + + QPushButton + + name + closePB + + + text + Close + + + + + + + name + Spacer2_2 + + + orientation + Vertical + + + sizeType + MinimumExpanding + + + sizeHint + + 20 + 20 + + + + + QGroupBox + + name + alignmentG + + + title + Alignment + + + + margin + 11 + + + spacing + 6 + + + QComboBox + + + text + Top + + + + + text + Center + + + + + text + Bottom + + + + name + valignCO + + + toolTip + Vertical alignment + + + + QLabel + + name + valignLA + + + frameShape + MShape + + + frameShadow + MShadow + + + text + &Vertical: + + + alignment + AlignVCenter|AlignLeft + + + buddy + valignCO + + + wordwrap + + + + QLineEdit + + name + halignED + + + sizePolicy + + 1 + 0 + + + + toolTip + Horizontal alignment per column (t,c,b) + + + + QLabel + + name + widthLA_2 + + + frameShape + MShape + + + frameShadow + MShadow + + + text + &Horizontal: + + + buddy + halignED + + + + + + + + + EmptyTable +
emptytable.h
+ + -1 + -1 + + 0 + + 5 + 5 + + image0 + colsChanged(int) + rowsChanged(int) + setNumberColumns(int) + setNumberRows(int) +
+
+ + + image0 + 789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758 + + + + + table + rowsChanged(int) + rowsSB + setValue(int) + + + table + colsChanged(int) + columnsSB + setValue(int) + + + rowsSB + valueChanged(int) + table + setNumberRows(int) + + + columnsSB + valueChanged(int) + table + setNumberColumns(int) + + + rowsSB + valueChanged(int) + QMathMatrixDialogBase + rowsChanged(int) + + + columnsSB + valueChanged(int) + QMathMatrixDialogBase + columnsChanged(int) + + + valignCO + highlighted(const QString&) + QMathMatrixDialogBase + change_adaptor() + + + halignED + textChanged(const QString&) + QMathMatrixDialogBase + change_adaptor() + + change_adaptor() + columnsChanged(int) + rowsChanged(int) + +