+2001-12-12 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
+
+ * text.C (workWidth): use Inset::parOwner to find out where the
+ inset has been inserted. This is a huge performance gain for large
+ documents with lots of insets. If Inset::parOwner is not set, fall
+ back on the brute force method
+
+ * paragraph_pimpl.C (insertInset):
+ * paragraph.C (Paragraph):
+ (cutIntoMinibuffer): set parOwner of insets when
+ inserting/removing them
+
+ * lyxtext.h: add short comment on deleteEmptyParagraphMechanism
+
2001-12-10 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* tabular-old.C (getTokenValue):
+2001-12-11 Ben Stanley <bds02@uow.edu.au>
+
+ * Menubar_pimpl.C: Fixed a crashing bug when document has more
+ than 80 floats and using xforms 0.88
+
2001-12-11 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
+ * xforms_helpers.C: include lyxlength.h here
+ * xforms_helpers.h: ... but not here
+
* FormTabular.C: use LyXLength instead of string wherever
necessary; whitespace changes.
if (cit->first == "TOC") continue;
// All the rest is for floats
- int menu2 = get_new_submenu(smn, win);
+ int menu_first_sub = get_new_submenu(smn, win);
+ int menu_current = menu_first_sub;
Buffer::SingleList::const_iterator ccit = cit->second.begin();
Buffer::SingleList::const_iterator eend = cit->second.end();
+ size_type count = 0;
for (; ccit != eend; ++ccit) {
+ ++count;
+ if (count > max_number_of_items) {
+ int menu_tmp = get_new_submenu(smn, win);
+ string label = _("More");
+ label += "...%m";
+ fl_addtopup(menu_current, label.c_str(), menu_tmp);
+ count = 1;
+ menu_current = menu_tmp;
+ }
int const action =
lyxaction
.getPseudoAction(LFUN_GOTO_PARAGRAPH,
string label = fixlabel(ccit->str);
label = limit_string_length(label);
label += "%x" + tostr(action + action_offset);
- fl_addtopup(menu2, label.c_str());
+ fl_addtopup(menu_current, label.c_str());
}
string const m = floatList[cit->first]->second.name() + "%m";
- fl_addtopup(menu, m.c_str(), menu2);
+ fl_addtopup(menu, m.c_str(), menu_first_sub);
}
#include "support/lstrings.h" // frontStrip, strip
#include "gettext.h"
#include "support/LAssert.h"
+#include "lyxlength.h"
using std::ofstream;
using std::pair;
#include FORMS_H_LOCATION
#include "Color.h"
-#include "support/lstrings.h"
-#include "lyxlength.h"
+#include "LString.h"
#include <vector>
+class LyXLength;
+
/// Extract shortcut from <ident>|<shortcut> string
char const * flyx_shortcut_extract(char const * sc);
/// Shortcut for flyx_shortcut_extract
/// Take a string and add breaks so that it fits into a desired label width, w
string formatted(string const &label, int w,
- int=FL_NORMAL_SIZE, int=FL_NORMAL_STYLE);
+ int = FL_NORMAL_SIZE, int = FL_NORMAL_STYLE);
/// Given an fl_choice, create a vector of its entries
std::vector<string> const getVectorFromChoice(FL_OBJECT *);
+2001-12-11 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
+
+ * inset.h: add par_owner_ member variable and parOwner
+ setter/accessor.
+
2001-12-10 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* insettabular.C (everywhere): adapt because widths are now real
Inset::Inset()
: top_x(0), topx_set(false), top_baseline(0), scx(0),
- id_(inset_id++), owner_(0), background_color_(LColor::inherit)
+ id_(inset_id++), owner_(0), par_owner_(0),
+ background_color_(LColor::inherit)
{}
///
Inset * owner() const { return owner_; }
///
+ void parOwner(Paragraph * par) { par_owner_ = par; }
+ ///
+ Paragraph * parOwner() const {return par_owner_; }
+ ///
void setBackgroundColor(LColor::color);
///
LColor::color backgroundColor() const;
private:
///
Inset * owner_;
+ /// the paragraph in which this inset has been inserted
+ Paragraph * par_owner_;
///
string name_;
///
LyXCursor & cur,
LyXCursor const & where) const;
- ///
+ /// delete double space or empty paragraphs around old_cursor
void deleteEmptyParagraphMechanism(BufferView *,
LyXCursor const & old_cursor) const;
}
-// This construktor inserts the new paragraph in a list.
+// This constructor inserts the new paragraph in a list.
Paragraph::Paragraph(Paragraph * par)
: layout(0), pimpl_(new Paragraph::Pimpl(this))
{
it != insetlist.end(); ++it)
{
it->inset = it->inset->clone(*current_view->buffer(), same_ids);
+ // tell the new inset who is the boss now
+ it->inset->parOwner(this);
}
}
search_elem, Pimpl::matchIT());
if (it != insetlist.end() && it->pos == pos)
it->inset = 0;
+ // the inset is not in a paragraph anymore
+ minibuffer_inset->parOwner(0);
} else {
minibuffer_inset = 0;
minibuffer_char = ' ';
while (index < insetlist.size()) {
if (insetlist[index].inset && insetlist[index].inset->autoDelete()) {
erase(insetlist[index].pos);
- // Erase() calls to insetlist.erase(&insetlist[index])
+ // erase() calls to insetlist.erase(&insetlist[index])
// so index shouldn't be increased.
++count;
} else
/// Returns the height of the highest font in range
LyXFont::FONT_SIZE highestFontInRange(lyx::pos_type startpos,
lyx::pos_type endpos,
- LyXFont::FONT_SIZE const def_size) const;
+ LyXFont::FONT_SIZE const def_size) const;
///
void insertChar(lyx::pos_type pos, value_type c);
///
"there is an inset in position: " << pos << std::endl;
} else {
owner_->insetlist.insert(it, InsetTable(pos, inset));
+ inset->parOwner(owner_);
}
if (inset_owner)
int LyXText::workWidth(BufferView * bview, Inset * inset) const
{
Paragraph * par = 0;
- pos_type pos = 0;
-
- Buffer::inset_iterator it = bview->buffer()->inset_iterator_begin();
- Buffer::inset_iterator end = bview->buffer()->inset_iterator_end();
- for ( ; it != end; ++it) {
- if (*it == inset) {
- par = it.getPar();
- pos = it.getPos();
- break;
+ pos_type pos = -1;
+
+ par = inset->parOwner();
+ if (par)
+ pos = par->getPositionOfInset(inset);
+
+ if (!par || pos == -1) {
+ lyxerr << "LyXText::workWidth: something is wrong,"
+ " fall back to the brute force method" << endl;
+ Buffer::inset_iterator it = bview->buffer()->inset_iterator_begin();
+ Buffer::inset_iterator end = bview->buffer()->inset_iterator_end();
+ for ( ; it != end; ++it) {
+ if (*it == inset) {
+ par = it.getPar();
+ pos = it.getPos();
+ break;
+ }
}
}
+
if (!par) {
return workWidth(bview);
}
if (first) {
bv->buffer()->redostack.push(
createUndo(bv, undo->kind, first,
- bv->buffer()->getParFromID(undo->number_of_behind_par)));
+ bv->buffer()->getParFromID(undo->number_of_behind_par)));
}
}
}
while (tmppar5 && tmppar5 != behind) {
tmppar = tmppar5;
tmppar5 = tmppar5->next();
- // a memory optimization for edit: Only layout information
- // is stored in the undo. So restore the text informations.
+ // a memory optimization for edit:
+ // Only layout information
+ // is stored in the undo. So restore
+ // the text informations.
if (undo->kind == Undo::EDIT) {
tmppar2->setContentsFromPar(tmppar);
tmppar->clearContents();
LyXFont font;
it->update(bv, font, false);
#ifdef THIS_DOES_NOT_WORK
- // we need this anyway as also if the undo was inside an inset
- // we have to redo the paragraph breaking
+ // we need this anyway as also if the undo was
+ // inside an inset we have to redo the
+ // paragraph breaking
bv->text->redoParagraphs(bv, bv->text->cursor,
- bv->text->cursor.par());
+ bv->text->cursor.par());
#endif
} else {
bv->text->redoParagraphs(bv, bv->text->cursor, endpar);