#endif
#include "bufferview_funcs.h"
-#include "LyXView.h"
+#include "frontends/LyXView.h"
#include "BufferView.h"
#include "paragraph.h"
#include "lyxfont.h"
#include "language.h"
#include "gettext.h"
#include "ParagraphParameters.h"
-#include "lyxtextclasslist.h"
#include "frontends/Alert.h"
Buffer * buffer = bv->buffer();
LyXFont font = text->real_current_font;
LyXFont const & defaultfont =
- textclasslist[buffer->params.textclass].defaultfont();
+ buffer->params.getLyXTextClass().defaultfont();
font.reduce(defaultfont);
state << _("Font:") << ' '
break;
}
}
-#if 1
+#ifdef DEVEL_VERSION
state << _(", Paragraph: ") << text->cursor.par()->id();
#endif
}
}
-/* -------> Does the actual toggle job of the XxxCB() calls above.
+/* Does the actual toggle job of the calls above.
* Also shows the current font state.
*/
void toggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
{
- if (bv->available()) {
- if (bv->theLockingInset()) {
- bv->theLockingInset()->setFont(bv, font, toggleall);
- return;
- }
- LyXText * text = bv->getLyXText();
- if (!text)
- return;
-
- bv->hideCursor();
- bv->update(text, BufferView::SELECT|BufferView::FITCUR);
- text->toggleFree(bv, font, toggleall);
- bv->update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
-
- if (font.language() != ignore_language ||
- font.number() != LyXFont::IGNORE) {
- LyXCursor & cursor = text->cursor;
- text->computeBidiTables(bv->buffer(), cursor.row());
- if (cursor.boundary() !=
- text->isBoundary(bv->buffer(), cursor.par(), cursor.pos(),
- text->real_current_font))
- text->setCursor(bv, cursor.par(), cursor.pos(),
- false, !cursor.boundary());
- }
+ if (!bv->available())
+ return;
+
+ if (bv->theLockingInset()) {
+ bv->theLockingInset()->setFont(bv, font, toggleall);
+ return;
+ }
+
+ LyXText * text = bv->getLyXText();
+ // FIXME: can this happen ??
+ if (!text)
+ return;
+
+ bv->hideCursor();
+ bv->update(text, BufferView::SELECT | BufferView::FITCUR);
+ text->toggleFree(bv, font, toggleall);
+ bv->update(text, BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE);
+
+ if (font.language() != ignore_language ||
+ font.number() != LyXFont::IGNORE) {
+ LyXCursor & cursor = text->cursor;
+ text->computeBidiTables(bv->buffer(), cursor.row());
+ if (cursor.boundary() !=
+ text->isBoundary(bv->buffer(), cursor.par(), cursor.pos(),
+ text->real_current_font))
+ text->setCursor(bv, cursor.par(), cursor.pos(),
+ false, !cursor.boundary());
}
}