2001-06-25 00:06:33 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/*
|
2001-07-06 12:09:32 +00:00
|
|
|
|
* File: formulabase.h
|
|
|
|
|
* Purpose: Common parts of the math LyX insets
|
|
|
|
|
* Author: Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
* Created: May 2001
|
2001-06-25 00:06:33 +00:00
|
|
|
|
* Description: Allows the edition of math paragraphs inside Lyx.
|
|
|
|
|
*
|
2001-07-06 12:09:32 +00:00
|
|
|
|
* Copyright: 2001, The LyX Project
|
2001-06-25 00:06:33 +00:00
|
|
|
|
*
|
|
|
|
|
* You are free to use and modify this code under the terms of
|
|
|
|
|
* the GNU General Public Licence version 2 or later.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef INSET_FORMULABASE_H
|
|
|
|
|
#define INSET_FORMULABASE_H
|
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma interface
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <iosfwd>
|
|
|
|
|
#include "insets/inset.h"
|
2001-10-22 15:37:49 +00:00
|
|
|
|
#include "lyxfont.h"
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
2001-08-01 13:28:45 +00:00
|
|
|
|
// only for getType():
|
|
|
|
|
#include "math_defs.h"
|
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
class Buffer;
|
2001-07-06 12:09:32 +00:00
|
|
|
|
class BufferView;
|
2001-10-12 12:02:49 +00:00
|
|
|
|
class MathAtom;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
class InsetFormulaBase : public UpdatableInset {
|
|
|
|
|
public:
|
|
|
|
|
///
|
2001-08-03 09:54:48 +00:00
|
|
|
|
InsetFormulaBase();
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
|
|
|
|
virtual int ascent(BufferView *, LyXFont const &) const = 0;
|
|
|
|
|
///
|
|
|
|
|
virtual int descent(BufferView *, LyXFont const &) const = 0;
|
|
|
|
|
///
|
|
|
|
|
virtual int width(BufferView *, LyXFont const &) const = 0;
|
|
|
|
|
///
|
|
|
|
|
virtual void draw(BufferView *,LyXFont const &, int, float &, bool) const = 0;
|
2001-08-01 13:28:45 +00:00
|
|
|
|
///
|
|
|
|
|
virtual MathInsetTypes getType() const = 0;
|
2001-10-24 09:16:06 +00:00
|
|
|
|
/// upper y coordinate
|
|
|
|
|
virtual int upperY() const;
|
|
|
|
|
/// lower y coordinate
|
|
|
|
|
virtual int lowerY() const;
|
2001-07-06 12:09:32 +00:00
|
|
|
|
|
|
|
|
|
public:
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void validate(LaTeXFeatures &) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-07-06 15:57:54 +00:00
|
|
|
|
virtual Inset * clone(Buffer const &, bool same_id = false) const = 0;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual Inset::Code lyxCode() const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
/// what appears in the minibuffer when opening
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual string const editMessage() const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void edit(BufferView *, int x, int y, unsigned int button);
|
2001-08-15 05:50:39 +00:00
|
|
|
|
///
|
2001-07-20 14:18:48 +00:00
|
|
|
|
virtual void edit(BufferView *, bool front = true);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void toggleInsetCursor(BufferView *);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void showInsetCursor(BufferView *, bool show = true);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void hideInsetCursor(BufferView *);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void getCursorPos(BufferView *, int &, int &) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void toggleInsetSelection(BufferView * bv);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void insetButtonPress(BufferView *, int x, int y, int button);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void insetButtonRelease(BufferView *, int x, int y, int button);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void insetKeyPress(XKeyEvent * ev);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void insetMotionNotify(BufferView *, int x, int y, int state);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual void insetUnlock(BufferView *);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
2001-07-06 12:09:32 +00:00
|
|
|
|
/// To allow transparent use of math editing functions
|
2001-06-28 10:25:20 +00:00
|
|
|
|
virtual RESULT localDispatch(BufferView *, kb_action, string const &);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
virtual std::vector<string> const getLabelList() const;
|
|
|
|
|
///
|
2001-10-12 12:02:49 +00:00
|
|
|
|
virtual MathAtom const & par() const = 0;
|
|
|
|
|
///
|
|
|
|
|
virtual MathAtom & par() = 0;
|
2001-07-16 15:53:25 +00:00
|
|
|
|
///
|
2001-10-22 15:37:49 +00:00
|
|
|
|
virtual void metrics(BufferView * bv = 0, LyXFont const & font = LyXFont()) const;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
///
|
2001-07-17 09:46:07 +00:00
|
|
|
|
virtual void updateLocal(BufferView * bv, bool mark_dirty);
|
2001-10-24 09:16:06 +00:00
|
|
|
|
///
|
|
|
|
|
int xo() const { return xo_; }
|
|
|
|
|
///
|
|
|
|
|
int yo() const { return yo_; }
|
2001-08-01 09:18:21 +00:00
|
|
|
|
private:
|
|
|
|
|
/// unimplemented
|
|
|
|
|
void operator=(const InsetFormulaBase &);
|
2001-10-19 11:25:48 +00:00
|
|
|
|
///
|
|
|
|
|
mutable BufferView * view_;
|
|
|
|
|
///
|
2001-10-22 15:37:49 +00:00
|
|
|
|
mutable LyXFont font_;
|
2001-10-24 09:16:06 +00:00
|
|
|
|
protected:
|
|
|
|
|
///
|
|
|
|
|
mutable int xo_;
|
|
|
|
|
///
|
|
|
|
|
mutable int yo_;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
};
|
|
|
|
|
|
2001-07-06 12:09:32 +00:00
|
|
|
|
// We don't really mess want around with mathed stuff outside mathed.
|
|
|
|
|
// So do it here.
|
|
|
|
|
//
|
|
|
|
|
void mathDispatchCreation(BufferView *, string const &, bool);
|
|
|
|
|
//
|
|
|
|
|
void mathDispatchMathDisplay(BufferView *, string const &);
|
|
|
|
|
//
|
|
|
|
|
void mathDispatchMathMode(BufferView *, string const &);
|
|
|
|
|
//
|
|
|
|
|
void mathDispatchMathMacro(BufferView *, string const &);
|
|
|
|
|
//
|
|
|
|
|
void mathDispatchMathDelim(BufferView *, string const &);
|
|
|
|
|
//
|
|
|
|
|
void mathDispatchInsertMath(BufferView *, string const &);
|
|
|
|
|
//
|
|
|
|
|
void mathDispatchInsertMatrix(BufferView *, string const &);
|
|
|
|
|
//
|
2001-08-30 09:35:11 +00:00
|
|
|
|
void mathDispatchGreek(BufferView *, string const &);
|
|
|
|
|
//
|
2001-07-06 12:09:32 +00:00
|
|
|
|
void mathDispatchMathImportSelection(BufferView *, string const &);
|
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
#endif
|