1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich
7 * Copyright 1995-2000 The LyX Team.
9 * ====================================================== */
14 #pragma implementation "lyxinset.h"
19 #include "BufferView.h"
20 #include "support/lstrings.h"
25 /* Insets default methods */
27 bool Inset::Deletable() const
33 bool Inset::DirectWrite() const
39 Inset::EDITABLE Inset::Editable() const
45 void Inset::Validate(LaTeXFeatures &) const
50 bool Inset::AutoDelete() const
56 void Inset::Edit(BufferView *, int, int, unsigned int)
61 LyXFont Inset::ConvertFont(LyXFont font)
67 /* some stuff for inset locking */
69 void UpdatableInset::InsetButtonPress(BufferView *, int x, int y, int button)
71 lyxerr.debug() << "Inset Button Press x=" << x
72 << ", y=" << y << ", button=" << button << endl;
76 void UpdatableInset::InsetButtonRelease(BufferView *, int x, int y, int button)
78 lyxerr.debug() << "Inset Button Release x=" << x
79 << ", y=" << y << ", button=" << button << endl;
83 void UpdatableInset::InsetKeyPress(XKeyEvent *)
85 lyxerr.debug() << "Inset Keypress" << endl;
89 void UpdatableInset::InsetMotionNotify(BufferView *, int x, int y, int state)
91 lyxerr.debug() << "Inset Motion Notify x=" << x
92 << ", y=" << y << ", state=" << state << endl;
96 void UpdatableInset::InsetUnlock(BufferView *)
98 lyxerr.debug() << "Inset Unlock" << endl;
102 // An updatable inset is highly editable by definition
103 Inset::EDITABLE UpdatableInset::Editable() const
105 return HIGHLY_EDITABLE;
109 void UpdatableInset::ToggleInsetCursor(BufferView *)
114 void UpdatableInset::Edit(BufferView * bv, int, int, unsigned int)
120 mx_scx = abs((width(bv->getPainter(), font) - bv->paperWidth()) / 2);
124 void UpdatableInset::draw(Painter &, LyXFont const &,
125 int baseline, float & x) const
127 if (scx) x += float(scx);
129 top_baseline = baseline;
133 void UpdatableInset::SetFont(BufferView *, LyXFont const &, bool )
138 /// An updatable inset could handle lyx editing commands
140 UpdatableInset::RESULT
141 UpdatableInset::LocalDispatch(BufferView *,
142 int action, string const & arg)
144 UpdatableInset::RESULT
145 UpdatableInset::LocalDispatch(BufferView *, int, string const &)
149 if (action==LFUN_SCROLL_INSET)
152 sscanf(arg.c_str(), "%f", &xx);
161 int UpdatableInset::getMaxWidth(Painter & pain) const
164 return owner_->getMaxWidth(pain);
165 return pain.paperWidth();