2002-08-30 16:20:27 +00:00
|
|
|
/**
|
|
|
|
* \file QMath.C
|
2002-09-24 13:57:09 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-08-30 16:20:27 +00:00
|
|
|
*
|
2002-10-20 01:48:28 +00:00
|
|
|
* \author John Levon
|
2002-09-24 13:57:09 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2002-08-30 16:20:27 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "debug.h"
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-08-30 16:20:27 +00:00
|
|
|
#include "commandtags.h"
|
|
|
|
#include "funcrequest.h"
|
|
|
|
#include "LyXView.h"
|
|
|
|
#include "BufferView.h"
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-08-30 16:20:27 +00:00
|
|
|
#include "QMathDialog.h"
|
|
|
|
#include "QMath.h"
|
|
|
|
|
|
|
|
#include "iconpalette.h"
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
// needless to say, this can't last for long
|
|
|
|
extern BufferView * current_view;
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME temporary HACK !
|
2002-08-30 16:20:27 +00:00
|
|
|
void createMathPanel()
|
|
|
|
{
|
2002-10-20 01:48:28 +00:00
|
|
|
static QMath * dialog = 0;
|
2002-08-30 16:20:27 +00:00
|
|
|
if (!dialog) {
|
2002-10-20 01:48:28 +00:00
|
|
|
dialog = new QMath;
|
2002-08-30 16:20:27 +00:00
|
|
|
dialog->build_dialog();
|
|
|
|
}
|
|
|
|
dialog->do_show();
|
|
|
|
}
|
2002-10-20 01:48:28 +00:00
|
|
|
|
|
|
|
|
2002-08-30 16:20:27 +00:00
|
|
|
QMath::QMath()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QMath::do_show()
|
|
|
|
{
|
|
|
|
dialog_->show();
|
|
|
|
}
|
2002-10-20 01:48:28 +00:00
|
|
|
|
|
|
|
|
2002-08-30 16:20:27 +00:00
|
|
|
void QMath::build_dialog()
|
|
|
|
{
|
|
|
|
dialog_ = new QMathDialog(this);
|
|
|
|
}
|
|
|
|
|
2002-09-06 01:44:02 +00:00
|
|
|
|
|
|
|
void QMath::subscript()
|
|
|
|
{
|
|
|
|
current_view->owner()->dispatch(FuncRequest(LFUN_SUBSCRIPT));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QMath::superscript()
|
2002-08-30 16:20:27 +00:00
|
|
|
{
|
2002-09-06 01:44:02 +00:00
|
|
|
current_view->owner()->dispatch(FuncRequest(LFUN_SUPERSCRIPT));
|
|
|
|
}
|
|
|
|
|
2002-08-30 16:20:27 +00:00
|
|
|
|
2002-09-14 20:16:14 +00:00
|
|
|
void QMath::insert(string const & name)
|
2002-09-06 01:44:02 +00:00
|
|
|
{
|
2002-08-30 16:20:27 +00:00
|
|
|
current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATH, '\\' + name));
|
|
|
|
}
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-09-14 03:27:07 +00:00
|
|
|
|
|
|
|
void QMath::insertCubeRoot()
|
|
|
|
{
|
|
|
|
current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATH, "\\root"));
|
|
|
|
current_view->owner()->dispatch(FuncRequest(LFUN_SELFINSERT, "3"));
|
|
|
|
current_view->owner()->dispatch(FuncRequest(LFUN_RIGHT));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-10-28 16:43:58 +00:00
|
|
|
void QMath::insertMatrix(string const & str)
|
2002-09-14 20:16:14 +00:00
|
|
|
{
|
2002-10-28 16:43:58 +00:00
|
|
|
current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATRIX, str));
|
2002-09-14 20:16:14 +00:00
|
|
|
}
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-09-14 23:59:19 +00:00
|
|
|
void QMath::insertDelim(string const & str)
|
|
|
|
{
|
|
|
|
current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DELIM, str));
|
|
|
|
}
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-09-14 03:27:07 +00:00
|
|
|
void QMath::toggleDisplay()
|
|
|
|
{
|
|
|
|
current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DISPLAY));
|
|
|
|
}
|