-void InsetText::edit(BufferView * bv, int x, int y, mouse_button::state button)
-{
- UpdatableInset::edit(bv, x, y, button);
-
- if (!bv->lockInset(this)) {
- lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
- return;
- }
- locked = true;
- the_locking_inset = 0;
- inset_pos = inset_x = inset_y = 0;
- inset_boundary = false;
- inset_par = 0;
- old_par = 0;
- int tmp_y = (y < 0) ? 0 : y;
- bool clear = false;
- if (!lt) {
- lt = getLyXText(bv);
- clear = true;
- }
- // we put here -1 and not button as now the button in the
- // edit call should not be needed we will fix this in 1.3.x
- // cycle hopefully (Jug 20020509)
- // FIXME: GUII I've changed this to none: probably WRONG
- if (!checkAndActivateInset(bv, x, tmp_y, mouse_button::none)) {
- lt->setCursorFromCoordinates(bv, x - drawTextXOffset,
- y + insetAscent);
- lt->cursor.x_fix(lt->cursor.x());
- }
- lt->clearSelection();
- finishUndo();
- // If the inset is empty set the language of the current font to the
- // language to the surronding text (if different).
- if (paragraphs.begin()->empty() && !paragraphs.begin()->next() &&
- bv->getParentLanguage(this) != lt->current_font.language())
- {
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setLanguage(bv->getParentLanguage(this));
- setFont(bv, font, false);
- }
- if (clear)
- lt = 0;
-
- int code = CURSOR;
- if (drawFrame_ == LOCKED)
- code = CURSOR|DRAW_FRAME;
- updateLocal(bv, code, false);
- showInsetCursor(bv);
-
- // Tell the paragraph dialog that we've entered an insettext.
- bv->owner()->getDialogs().updateParagraph();
-}
-
-
-void InsetText::edit(BufferView * bv, bool front)
-{
- UpdatableInset::edit(bv, front);
-
- if (!bv->lockInset(this)) {
- lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
- return;
- }
- locked = true;
- the_locking_inset = 0;
- inset_pos = inset_x = inset_y = 0;
- inset_boundary = false;
- inset_par = 0;
- old_par = 0;
- bool clear = false;
- if (!lt) {
- lt = getLyXText(bv);
- clear = true;
- }
- if (front)
- lt->setCursor(bv, &*(paragraphs.begin()), 0);
- else {
- ParagraphList::iterator it = paragraphs.begin();
- ParagraphList::iterator end = paragraphs.end();
- while (boost::next(it) != end)
- ++it;
-// int const pos = (p->size() ? p->size()-1 : p->size());
- lt->setCursor(bv, &*it, it->size());
- }
- lt->clearSelection();
- finishUndo();
- // If the inset is empty set the language of the current font to the
- // language to the surronding text (if different).
- if (paragraphs.begin()->empty() && !paragraphs.begin()->next() &&
- bv->getParentLanguage(this) != lt->current_font.language()) {
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setLanguage(bv->getParentLanguage(this));
- setFont(bv, font, false);
- }
- if (clear)
- lt = 0;
- int code = CURSOR;
- if (drawFrame_ == LOCKED)
- code = CURSOR|DRAW_FRAME;
- updateLocal(bv, code, false);
- showInsetCursor(bv);
-}
-
-