mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-02 08:10:39 +00:00
* removal of math panel
some code is moved from QMath to QDelimiterDialog and QMathMatrixDialog for the rest pretty mechanical git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17872 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
06cd0adcf6
commit
22fb43fd8f
@ -628,7 +628,6 @@ src_frontends_qt4_ui_files = Split('''
|
||||
QIndexUi.ui
|
||||
QLogUi.ui
|
||||
QMathMatrixUi.ui
|
||||
QMathUi.ui
|
||||
QNomenclUi.ui
|
||||
QNoteUi.ui
|
||||
QParagraphUi.ui
|
||||
@ -803,8 +802,6 @@ src_frontends_qt4_header_files = Split('''
|
||||
QLog.h
|
||||
QLogDialog.h
|
||||
QLyXKeySym.h
|
||||
QMath.h
|
||||
QMathDialog.h
|
||||
QMathMatrixDialog.h
|
||||
QNomencl.h
|
||||
QNomenclDialog.h
|
||||
@ -925,8 +922,6 @@ src_frontends_qt4_files = Split('''
|
||||
QLog.C
|
||||
QLogDialog.C
|
||||
QLyXKeySym.C
|
||||
QMath.C
|
||||
QMathDialog.C
|
||||
QMathMatrixDialog.C
|
||||
QNomencl.C
|
||||
QNomenclDialog.C
|
||||
|
@ -274,7 +274,6 @@ Menuset
|
||||
Item "Split Environment|S" "command-sequence math-insert \split; tabular-feature append-column"
|
||||
Separator
|
||||
Submenu "Font Change|o" "insert_math_font"
|
||||
Item "Math Panel|l" "dialog-show mathpanel"
|
||||
End
|
||||
|
||||
Menu "insert_math_font"
|
||||
|
@ -135,7 +135,6 @@ ToolbarSet
|
||||
End
|
||||
|
||||
Toolbar "math" "Math"
|
||||
Item "Show math panel" "dialog-show mathpanel"
|
||||
Item "Set display mode" "math-display"
|
||||
Separator
|
||||
Item "Subscript" "math-subscript"
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "QCharacter.h"
|
||||
#include "QCitation.h"
|
||||
#include "QCitationDialog.h"
|
||||
#include "QDelimiterDialog.h"
|
||||
#include "QDocument.h"
|
||||
#include "QErrorList.h"
|
||||
#include "QERT.h"
|
||||
@ -63,11 +64,11 @@
|
||||
#include "QGraphics.h"
|
||||
#include "QInclude.h"
|
||||
#include "QIndex.h"
|
||||
#include "QMathMatrixDialog.h"
|
||||
#include "QNomencl.h"
|
||||
#include "QLog.h"
|
||||
#include "QViewSource.h"
|
||||
#include "QViewSourceDialog.h"
|
||||
#include "QMath.h"
|
||||
#include "QNote.h"
|
||||
#include "QParagraph.h"
|
||||
#include "QPrefs.h"
|
||||
@ -105,7 +106,7 @@ char const * const dialognames[] = {
|
||||
"aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character",
|
||||
"citation", "document", "errorlist", "ert", "external", "file",
|
||||
"findreplace", "float", "graphics", "include", "index", "nomenclature", "label", "log",
|
||||
"mathpanel", "mathdelimiter", "mathmatrix", "note", "paragraph",
|
||||
"mathdelimiter", "mathmatrix", "note", "paragraph",
|
||||
"prefs", "print", "ref", "sendto", "spellchecker","tabular", "tabularcreate",
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
@ -244,10 +245,6 @@ Dialogs::DialogPtr Dialogs::build(string const & name)
|
||||
dialog->setView(new DockView<QViewSource, QViewSourceDialog>(
|
||||
*dialog, qvs, &gui_view, _("LaTeX Source"), Qt::BottomDockWidgetArea));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
} else if (name == "mathpanel") {
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
dialog->setView(new QMath(*dialog));
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
} else if (name == "mathdelimiter") {
|
||||
dialog->setController(new ControlMath(*dialog));
|
||||
dialog->setView(new QMathDelimiter(*dialog));
|
||||
|
@ -64,7 +64,6 @@ libqt4_la_SOURCES = \
|
||||
QViewSource.C QViewSource.h \
|
||||
QLPainter.C QLPainter.h \
|
||||
QLyXKeySym.C QLyXKeySym.h \
|
||||
QMath.C QMath.h \
|
||||
QNomencl.C QNomencl.h \
|
||||
QNote.C QNote.h \
|
||||
QParagraph.C QParagraph.h \
|
||||
|
@ -35,7 +35,6 @@ UIFILES = \
|
||||
QIndexUi.ui \
|
||||
QLogUi.ui \
|
||||
QViewSourceUi.ui \
|
||||
QMathUi.ui \
|
||||
QMathMatrixUi.ui \
|
||||
QNomenclUi.ui \
|
||||
QNoteUi.ui \
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "QDelimiterDialog.h"
|
||||
|
||||
#include "GuiApplication.h"
|
||||
#include "QMath.h"
|
||||
|
||||
#include "qt_helpers.h"
|
||||
#include "controllers/ControlMath.h"
|
||||
@ -62,6 +61,19 @@ QString fix_name(QString const & str, bool big)
|
||||
} // namespace anon
|
||||
|
||||
|
||||
typedef QController<ControlMath, QView<QDelimiterDialog> > delimiter_base;
|
||||
|
||||
QMathDelimiter::QMathDelimiter(Dialog & parent)
|
||||
: delimiter_base(parent, _("Math Delimiter"))
|
||||
{}
|
||||
|
||||
|
||||
void QMathDelimiter::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QDelimiterDialog(this));
|
||||
}
|
||||
|
||||
|
||||
char_type QDelimiterDialog::doMatch(char_type const symbol) const
|
||||
{
|
||||
string const & str = form_->controller().texName(symbol);
|
||||
|
@ -12,6 +12,8 @@
|
||||
#ifndef QDELIMITERDIALOG_H
|
||||
#define QDELIMITERDIALOG_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
|
||||
#include "ui/QDelimiterUi.h"
|
||||
|
||||
#include <string>
|
||||
@ -21,6 +23,7 @@ class QListWidgetItem;
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlMath;
|
||||
class QMathDelimiter;
|
||||
|
||||
class QDelimiterDialog : public QDialog, public Ui::QDelimiterUi {
|
||||
@ -46,6 +49,21 @@ private:
|
||||
QString tex_code_;
|
||||
};
|
||||
|
||||
|
||||
class QMathDelimiter : public QController<ControlMath, QView<QDelimiterDialog> > {
|
||||
public:
|
||||
friend class QDelimiterDialog;
|
||||
|
||||
QMathDelimiter(Dialog &);
|
||||
|
||||
private:
|
||||
virtual void apply() {}
|
||||
virtual void update_contents() {}
|
||||
/// Build the dialog.
|
||||
virtual void build_dialog();
|
||||
};
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
|
@ -1,65 +0,0 @@
|
||||
/**
|
||||
* \file QMath.C
|
||||
* 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 "QMath.h"
|
||||
#include "QMathDialog.h"
|
||||
#include "QMathMatrixDialog.h"
|
||||
#include "QDelimiterDialog.h"
|
||||
|
||||
#include "gettext.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
typedef QController<ControlMath, QView<QMathDialog> > math_base;
|
||||
|
||||
|
||||
QMath::QMath(Dialog & parent)
|
||||
: math_base(parent, _("Math Panel"))
|
||||
{}
|
||||
|
||||
|
||||
void QMath::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QMathDialog(this));
|
||||
}
|
||||
|
||||
|
||||
typedef QController<ControlMath, QView<QMathMatrixDialog> > matrix_base;
|
||||
|
||||
|
||||
QMathMatrix::QMathMatrix(Dialog & parent)
|
||||
: matrix_base(parent, _("Math Matrix"))
|
||||
{}
|
||||
|
||||
|
||||
void QMathMatrix::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QMathMatrixDialog(this));
|
||||
}
|
||||
|
||||
|
||||
typedef QController<ControlMath, QView<QDelimiterDialog> > delimiter_base;
|
||||
|
||||
|
||||
QMathDelimiter::QMathDelimiter(Dialog & parent)
|
||||
: delimiter_base(parent, _("Math Delimiter"))
|
||||
{}
|
||||
|
||||
|
||||
void QMathDelimiter::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QDelimiterDialog(this));
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,69 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QMath.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 QMATH_H
|
||||
#define QMATH_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
#include "QDelimiterDialog.h"
|
||||
#include "QMathDialog.h"
|
||||
#include "QMathMatrixDialog.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlMath;
|
||||
|
||||
class QMath : public QController<ControlMath, QView<QMathDialog> > {
|
||||
public:
|
||||
friend class QMathDialog;
|
||||
|
||||
QMath(Dialog &);
|
||||
|
||||
private:
|
||||
virtual void apply() {}
|
||||
virtual void update_contents() {}
|
||||
/// Build the dialog.
|
||||
virtual void build_dialog();
|
||||
};
|
||||
|
||||
|
||||
class QMathMatrix : public QController<ControlMath, QView<QMathMatrixDialog> > {
|
||||
public:
|
||||
friend class QMathMatrixDialog;
|
||||
|
||||
QMathMatrix(Dialog &);
|
||||
|
||||
private:
|
||||
virtual void apply() {}
|
||||
virtual void update_contents() {}
|
||||
/// Build the dialog.
|
||||
virtual void build_dialog();
|
||||
};
|
||||
|
||||
|
||||
class QMathDelimiter : public QController<ControlMath, QView<QDelimiterDialog> > {
|
||||
public:
|
||||
friend class QDelimiterDialog;
|
||||
|
||||
QMathDelimiter(Dialog &);
|
||||
|
||||
private:
|
||||
virtual void apply() {}
|
||||
virtual void update_contents() {}
|
||||
/// Build the dialog.
|
||||
virtual void build_dialog();
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QMATH_H
|
@ -1,261 +0,0 @@
|
||||
/**
|
||||
* \file QMathDialog.C
|
||||
* 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 "QMathDialog.h"
|
||||
#include "QMath.h"
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QScrollArea>
|
||||
#include <QMenu>
|
||||
#include <QPushButton>
|
||||
#include <QListWidget>
|
||||
#include <QListWidgetItem>
|
||||
#include <QIcon>
|
||||
|
||||
#include "iconpalette.h"
|
||||
#include "qt_helpers.h"
|
||||
#include "controllers/ControlMath.h"
|
||||
|
||||
#include "support/filetools.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
using support::FileName;
|
||||
using support::libFileSearch;
|
||||
|
||||
namespace frontend {
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
char const ** panels[] = {
|
||||
latex_bop, latex_varsz, latex_brel, latex_greek, latex_arrow,
|
||||
latex_dots, latex_deco, latex_misc, latex_ams_ops,
|
||||
latex_ams_rel, latex_ams_nrel, latex_ams_arrows,
|
||||
latex_ams_misc
|
||||
};
|
||||
|
||||
int const nr_panels = sizeof(panels)/sizeof(panels[0]);
|
||||
|
||||
int panel_index[nr_panels];
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
QMathDialog::QMathDialog(QMath * form)
|
||||
: form_(form)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
// enlarge the symbols ComboBox (no scrollbar)
|
||||
//symbolsCO->setSizeLimit(13);
|
||||
|
||||
connect( tearoffPB, SIGNAL( clicked() ), this, SLOT( expandClicked() ) );
|
||||
connect( closePB, SIGNAL( clicked() ), this, SLOT( accept() ) );
|
||||
connect( superscriptPB, SIGNAL( clicked() ), this, SLOT( superscriptClicked() ) );
|
||||
connect( subscriptPB, SIGNAL( clicked() ), this, SLOT( subscriptClicked() ) );
|
||||
connect( delimitersPB, SIGNAL( clicked() ), this, SLOT( delimiterClicked() ) );
|
||||
connect( matrixPB, SIGNAL( clicked() ), this, SLOT( matrixClicked() ) );
|
||||
connect( functionsLW, SIGNAL( itemActivated(QListWidgetItem *) ), this, SLOT( functionSelected(QListWidgetItem *) ) );
|
||||
connect( equationPB, SIGNAL( clicked() ), this, SLOT( equationClicked() ) );
|
||||
connect( symbolsCO, SIGNAL(activated(int)), this, SLOT(showingPanel(int)));
|
||||
|
||||
FileName icon_path = libFileSearch("images/math", "sqrt-square", "xpm");
|
||||
sqrtPB->setIcon(QIcon(toqstr(icon_path.absFilename())));
|
||||
icon_path = libFileSearch("images/math", "space", "xpm");
|
||||
spacePB->setIcon(QIcon(toqstr(icon_path.absFilename())));
|
||||
icon_path = libFileSearch("images/math", "style", "xpm");
|
||||
stylePB->setIcon(QIcon(toqstr(icon_path.absFilename())));
|
||||
icon_path = libFileSearch("images/math", "font", "xpm");
|
||||
fontPB->setIcon(QIcon(toqstr(icon_path.absFilename())));
|
||||
icon_path = libFileSearch("images/math", "equation", "xpm");
|
||||
equationPB->setIcon(QIcon(toqstr(icon_path.absFilename())));
|
||||
icon_path = libFileSearch("images/math", "frac-square", "xpm");
|
||||
fracPB->setIcon(QIcon(toqstr(icon_path.absFilename())));
|
||||
icon_path = libFileSearch("images/math", "sub", "xpm");
|
||||
subscriptPB->setIcon(QIcon(toqstr(icon_path.absFilename())));
|
||||
icon_path = libFileSearch("images/math", "super", "xpm");
|
||||
superscriptPB->setIcon(QIcon(toqstr(icon_path.absFilename())));
|
||||
icon_path = libFileSearch("images/math", "matrix", "xpm");
|
||||
matrixPB->setIcon(QIcon(toqstr(icon_path.absFilename())));
|
||||
icon_path = libFileSearch("images/math", "delim", "xpm");
|
||||
delimitersPB->setIcon(QIcon(toqstr(icon_path.absFilename())));
|
||||
|
||||
// function list
|
||||
for (int i = 0; *function_names[i]; ++i) {
|
||||
functionsLW->addItem(function_names[i]);
|
||||
}
|
||||
//functionsLW->setFixedWidth(functionsLW->sizeHint().width());
|
||||
|
||||
// show first symbol panel
|
||||
showingPanel(0);
|
||||
|
||||
// add menu's to the buttons
|
||||
QMenu * m = new QMenu(spacePB);
|
||||
m->setTitle(qt_("LyX: Math Spacing"));
|
||||
m->setTearOffEnabled(true);
|
||||
addMenuItem(m, qt_("Thin space \\,"), ",");
|
||||
addMenuItem(m, qt_("Medium space \\:"), ":");
|
||||
addMenuItem(m, qt_("Thick space \\;"), ";");
|
||||
addMenuItem(m, qt_("Quadratin space \\quad"), "quad");
|
||||
addMenuItem(m, qt_("Double quadratin space \\qquad"), "qquad");
|
||||
addMenuItem(m, qt_("Negative space \\!"), "!");
|
||||
spacePB->setMenu(m);
|
||||
|
||||
m = new QMenu(sqrtPB);
|
||||
m->setTitle(qt_("LyX: Math Roots"));
|
||||
m->setTearOffEnabled(true);
|
||||
addMenuItem(m, qt_("Square root \\sqrt"), "sqrt");
|
||||
QAction * ma = new QAction(qt_("Cube root \\root"), this);
|
||||
connect(ma, SIGNAL(triggered()), this, SLOT(insertCubeRoot()));
|
||||
m->addAction(ma);
|
||||
addMenuItem(m, qt_("Other root \\root"), "root");
|
||||
sqrtPB->setMenu(m);
|
||||
|
||||
m = new QMenu(stylePB);
|
||||
m->setTitle(qt_("LyX: Math Styles"));
|
||||
m->setTearOffEnabled(true);
|
||||
addMenuItem(m, qt_("Display style \\displaystyle"), "displaystyle");
|
||||
addMenuItem(m, qt_("Normal text style \\textstyle"), "textstyle");
|
||||
addMenuItem(m, qt_("Script (small) style \\scriptstyle"), "scriptstyle");
|
||||
addMenuItem(m, qt_("Scriptscript (smaller) style \\scriptscriptstyle"), "scriptscriptstyle");
|
||||
stylePB->setMenu(m);
|
||||
|
||||
m = new QMenu(fracPB);
|
||||
m->setTitle(qt_("LyX: Fractions"));
|
||||
m->setTearOffEnabled(true);
|
||||
addMenuItem(m, qt_("Standard \\frac"), "frac");
|
||||
addMenuItem(m, qt_("No hor. line \\atop"), "atop");
|
||||
addMenuItem(m, qt_("Nice \\nicefrac"), "nicefrac");
|
||||
addMenuItem(m, qt_("Text frac (amsmath) \\tfrac"), "tfrac");
|
||||
addMenuItem(m, qt_("Display frac (amsmath) \\dfrac"), "dfrac");
|
||||
addMenuItem(m, qt_("Binomial \\choose"), "choose");
|
||||
fracPB->setMenu(m);
|
||||
|
||||
m = new QMenu(fontPB);
|
||||
m->setTitle(qt_("LyX: Math Fonts"));
|
||||
m->setTearOffEnabled(true);
|
||||
addMenuItem(m, qt_("Roman \\mathrm"), "mathrm");
|
||||
addMenuItem(m, qt_("Bold \\mathbf"), "mathbf");
|
||||
addMenuItem(m, qt_("Bold symbol \\boldsymbol"), "boldsymbol");
|
||||
addMenuItem(m, qt_("Sans serif \\mathsf"), "mathsf");
|
||||
addMenuItem(m, qt_("Italic \\mathit"), "mathit");
|
||||
addMenuItem(m, qt_("Typewriter \\mathtt"), "mathtt");
|
||||
addMenuItem(m, qt_("Blackboard \\mathbb"), "mathbb");
|
||||
addMenuItem(m, qt_("Fraktur \\mathfrak"), "mathfrak");
|
||||
addMenuItem(m, qt_("Calligraphic \\mathcal"), "mathcal");
|
||||
addMenuItem(m, qt_("Normal text mode \\textrm"), "textrm");
|
||||
fontPB->setMenu(m);
|
||||
}
|
||||
|
||||
void QMathDialog::addMenuItem(QMenu * menu, const QString & label, const std::string & action)
|
||||
{
|
||||
QMAction * ma = new QMAction(label,action, this);
|
||||
connect(ma, SIGNAL(action(const std::string &)), this, SLOT(symbol_clicked(const std::string &)));
|
||||
menu->addAction(ma);
|
||||
}
|
||||
|
||||
void QMathDialog::showingPanel(int num)
|
||||
{
|
||||
if (!panel_index[num])
|
||||
addPanel(num);
|
||||
|
||||
symbolWS->setCurrentIndex(panel_index[num]);
|
||||
}
|
||||
|
||||
|
||||
IconPalette * QMathDialog::makePanel(QWidget * parent, char const ** entries)
|
||||
{
|
||||
IconPalette * p = new IconPalette(parent, entries);
|
||||
// Leave these std:: qualifications alone !
|
||||
connect(p, SIGNAL(button_clicked(const std::string &)),
|
||||
this, SLOT(symbol_clicked(const std::string &)));
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
void QMathDialog::addPanel(int num)
|
||||
{
|
||||
QScrollArea * sc = new QScrollArea(symbolWS);
|
||||
IconPalette * p = makePanel(this, panels[num]);
|
||||
sc->setWidget(p);
|
||||
panel_index[num] = symbolWS->addWidget(sc);
|
||||
}
|
||||
|
||||
|
||||
void QMathDialog::symbol_clicked(const string & str)
|
||||
{
|
||||
form_->controller().dispatchInsert(str);
|
||||
}
|
||||
|
||||
|
||||
void QMathDialog::delimiterClicked()
|
||||
{
|
||||
form_->controller().showDialog("mathdelimiter");
|
||||
}
|
||||
|
||||
|
||||
void QMathDialog::expandClicked()
|
||||
{
|
||||
int const id = symbolsCO->currentIndex();
|
||||
IconPalette * p = makePanel(this, panels[id]);
|
||||
string s = "LyX: ";
|
||||
s += fromqstr(symbolsCO->currentText());
|
||||
p->setWindowTitle(toqstr(s));
|
||||
p->setWindowFlags(Qt::Dialog);
|
||||
p->show();
|
||||
}
|
||||
|
||||
|
||||
void QMathDialog::functionSelected(QListWidgetItem * item)
|
||||
{
|
||||
form_->controller().dispatchInsert(fromqstr(item->text()));
|
||||
}
|
||||
|
||||
|
||||
void QMathDialog::matrixClicked()
|
||||
{
|
||||
form_->controller().showDialog("mathmatrix");
|
||||
}
|
||||
|
||||
|
||||
void QMathDialog::equationClicked()
|
||||
{
|
||||
form_->controller().dispatchToggleDisplay();
|
||||
}
|
||||
|
||||
|
||||
void QMathDialog::subscriptClicked()
|
||||
{
|
||||
form_->controller().dispatchSubscript();
|
||||
}
|
||||
|
||||
|
||||
void QMathDialog::superscriptClicked()
|
||||
{
|
||||
form_->controller().dispatchSuperscript();
|
||||
}
|
||||
|
||||
|
||||
void QMathDialog::insertCubeRoot()
|
||||
{
|
||||
form_->controller().dispatchCubeRoot();
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QMathDialog_moc.cpp"
|
@ -1,83 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QMathDialog.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 QMATHDIALOG_H
|
||||
#define QMATHDIALOG_H
|
||||
|
||||
#include "ui/QMathUi.h"
|
||||
#include <string>
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class QListWidgetItem;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class IconPalette;
|
||||
|
||||
class QMAction : public QAction {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QMAction( const QString & text, const std::string & action, QObject * parent)
|
||||
: QAction(text,parent), action_(action) {
|
||||
connect(this, SIGNAL(triggered()), this, SLOT(action()));
|
||||
}
|
||||
Q_SIGNALS:
|
||||
void action(const std::string &);
|
||||
protected Q_SLOTS:
|
||||
void action() {
|
||||
// emit signal
|
||||
action(action_);
|
||||
}
|
||||
private:
|
||||
std::string action_;
|
||||
};
|
||||
|
||||
|
||||
class QMath;
|
||||
|
||||
class QMathDialog : public QDialog, public Ui::QMathUi
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QMathDialog(QMath * form);
|
||||
public Q_SLOTS:
|
||||
virtual void delimiterClicked();
|
||||
virtual void expandClicked();
|
||||
virtual void functionSelected(QListWidgetItem *);
|
||||
virtual void matrixClicked();
|
||||
virtual void subscriptClicked();
|
||||
virtual void superscriptClicked();
|
||||
virtual void equationClicked();
|
||||
void symbol_clicked(const std::string &);
|
||||
void insertCubeRoot();
|
||||
|
||||
/// about to show a symbol panel
|
||||
void showingPanel(int);
|
||||
protected:
|
||||
//needed ? virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
/// add item to popup menu
|
||||
void addMenuItem(QMenu * menu, const QString & label, const std::string &);
|
||||
/// make a symbol panel
|
||||
IconPalette * makePanel(QWidget * parent, char const ** entries);
|
||||
/// add a symbol panel
|
||||
void addPanel(int num);
|
||||
|
||||
/// owning form
|
||||
QMath * form_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QMATHDIALOG_H
|
@ -11,7 +11,6 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "QMathMatrixDialog.h"
|
||||
#include "QMath.h"
|
||||
|
||||
#include "emptytable.h"
|
||||
#include "qt_helpers.h"
|
||||
@ -24,6 +23,8 @@
|
||||
#include <qpushbutton.h>
|
||||
#include <qspinbox.h>
|
||||
|
||||
#include "gettext.h"
|
||||
|
||||
using std::ostringstream;
|
||||
using std::string;
|
||||
|
||||
@ -38,6 +39,20 @@ char v_align_c[] = "tcb";
|
||||
} // namespace anon
|
||||
|
||||
|
||||
typedef QController<ControlMath, QView<QMathMatrixDialog> > matrix_base;
|
||||
|
||||
|
||||
QMathMatrix::QMathMatrix(Dialog & parent)
|
||||
: matrix_base(parent, _("Math Matrix"))
|
||||
{}
|
||||
|
||||
|
||||
void QMathMatrix::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QMathMatrixDialog(this));
|
||||
}
|
||||
|
||||
|
||||
QMathMatrixDialog::QMathMatrixDialog(QMathMatrix * form)
|
||||
: form_(form)
|
||||
{
|
||||
|
@ -14,6 +14,8 @@
|
||||
#ifndef QMATHMATRIXDIALOG_H
|
||||
#define QMATHMATRIXDIALOG_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
|
||||
#include "ui/QMathMatrixUi.h"
|
||||
|
||||
#include <QDialog>
|
||||
@ -22,6 +24,8 @@ namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QMathMatrix;
|
||||
class ControlMath;
|
||||
|
||||
|
||||
class QMathMatrixDialog : public QDialog, public Ui::QMathMatrixUi {
|
||||
Q_OBJECT
|
||||
@ -38,6 +42,21 @@ private:
|
||||
QMathMatrix * form_;
|
||||
};
|
||||
|
||||
|
||||
class QMathMatrix : public QController<ControlMath, QView<QMathMatrixDialog> > {
|
||||
public:
|
||||
friend class QMathMatrixDialog;
|
||||
|
||||
QMathMatrix(Dialog &);
|
||||
|
||||
private:
|
||||
virtual void apply() {}
|
||||
virtual void update_contents() {}
|
||||
/// Build the dialog.
|
||||
virtual void build_dialog();
|
||||
};
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
|
@ -1,475 +0,0 @@
|
||||
<ui version="4.0" >
|
||||
<class>QMathUi</class>
|
||||
<widget class="QDialog" name="QMathUi" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>403</width>
|
||||
<height>368</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="sizeGripEnabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="3" column="2" colspan="3" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="3" colspan="3" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>153</width>
|
||||
<height>51</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="5" >
|
||||
<widget class="QPushButton" name="closePB" >
|
||||
<property name="text" >
|
||||
<string>&Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" >
|
||||
<widget class="QPushButton" name="tearoffPB" >
|
||||
<property name="toolTip" >
|
||||
<string>Open this panel as a separate window</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Detach panel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4" colspan="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>95</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="2" >
|
||||
<widget class="QComboBox" name="symbolsCO" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>3</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Select a page of symbols</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Operators</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Big operators</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Relations</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Greek</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Arrows</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Dots</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Frame decorations</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Miscellaneous</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>AMS operators</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>AMS relations</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>AMS negated relations</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>AMS arrows</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>AMS Miscellaneous</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item rowspan="2" row="1" column="1" >
|
||||
<widget class="QListWidget" name="functionsLW" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>500</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alternatingRowColors" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLabel" name="functionsLA" >
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Functions</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>functionsLW</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="4" >
|
||||
<widget class="QStackedWidget" name="symbolWS" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page" />
|
||||
<widget class="QWidget" name="page_2" />
|
||||
</widget>
|
||||
</item>
|
||||
<item rowspan="3" row="0" column="0" >
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="sqrtPB" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>35</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Insert root</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset>../../../../lib/images/math/sqrt-square.xpm</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="spacePB" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>35</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Insert spacing</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset>../../../../lib/images/math/space.xpm</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="stylePB" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>35</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Set limits style</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset>../../../../lib/images/math/style.xpm</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="fontPB" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>35</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Set math font</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset>../../../../lib/images/math/font.xpm</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="fracPB" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>35</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Insert fraction</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset>../../../../lib/images/math/frac-square.xpm</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="equationPB" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>1</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Toggle between display and inline mode</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset>../../../../lib/images/math/equation.xpm</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="subscriptPB" >
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Subscript</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset>../../../../lib/images/math/sub.xpm</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="superscriptPB" >
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Superscript</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset>../../../../lib/images/math/super.xpm</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="matrixPB" >
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Insert matrix</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset>../../../../lib/images/math/matrix.xpm</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="delimitersPB" >
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>25</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Show delimiter and bracket dialog</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset>../../../../lib/images/math/delim.xpm</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>symbolsCO</tabstop>
|
||||
<tabstop>sqrtPB</tabstop>
|
||||
<tabstop>spacePB</tabstop>
|
||||
<tabstop>stylePB</tabstop>
|
||||
<tabstop>fontPB</tabstop>
|
||||
<tabstop>fracPB</tabstop>
|
||||
<tabstop>equationPB</tabstop>
|
||||
<tabstop>subscriptPB</tabstop>
|
||||
<tabstop>superscriptPB</tabstop>
|
||||
<tabstop>matrixPB</tabstop>
|
||||
<tabstop>delimitersPB</tabstop>
|
||||
<tabstop>functionsLW</tabstop>
|
||||
<tabstop>tearoffPB</tabstop>
|
||||
<tabstop>closePB</tabstop>
|
||||
</tabstops>
|
||||
<includes>
|
||||
<include location="local" >qt_helpers.h</include>
|
||||
</includes>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -31,7 +31,6 @@ uic QDelimiterUi.ui -o QDelimiterUi.h
|
||||
uic QDocumentUi.ui -o QDocumentUi.h
|
||||
uic QExternalUi.ui -o QExternalUi.h
|
||||
uic QIncludeUi.ui -o QIncludeUi.h
|
||||
uic QMathUi.ui -o QMathUi.h
|
||||
uic QParagraphUi.ui -o QParagraphUi.h
|
||||
uic QPrefConvertersUi.ui -o QPrefConvertersUi.h
|
||||
uic QPrefDateUi.ui -o QPrefDateUi.h
|
||||
|
@ -555,7 +555,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
else if (name == "print")
|
||||
enable = Exporter::isExportable(*buf, "dvi")
|
||||
&& lyxrc.print_command != "none";
|
||||
else if (name == "character" || name == "mathpanel")
|
||||
else if (name == "character")
|
||||
enable = cur.inset().lyxCode() != InsetBase::ERT_CODE;
|
||||
else if (name == "latexlog")
|
||||
enable = isFileReadable(FileName(buf->getLogName().second));
|
||||
|
@ -1202,12 +1202,6 @@ void InsetMathNest::lfunMouseRelease(LCursor & cur, FuncRequest & cmd)
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd.button() == mouse_button::button3) {
|
||||
// try to dispatch to enclosed insets first
|
||||
cur.bv().showDialog("mathpanel");
|
||||
return;
|
||||
}
|
||||
|
||||
cur.undispatched();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user