2002-08-30 16:20:27 +00:00
|
|
|
/**
|
|
|
|
* \file QMath.C
|
|
|
|
* Copyright 2001 the LyX Team
|
|
|
|
* Read the file COPYING
|
|
|
|
*
|
|
|
|
* \author John Levon <moz@compsoc.man.ac.uk>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
#include "commandtags.h"
|
|
|
|
#include "funcrequest.h"
|
|
|
|
#include "LyXView.h"
|
|
|
|
#include "BufferView.h"
|
|
|
|
|
|
|
|
#include "QMathDialog.h"
|
|
|
|
#include "QMath.h"
|
|
|
|
|
|
|
|
#include "iconpalette.h"
|
|
|
|
|
|
|
|
// FIXME temporary HACK !
|
|
|
|
void createMathPanel()
|
|
|
|
{
|
|
|
|
static QMath * dialog = 0;
|
|
|
|
if (!dialog) {
|
|
|
|
dialog = new QMath();
|
|
|
|
dialog->build_dialog();
|
|
|
|
}
|
|
|
|
dialog->do_show();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QMath::QMath()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QMath::do_show()
|
|
|
|
{
|
|
|
|
dialog_->show();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QMath::build_dialog()
|
|
|
|
{
|
|
|
|
dialog_ = new QMathDialog(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-09-06 01:44:02 +00:00
|
|
|
// needless to say, this can't last for long
|
|
|
|
extern BufferView * current_view;
|
|
|
|
|
|
|
|
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-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-09-14 20:16:14 +00:00
|
|
|
void QMath::insertMatrix()
|
|
|
|
{
|
|
|
|
current_view->owner()->dispatch(FuncRequest(LFUN_INSERT_MATRIX, "2 2"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-09-14 23:59:19 +00:00
|
|
|
void QMath::insertDelim(string const & str)
|
|
|
|
{
|
|
|
|
current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DELIM, str));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-09-14 03:27:07 +00:00
|
|
|
void QMath::toggleDisplay()
|
|
|
|
{
|
|
|
|
current_view->owner()->dispatch(FuncRequest(LFUN_MATH_DISPLAY));
|
|
|
|
}
|