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"
22 /* Insets default methods */
24 bool Inset::Deletable() const
30 bool Inset::DirectWrite() const
36 unsigned char Inset::Editable() const
42 void Inset::Validate(LaTeXFeatures &) const
47 bool Inset::AutoDelete() const
53 void Inset::Edit(BufferView *, int, int, unsigned int)
58 LyXFont Inset::ConvertFont(LyXFont font)
64 /* some stuff for inset locking */
66 void UpdatableInset::InsetButtonPress(BufferView *, int x, int y, int button)
68 lyxerr.debug() << "Inset Button Press x=" << x
69 << ", y=" << y << ", button=" << button << endl;
73 void UpdatableInset::InsetButtonRelease(BufferView *, int x, int y, int button)
75 lyxerr.debug() << "Inset Button Release x=" << x
76 << ", y=" << y << ", button=" << button << endl;
80 void UpdatableInset::InsetKeyPress(XKeyEvent *)
82 lyxerr.debug() << "Inset Keypress" << endl;
86 void UpdatableInset::InsetMotionNotify(BufferView *, int x, int y, int state)
88 lyxerr.debug() << "Inset Motion Notify x=" << x
89 << ", y=" << y << ", state=" << state << endl;
93 void UpdatableInset::InsetUnlock(BufferView *)
95 lyxerr.debug() << "Inset Unlock" << endl;
99 // An updatable inset is highly editable by definition
100 unsigned char UpdatableInset::Editable() const
102 return 2; // and what does "2" siginify? (Lgb)
106 void UpdatableInset::ToggleInsetCursor(BufferView *)
111 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 )
135 /// An updatable inset could handle lyx editing commands
137 UpdatableInset::RESULT
138 UpdatableInset::LocalDispatch(BufferView *,
139 int action, string const & arg)
141 UpdatableInset::RESULT
142 UpdatableInset::LocalDispatch(BufferView *, int, string const &)
146 if (action==LFUN_SCROLL_INSET)
149 sscanf(arg.c_str(), "%f", &xx);