1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich
7 * Copyright 1995-1999 The LyX Team.
9 * ====================================================== */
14 #pragma implementation "lyxinset.h"
19 #include "BufferView.h"
20 #include "support/lstrings.h"
23 /* Insets default methods */
25 bool Inset::Deletable() const
31 bool Inset::DirectWrite() const
37 Inset::EDITABLE Inset::Editable() const
43 void Inset::Validate(LaTeXFeatures &) const
48 bool Inset::AutoDelete() const
54 void Inset::Edit(BufferView *, int, int, unsigned int)
59 LyXFont Inset::ConvertFont(LyXFont font)
65 /* some stuff for inset locking */
67 void UpdatableInset::InsetButtonPress(BufferView *, int x, int y, int button)
69 lyxerr.debug() << "Inset Button Press x=" << x
70 << ", y=" << y << ", button=" << button << endl;
74 void UpdatableInset::InsetButtonRelease(BufferView *, int x, int y, int button)
76 lyxerr.debug() << "Inset Button Release x=" << x
77 << ", y=" << y << ", button=" << button << endl;
81 void UpdatableInset::InsetKeyPress(XKeyEvent *)
83 lyxerr.debug() << "Inset Keypress" << endl;
87 void UpdatableInset::InsetMotionNotify(BufferView *, int x, int y, int state)
89 lyxerr.debug() << "Inset Motion Notify x=" << x
90 << ", y=" << y << ", state=" << state << endl;
94 void UpdatableInset::InsetUnlock(BufferView *)
96 lyxerr.debug() << "Inset Unlock" << endl;
100 // An updatable inset is highly editable by definition
101 Inset::EDITABLE UpdatableInset::Editable() const
103 return HIGHLY_EDITABLE;
107 void UpdatableInset::ToggleInsetCursor(BufferView *)
112 void UpdatableInset::Edit(BufferView * bv, int, int, unsigned int)
118 mx_scx=abs((width(bv->getPainter(), font) - bv->paperWidth()) / 2);
122 void UpdatableInset::draw(Painter &, LyXFont const &,
123 int baseline, float & x) const
125 if (scx) x += float(scx);
127 top_baseline = baseline;
131 void UpdatableInset::SetFont(BufferView *, LyXFont const &, bool )
136 /// An updatable inset could handle lyx editing commands
138 UpdatableInset::RESULT
139 UpdatableInset::LocalDispatch(BufferView *,
140 int action, string const & arg)
142 UpdatableInset::RESULT
143 UpdatableInset::LocalDispatch(BufferView *, int, string const &)
147 if (action==LFUN_SCROLL_INSET)
150 sscanf(arg.c_str(), "%f", &xx);
159 int UpdatableInset::getMaxWidth(Painter & pain) const
162 return owner_->getMaxWidth(pain);
163 return pain.paperWidth();