#include "bufferview_funcs.h"
#include "TextCache.h"
#include "bufferlist.h"
-#include "lyx_gui_misc.h"
#include "lyxrc.h"
#include "intl.h"
// added for Dispatch functions
#include <clocale>
-extern lyx::layout_type current_layout;
+extern string current_layout;
using std::vector;
using std::find_if;
using SigC::slot;
using lyx::pos_type;
-using lyx::layout_type;
using lyx::textclass_type;
/* the selection possible is needed, that only motion events are
extern BufferList bufferlist;
extern char ascii_type;
-extern void sigchldchecker(pid_t pid, int * status);
extern int bibitemMaxWidth(BufferView *, LyXFont const &);
selection_possible = false;
owner_->updateLayoutChoice();
owner_->message(inset->editMessage());
+ // IMO the inset has to be first in edit-mode and then we send the
+ // button press. (Jug 20020222)
+ inset->edit(bv_); //, xpos, ypos, button);
inset->insetButtonPress(bv_, xpos, ypos, button);
- inset->edit(bv_, xpos, ypos, button);
return;
}
// Did we hit an editable inset?
if (inset_hit) {
- // Inset like error, notes and figures
selection_possible = false;
// if we reach this point with a selection, it
// Maybe we want to edit a bibitem ale970302
if (bv_->text->cursor.par()->bibkey && x < 20 +
- bibitemMaxWidth(bv_, textclasslist.
- TextClass(buffer_->
- params.textclass).defaultfont())) {
+ bibitemMaxWidth(bv_, textclasslist[buffer_->params.textclass].defaultfont())) {
bv_->text->cursor.par()->bibkey->edit(bv_, 0, 0, 0);
}
// Callback for cursor timer
void BufferView::Pimpl::cursorToggle()
{
- // Quite a nice place for asyncron Inset updating, isn't it?
- // Actually no! This is run even if no buffer exist... so (Lgb)
if (!buffer_) {
cursor_timeout.restart();
return;
}
- int status = 1;
- int const pid = waitpid(static_cast<pid_t>(0), &status, WNOHANG);
- if (pid == -1) // error find out what is wrong
- ; // ignore it for now.
- else if (pid > 0)
- sigchldchecker(pid, &status);
-
- updatelist.update(bv_);
-
if (!screen_.get()) {
cursor_timeout.restart();
return;
}
+ /* FIXME */
+ extern void reapSpellchecker(void);
+ reapSpellchecker();
+
if (!bv_->theLockingInset()) {
screen_->cursorToggle(bv_);
} else {
break;
}
- case LFUN_TABULAR_FEATURE:
case LFUN_SCROLL_INSET:
// this is not handled here as this funktion is only aktive
// if we have a locking_inset and that one is (or contains)
// Derive layout number from given argument (string)
// and current buffer's textclass (number). */
textclass_type tclass = buffer_->params.textclass;
- pair <bool, layout_type> layout =
- textclasslist.NumberOfLayout(tclass, argument);
+ bool hasLayout =
+ textclasslist[tclass].hasLayout(argument);
+ string layout = argument;
// If the entry is obsolete, use the new one instead.
- if (layout.first) {
- string obs = textclasslist.Style(tclass, layout.second)
+ if (hasLayout) {
+ string const & obs = textclasslist[tclass][layout]
.obsoleted_by();
if (!obs.empty())
- layout = textclasslist.NumberOfLayout(tclass, obs);
+ layout = obs;
}
- // see if we found the layout number:
- if (!layout.first) {
+ if (!hasLayout) {
owner_->getLyXFunc()->setErrorMessage(
string(N_("Layout ")) + argument +
N_(" not known"));
break;
}
- if (current_layout != layout.second) {
+ if (current_layout != layout) {
LyXText * lt = bv_->getLyXText();
hideCursor();
- current_layout = layout.second;
+ current_layout = layout;
update(lt,
BufferView::SELECT
| BufferView::FITCUR);
- lt->setLayout(bv_, layout.second);
- owner_->setLayout(layout.second);
+ lt->setLayout(bv_, layout);
+ owner_->setLayout(layout);
update(lt,
BufferView::SELECT
| BufferView::FITCUR
{
LyXText * lt = bv_->getLyXText();
- LyXLayout const & style = textclasslist
- .Style(buffer_->params.textclass,
- lt->cursor.par()->getLayout());
+ LyXLayout const & style = textclasslist[buffer_->params.textclass][lt->cursor.par()->layout()];
if (style.free_spacing) {
lt->insertChar(bv_, ' ');
break;
case LFUN_GETLAYOUT:
- owner_->getLyXFunc()->setMessage(tostr(bv_->getLyXText()->cursor.par()->layout));
+ owner_->getLyXFunc()->setMessage(tostr(bv_->getLyXText()->cursor.par()->layout()));
break;
case LFUN_GETFONT:
hideCursor();
- LyXLayout const & style = textclasslist.Style(
- bv_->buffer()->params.textclass, par->getLayout());
+ LyXLayout const & style =
+ textclasslist[bv_->buffer()->params.textclass][par->layout()];
if (style.pass_thru ||
(!insertInset(new InsetQuotes(c, bv_->buffer()->params))))
update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
- pair<bool, layout_type> lres =
- textclasslist.NumberOfLayout(buffer_->params .textclass, lout);
- layout_type lay = 0;
- if (lres.first != false) {
+ string lres = lout;
+ LyXTextClass const & tclass =
+ textclasslist[buffer_->params.textclass];
+ bool hasLayout = tclass.hasLayout(lres);
+ string lay = tclass.defaultLayoutName();
+
+ if (hasLayout != false) {
// layout found
- lay = lres.second;
+ lay = lres;
} else {
- // layout not fount using default "Standard" (0)
- lay = 0;
+ // layout not fount using default
+ lay = tclass.defaultLayoutName();
}
-
+
bv_->text->setLayout(bv_, lay);
bv_->text->setParagraph(bv_, 0, 0,