See attached.
The only 'non-obvious' part is in tables where it serve no purpose
obvious to me. Editing nested tables just work as before as far as I
can tell.
Andre'
--
Those who desire to give up Freedom in order to gain Security, will not have,
nor do they deserve, either one. (T. Jefferson or B. Franklin or both...)
Index: buffer.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.539
diff -u -p -r1.539 buffer.C
--- buffer.C 2 Nov 2003 17:56:25 -0000 1.539
+++ buffer.C 3 Nov 2003 15:30:34 -0000
@@ -1418,21 +1418,6 @@ void Buffer::inset_iterator::setParagrap
}
-InsetOld * Buffer::getInsetFromID(int id_arg) const
-{
- for (inset_iterator it = inset_const_iterator_begin();
- it != inset_const_iterator_end(); ++it)
- {
- if (it->id() == id_arg)
- return &(*it);
- InsetOld * in = it->getInsetFromID(id_arg);
- if (in)
- return in;
- }
- return 0;
-}
-
-
ParIterator Buffer::getParFromID(int id) const
{
#warning FIXME: const correctness! (Andre)
Index: buffer.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.h,v
retrieving revision 1.171
diff -u -p -r1.171 buffer.h
--- buffer.h 2 Nov 2003 17:56:26 -0000 1.171
+++ buffer.h 3 Nov 2003 15:30:34 -0000
@@ -359,9 +359,6 @@ public:
///
ParConstIterator par_iterator_end() const;
- ///
- InsetOld * getInsetFromID(int id_arg) const;
-
/** \returns true only when the file is fully loaded.
* Used to prevent the premature generation of previews
* and by the citation inset.
Index: bufferview_funcs.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/bufferview_funcs.C,v
retrieving revision 1.119
diff -u -p -r1.119 bufferview_funcs.C
--- bufferview_funcs.C 3 Nov 2003 09:23:23 -0000 1.119
+++ bufferview_funcs.C 3 Nov 2003 15:30:34 -0000
@@ -372,9 +372,9 @@ string const currentState(BufferView * b
state << _(", Inset: ");
InsetOld * inset = pit->inInset();
if (inset)
- state << inset << " id: " << inset->id()
- << " text: " << inset->getLyXText(bv, true)
- << " owner: " << inset->owner();
+ state << inset
+ << " text: " << inset->getLyXText(bv, true)
+ << " owner: " << inset->owner();
else
state << -1;
#endif
Index: frontends/xforms/XWorkArea.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/XWorkArea.C,v
retrieving revision 1.40
diff -u -p -r1.40 XWorkArea.C
--- frontends/xforms/XWorkArea.C 6 Oct 2003 15:42:57 -0000 1.40
+++ frontends/xforms/XWorkArea.C 3 Nov 2003 15:30:34 -0000
@@ -27,8 +27,7 @@ using std::string;
namespace {
-inline
-void waitForX(bool discard)
+inline void waitForX(bool discard)
{
XSync(fl_get_display(), discard);
}
@@ -272,15 +271,18 @@ int XWorkArea::work_area_handler(FL_OBJE
XEvent * ev = static_cast<XEvent*>(xev);
XWorkArea * area = static_cast<XWorkArea*>(ob->u_vdata);
- if (!area) return 1;
+ if (!area)
+ return 1;
switch (event) {
+
case FL_DRAW:
if (!area->work_area || !area->work_area->form->visible)
return 1;
lyxerr[Debug::WORKAREA] << "Workarea event: DRAW" << endl;
area->redraw(area->workWidth(), area->workHeight());
break;
+
case FL_PUSH:
if (!ev || ev->xbutton.button == 0) break;
// Should really have used xbutton.state
@@ -291,6 +293,7 @@ int XWorkArea::work_area_handler(FL_OBJE
ev->xbutton.y - ob->y,
x_button_state(key)));
break;
+
case FL_RELEASE:
if (!ev || ev->xbutton.button == 0) break;
// Should really have used xbutton.state
@@ -301,8 +304,8 @@ int XWorkArea::work_area_handler(FL_OBJE
ev->xbutton.y - ob->y,
x_button_state(key)));
break;
- case FL_DRAG:
- {
+
+ case FL_DRAG: {
if (!ev || !area->scrollbar)
break;
@@ -367,8 +370,7 @@ int XWorkArea::work_area_handler(FL_OBJE
break;
}
- case FL_KEYPRESS:
- {
+ case FL_KEYPRESS: {
lyxerr[Debug::WORKAREA] << "Workarea event: KEYPRESS" << endl;
KeySym keysym = 0;
@@ -456,8 +458,8 @@ int XWorkArea::work_area_handler(FL_OBJE
area->workAreaKeyPress(LyXKeySymPtr(xlk),
x_key_state(ret_state));
+ break;
}
- break;
case FL_KEYRELEASE:
lyxerr[Debug::WORKAREA] << "Workarea event: KEYRELEASE" << endl;
@@ -467,11 +469,13 @@ int XWorkArea::work_area_handler(FL_OBJE
lyxerr[Debug::WORKAREA] << "Workarea event: ENTER" << endl;
fl_set_cursor(FL_ObjWin(area->work_area), XC_xterm);
break;
+
case FL_LEAVE:
lyxerr[Debug::WORKAREA] << "Workarea event: LEAVE" << endl;
// There should be no need for this. But there is.
fl_set_cursor(FL_ObjWin(area->work_area), FL_DEFAULT_CURSOR);
break;
+
case FL_DBLCLICK:
if (ev) {
lyxerr[Debug::WORKAREA] << "Workarea event: DBLCLICK" << endl;
@@ -482,6 +486,7 @@ int XWorkArea::work_area_handler(FL_OBJE
area->dispatch(cmd);
}
break;
+
case FL_TRPLCLICK:
if (ev) {
lyxerr[Debug::WORKAREA] << "Workarea event: TRPLCLICK" << endl;
@@ -492,6 +497,7 @@ int XWorkArea::work_area_handler(FL_OBJE
area->dispatch(cmd);
}
break;
+
case FL_OTHER:
if (ev)
lyxerr[Debug::WORKAREA] << "Workarea event: OTHER" << endl;
Index: insets/inset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/inset.C,v
retrieving revision 1.114
diff -u -p -r1.114 inset.C
--- insets/inset.C 6 Oct 2003 15:42:59 -0000 1.114
+++ insets/inset.C 3 Nov 2003 15:30:34 -0000
@@ -24,21 +24,16 @@
using std::string;
-// Initialization of the counter for the inset id's,
-unsigned int InsetOld::inset_id = 0;
-
InsetOld::InsetOld()
: InsetBase(),
- top_x(0), top_baseline(0), scx(0),
- id_(inset_id++), owner_(0),
+ top_x(0), top_baseline(0), scx(0), owner_(0),
background_color_(LColor::inherit)
{}
InsetOld::InsetOld(InsetOld const & in)
: InsetBase(),
- top_x(0), top_baseline(0), scx(0),
- id_(in.id_), owner_(0),
+ top_x(0), top_baseline(0), scx(0), owner_(0),
name_(in.name_), background_color_(in.background_color_)
{}
@@ -105,16 +100,6 @@ LColor_color InsetOld::backgroundColor()
return LColor::color(background_color_);
}
-
-int InsetOld::id() const
-{
- return id_;
-}
-
-void InsetOld::id(int id_arg)
-{
- id_ = id_arg;
-}
void InsetOld::setFont(BufferView *, LyXFont const &, bool, bool)
{}
Index: insets/inset.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/inset.h,v
retrieving revision 1.131
diff -u -p -r1.131 inset.h
--- insets/inset.h 1 Nov 2003 09:56:18 -0000 1.131
+++ insets/inset.h 3 Nov 2003 15:30:35 -0000
@@ -230,9 +230,6 @@ public:
return 0;
}
- /// try to get a inset pointer from it's id if we have
- /// an inset to give back!
- virtual InsetOld * getInsetFromID(int /*id*/) const { return 0; }
/// if this insets owns paragraphs (f.ex. InsetText) then it
/// should return it's very first one!
virtual ParagraphList * getParagraphs(int /*num*/) const { return 0; }
@@ -244,10 +241,6 @@ public:
/// return the cursor if we own one otherwise giv'em just the
/// BufferView cursor to work with.
virtual LyXCursor const & cursor(BufferView * bview) const;
- /// id functions
- int id() const;
- ///
- void id(int id_arg);
/// lock cell with given index
virtual void edit(BufferView *, int /*index*/) {}
@@ -314,8 +307,6 @@ protected:
mutable int scx;
/// Used to identify the inset for cursor positioning when undoing
unsigned int id_;
- ///
- static unsigned int inset_id;
///
mutable Dimension dim_;
Index: insets/insetbase.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetbase.h,v
retrieving revision 1.17
diff -u -p -r1.17 insetbase.h
--- insets/insetbase.h 29 Oct 2003 10:47:17 -0000 1.17
+++ insets/insetbase.h 3 Nov 2003 15:30:35 -0000
@@ -63,6 +63,8 @@ public:
/// Appends \c list with all labels found within this inset.
virtual void getLabelList(Buffer const &,
std::vector<std::string> & /* list */) const {}
+ /// number of nested things
+ virtual size_t nargs() const { return 0; }
protected:
// the real dispatcher
virtual
Index: insets/insetcollapsable.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcollapsable.C,v
retrieving revision 1.190
diff -u -p -r1.190 insetcollapsable.C
--- insets/insetcollapsable.C 1 Nov 2003 15:45:15 -0000 1.190
+++ insets/insetcollapsable.C 3 Nov 2003 15:30:35 -0000
@@ -490,14 +490,6 @@ LyXCursor const & InsetCollapsable::curs
}
-InsetOld * InsetCollapsable::getInsetFromID(int id_arg) const
-{
- if (id_arg == id())
- return const_cast<InsetCollapsable *>(this);
- return inset.getInsetFromID(id_arg);
-}
-
-
void InsetCollapsable::open(BufferView * bv)
{
if (!collapsed_)
Index: insets/insetcollapsable.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcollapsable.h,v
retrieving revision 1.137
diff -u -p -r1.137 insetcollapsable.h
--- insets/insetcollapsable.h 1 Nov 2003 09:56:18 -0000 1.137
+++ insets/insetcollapsable.h 3 Nov 2003 15:30:35 -0000
@@ -115,8 +115,6 @@ public:
///
void scroll(BufferView *bv, int offset) const;
///
- InsetOld * getInsetFromID(int id) const;
- ///
ParagraphList * getParagraphs(int) const;
///
int numParagraphs() const;
Index: insets/insettabular.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.C,v
retrieving revision 1.361
diff -u -p -r1.361 insettabular.C
--- insets/insettabular.C 1 Nov 2003 15:45:16 -0000 1.361
+++ insets/insettabular.C 3 Nov 2003 15:30:35 -0000
@@ -441,7 +441,6 @@ bool InsetTabular::lockInsetInInset(Buff
if (!the_locking_inset) {
int const n = tabular.getNumberOfCells();
- int const id = inset->id();
for (int i = 0; i < n; ++i) {
InsetText * in = &tabular.getCellInset(i);
if (inset == in) {
@@ -451,11 +450,9 @@ bool InsetTabular::lockInsetInInset(Buff
resetPos(bv);
return true;
}
- if (in->getInsetFromID(id)) {
- actcell = i;
- in->dispatch(FuncRequest(bv, LFUN_INSET_EDIT));
- return the_locking_inset->lockInsetInInset(bv, inset);
- }
+ actcell = i;
+ in->dispatch(FuncRequest(bv, LFUN_INSET_EDIT));
+ return the_locking_inset->lockInsetInInset(bv, inset);
}
return false;
}
@@ -2413,22 +2410,6 @@ LyXCursor const & InsetTabular::cursor(B
if (the_locking_inset)
return the_locking_inset->cursor(bv);
return InsetOld::cursor(bv);
-}
-
-
-InsetOld * InsetTabular::getInsetFromID(int id_arg) const
-{
- if (id_arg == id())
- return const_cast<InsetTabular *>(this);
-
- for (int i = 0; i < tabular.rows(); ++i) {
- for (int j = 0; j < tabular.columns(); ++j) {
- InsetOld * inset = tabular.getCellInset(i,
j).getInsetFromID(id_arg);
- if (inset)
- return inset;
- }
- }
- return 0;
}
Index: insets/insettabular.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.h,v
retrieving revision 1.157
diff -u -p -r1.157 insettabular.h
--- insets/insettabular.h 1 Nov 2003 09:56:18 -0000 1.157
+++ insets/insettabular.h 3 Nov 2003 15:30:35 -0000
@@ -158,8 +158,6 @@ public:
UpdatableInset::scroll(bv, offset);
}
///
- InsetOld * getInsetFromID(int id) const;
- ///
ParagraphList * getParagraphs(int) const;
///
int numParagraphs() const;
Index: insets/insettext.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v
retrieving revision 1.521
diff -u -p -r1.521 insettext.C
--- insets/insettext.C 1 Nov 2003 15:45:17 -0000 1.521
+++ insets/insettext.C 3 Nov 2003 15:30:35 -0000
@@ -1440,28 +1440,6 @@ LyXCursor const & InsetText::cursor(Buff
}
-InsetOld * InsetText::getInsetFromID(int id_arg) const
-{
- if (id_arg == id())
- return const_cast<InsetText *>(this);
-
- ParagraphList::const_iterator pit = paragraphs.begin();
- ParagraphList::const_iterator pend = paragraphs.end();
- for (; pit != pend; ++pit) {
- InsetList::const_iterator it = pit->insetlist.begin();
- InsetList::const_iterator end = pit->insetlist.end();
- for (; it != end; ++it) {
- if (it->inset->id() == id_arg)
- return it->inset;
- InsetOld * in = it->inset->getInsetFromID(id_arg);
- if (in)
- return in;
- }
- }
- return 0;
-}
-
-
WordLangTuple const
InsetText::selectNextWordToSpellcheck(BufferView * bv, float & value) const
{
Index: insets/insettext.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.h,v
retrieving revision 1.219
diff -u -p -r1.219 insettext.h
--- insets/insettext.h 1 Nov 2003 09:56:18 -0000 1.219
+++ insets/insettext.h 3 Nov 2003 15:30:35 -0000
@@ -152,8 +152,6 @@ public:
///
void clearSelection(BufferView * bv);
///
- InsetOld * getInsetFromID(int id) const;
- ///
ParagraphList * getParagraphs(int) const;
///
LyXText * getText(int) const;