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 char const * Inset::EditMessage() const
69 return _("Opened inset");
72 /* some stuff for inset locking */
74 void UpdatableInset::InsetButtonPress(BufferView *, int x, int y, int button)
76 lyxerr.debug() << "Inset Button Press x=" << x
77 << ", y=" << y << ", button=" << button << endl;
81 void UpdatableInset::InsetButtonRelease(BufferView *, int x, int y, int button)
83 lyxerr.debug() << "Inset Button Release x=" << x
84 << ", y=" << y << ", button=" << button << endl;
88 void UpdatableInset::InsetKeyPress(XKeyEvent *)
90 lyxerr.debug() << "Inset Keypress" << endl;
94 void UpdatableInset::InsetMotionNotify(BufferView *, int x, int y, int state)
96 lyxerr.debug() << "Inset Motion Notify x=" << x
97 << ", y=" << y << ", state=" << state << endl;
101 void UpdatableInset::InsetUnlock(BufferView *)
103 lyxerr.debug() << "Inset Unlock" << endl;
107 // An updatable inset is highly editable by definition
108 Inset::EDITABLE UpdatableInset::Editable() const
110 return HIGHLY_EDITABLE;
114 void UpdatableInset::ToggleInsetCursor(BufferView *)
119 void UpdatableInset::ShowInsetCursor(BufferView *)
124 void UpdatableInset::HideInsetCursor(BufferView *)
129 void UpdatableInset::Edit(BufferView * bv, int, int, unsigned int)
135 mx_scx = abs((width(bv->painter(), font) - bv->workWidth()) / 2);
139 void UpdatableInset::draw(BufferView *, LyXFont const &,
140 int /* baseline */, float & x) const
142 if (scx) x += float(scx);
143 // ATTENTION: don't do the following here!!!
145 // top_baseline = baseline;
149 void UpdatableInset::SetFont(BufferView *, LyXFont const &, bool )
154 /// An updatable inset could handle lyx editing commands
156 UpdatableInset::RESULT
157 UpdatableInset::LocalDispatch(BufferView *,
158 int action, string const & arg)
160 UpdatableInset::RESULT
161 UpdatableInset::LocalDispatch(BufferView *, int, string const &)
165 if (action==LFUN_SCROLL_INSET)
168 sscanf(arg.c_str(), "%f", &xx);
178 int UpdatableInset::getMaxWidth(Painter & pain, UpdatableInset const *) const
181 return static_cast<UpdatableInset*>(owner())->getMaxWidth(pain, this);
182 return pain.paperWidth();