2001-06-13 14:33:31 +00:00
|
|
|
// -*- C++ -*-
|
2001-03-16 12:08:14 +00:00
|
|
|
/**
|
2007-10-07 20:34:09 +00:00
|
|
|
* \file GuiMath.h
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-03-16 12:08:14 +00:00
|
|
|
*
|
2002-11-25 18:58:15 +00:00
|
|
|
* \author Angus Leeming
|
2002-09-05 14:10:50 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2001-03-16 12:08:14 +00:00
|
|
|
*/
|
|
|
|
|
2007-10-07 20:34:09 +00:00
|
|
|
#ifndef GUIMATH_H
|
|
|
|
#define GUIMATH_H
|
2002-11-25 18:58:15 +00:00
|
|
|
|
2007-10-07 20:34:09 +00:00
|
|
|
#include "GuiDialog.h"
|
2003-06-17 12:53:35 +00:00
|
|
|
#include "lfuns.h" // for kb_action
|
2007-04-29 18:17:15 +00:00
|
|
|
#include "Font.h"
|
2002-11-25 18:58:15 +00:00
|
|
|
|
2007-04-06 15:57:32 +00:00
|
|
|
#include <map>
|
|
|
|
|
2007-10-04 17:35:27 +00:00
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
2002-11-25 18:58:15 +00:00
|
|
|
|
2007-04-12 16:49:01 +00:00
|
|
|
struct MathSymbol {
|
|
|
|
MathSymbol(char_type uc = '?', unsigned char fc = 0,
|
2007-04-29 18:17:15 +00:00
|
|
|
Font::FONT_FAMILY ff = Font::SYMBOL_FAMILY)
|
2007-04-12 16:49:01 +00:00
|
|
|
: unicode(uc), fontcode(fc), fontfamily(ff)
|
|
|
|
{}
|
|
|
|
char_type unicode;
|
|
|
|
unsigned char fontcode;
|
2007-04-29 18:17:15 +00:00
|
|
|
Font::FONT_FAMILY fontfamily;
|
2007-04-12 16:49:01 +00:00
|
|
|
};
|
|
|
|
|
2007-10-04 17:35:27 +00:00
|
|
|
|
2007-10-09 19:34:27 +00:00
|
|
|
class GuiMath : public GuiDialog
|
2007-10-07 20:34:09 +00:00
|
|
|
{
|
2002-11-25 18:58:15 +00:00
|
|
|
public:
|
2007-10-07 20:34:09 +00:00
|
|
|
GuiMath(LyXView & lv, std::string const & name);
|
2002-11-25 18:58:15 +00:00
|
|
|
|
2003-07-17 15:35:42 +00:00
|
|
|
/// Nothing to initialise in this case.
|
2007-10-07 20:34:09 +00:00
|
|
|
bool initialiseParams(std::string const &) { return true; }
|
|
|
|
void clearParams() {}
|
|
|
|
void dispatchParams() {}
|
|
|
|
bool isBufferDependent() const { return true; }
|
|
|
|
|
2003-06-17 12:53:35 +00:00
|
|
|
/// dispatch an LFUN
|
2007-10-07 20:34:09 +00:00
|
|
|
void dispatchFunc(kb_action action,
|
|
|
|
std::string const & arg = std::string()) const;
|
2003-06-17 12:53:35 +00:00
|
|
|
/// Insert a math symbol into the doc.
|
2003-10-06 15:43:21 +00:00
|
|
|
void dispatchInsert(std::string const & name) const;
|
2003-06-17 12:53:35 +00:00
|
|
|
/// Insert a subscript.
|
|
|
|
void dispatchSubscript() const;
|
|
|
|
/// Insert a superscript.
|
|
|
|
void dispatchSuperscript() const;
|
|
|
|
/// Insert a cube root
|
|
|
|
void dispatchCubeRoot() const;
|
|
|
|
/// Insert a matrix
|
2003-10-06 15:43:21 +00:00
|
|
|
void dispatchMatrix(std::string const & str) const;
|
2006-05-07 10:51:19 +00:00
|
|
|
/// Insert a variable size delimiter
|
2003-10-06 15:43:21 +00:00
|
|
|
void dispatchDelim(std::string const & str) const;
|
2006-05-07 10:51:19 +00:00
|
|
|
/// Insert a big delimiter
|
|
|
|
void dispatchBigDelim(std::string const & str) const;
|
|
|
|
/// Switch between display and inline
|
2003-06-17 12:53:35 +00:00
|
|
|
void dispatchToggleDisplay() const;
|
2003-07-17 15:35:42 +00:00
|
|
|
/** A request to the kernel to launch a dialog.
|
|
|
|
* \param name the dialog identifier.
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
void showDialog(std::string const & name) const;
|
2007-04-06 15:57:32 +00:00
|
|
|
|
|
|
|
/// \return the math unicode symbol associated to a TeX name.
|
2007-04-12 16:49:01 +00:00
|
|
|
MathSymbol const & mathSymbol(std::string tex_name) const;
|
2007-04-06 15:57:32 +00:00
|
|
|
/// \return the TeX name associated to a math unicode symbol.
|
|
|
|
std::string const & texName(char_type math_symbol) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
/// TeX-name / Math-symbol map.
|
2007-04-12 16:49:01 +00:00
|
|
|
std::map<std::string, MathSymbol> math_symbols_;
|
2007-04-06 15:57:32 +00:00
|
|
|
/// Math-symbol / TeX-name map.
|
|
|
|
/// This one is for fast search, it contains the same data as
|
|
|
|
/// \c math_symbols_.
|
|
|
|
std::map<char_type, std::string> tex_names_;
|
2002-11-25 18:58:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
2007-10-07 20:34:09 +00:00
|
|
|
#endif // GUIMATH_H
|