2002-08-30 16:20:27 +00:00
|
|
|
/**
|
|
|
|
* \file QMathDialog.C
|
|
|
|
* Copyright 2001 the LyX Team
|
|
|
|
* Read the file COPYING
|
|
|
|
*
|
|
|
|
* \author John Levon <moz@compsoc.man.ac.uk>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "support/filetools.h"
|
2002-09-06 01:44:02 +00:00
|
|
|
#include "debug.h"
|
2002-08-30 16:20:27 +00:00
|
|
|
|
|
|
|
#include "QMathDialog.h"
|
|
|
|
#include "QMath.h"
|
|
|
|
|
|
|
|
#include "ControlMath.h"
|
|
|
|
#include "iconpalette.h"
|
|
|
|
|
|
|
|
#include <qwidgetstack.h>
|
|
|
|
#include <qcombobox.h>
|
|
|
|
#include <qlistbox.h>
|
|
|
|
#include <qpixmap.h>
|
2002-09-06 01:44:02 +00:00
|
|
|
#include <qscrollview.h>
|
|
|
|
#include <qlayout.h>
|
2002-08-30 16:20:27 +00:00
|
|
|
|
|
|
|
QMathDialog::QMathDialog(QMath * form)
|
|
|
|
: QMathDialogBase(0, 0, false, 0),
|
|
|
|
form_(form)
|
|
|
|
{
|
|
|
|
connect(symbolsCO, SIGNAL(activated(int)), symbolsWS, SLOT(raiseWidget(int)));
|
|
|
|
|
|
|
|
for (int i = 0; *function_names[i]; ++i) {
|
|
|
|
functionsLB->insertItem(function_names[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
addPanel("operators", latex_bop);
|
|
|
|
addPanel("bigoperators", latex_varsz);
|
|
|
|
addPanel("relations", latex_brel);
|
|
|
|
addPanel("greek", latex_greek);
|
|
|
|
addPanel("arrows", latex_arrow);
|
2002-09-06 01:44:02 +00:00
|
|
|
addPanel("dots", latex_dots);
|
2002-08-30 16:20:27 +00:00
|
|
|
addPanel("misc", latex_misc);
|
|
|
|
addPanel("amsoperators", latex_ams_ops);
|
|
|
|
addPanel("amsrelations", latex_ams_rel);
|
|
|
|
addPanel("amsnegrelations", latex_ams_nrel);
|
|
|
|
addPanel("amsarrows", latex_ams_arrows);
|
|
|
|
addPanel("amsmisc", latex_ams_misc);
|
|
|
|
symbolsWS->raiseWidget(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QMathDialog::addPanel(string const & name, char const ** entries)
|
|
|
|
{
|
|
|
|
static int id = 0;
|
|
|
|
|
2002-09-06 01:44:02 +00:00
|
|
|
QScrollView * view = new QScrollView(symbolsWS);
|
|
|
|
view->setHScrollBarMode(QScrollView::AlwaysOff);
|
|
|
|
view->setVScrollBarMode(QScrollView::AlwaysOn);
|
|
|
|
|
|
|
|
IconPalette * p = new IconPalette(view->viewport(), name.c_str());
|
|
|
|
view->addChild(p);
|
2002-08-30 16:20:27 +00:00
|
|
|
for (int i = 0; *entries[i]; ++i) {
|
|
|
|
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)));
|
2002-09-06 01:44:02 +00:00
|
|
|
|
|
|
|
symbolsWS->addWidget(view, id++);
|
2002-08-30 16:20:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QMathDialog::symbol_clicked(string str)
|
|
|
|
{
|
|
|
|
form_->insert_symbol(str);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QMathDialog::fracClicked()
|
|
|
|
{
|
|
|
|
form_->insert_symbol("frac");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QMathDialog::sqrtClicked()
|
|
|
|
{
|
|
|
|
form_->insert_symbol("sqrt");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QMathDialog::decoClicked()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QMathDialog::delimiterClicked()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QMathDialog::expandClicked()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QMathDialog::functionSelected(const QString & str)
|
|
|
|
{
|
|
|
|
form_->insert_symbol(str.latin1());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QMathDialog::matrixClicked()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QMathDialog::equationClicked()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QMathDialog::spaceClicked()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QMathDialog::styleClicked()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QMathDialog::subscriptClicked()
|
|
|
|
{
|
2002-09-06 01:44:02 +00:00
|
|
|
form_->subscript();
|
2002-08-30 16:20:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QMathDialog::superscriptClicked()
|
|
|
|
{
|
2002-09-06 01:44:02 +00:00
|
|
|
form_->superscript();
|
2002-08-30 16:20:27 +00:00
|
|
|
}
|