-/* -------> These CB's use ToggleFree() as the (one and only?) font-changer.
- They also show the current font state. */
-
-static
-void ToggleAndShow(BufferView *, LyXFont const &);
-
-
-void FontSize(string const & size)
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setGUISize(size);
- ToggleAndShow(current_view, font);
-}
-
-
-void Emph()
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setEmph(LyXFont::TOGGLE);
- ToggleAndShow(current_view, font);
-}
-
-
-void Noun()
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setNoun(LyXFont::TOGGLE);
- ToggleAndShow(current_view, font);
-}
-
-
-void Bold()
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setSeries(LyXFont::BOLD_SERIES);
- ToggleAndShow(current_view, font);
-}
-
-
-void Underline()
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setUnderbar(LyXFont::TOGGLE);
- ToggleAndShow(current_view, font);
-}
-
-
-void Code()
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setFamily(LyXFont::TYPEWRITER_FAMILY); // no good
- ToggleAndShow(current_view, font);
-}
-
-
-void Sans()
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setFamily(LyXFont::SANS_FAMILY);
- ToggleAndShow(current_view, font);
-}
-
-
-void Roman()
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setFamily(LyXFont::ROMAN_FAMILY);
- ToggleAndShow(current_view, font);
-}
-
-
-void Tex()
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setLatex (LyXFont::TOGGLE);
- ToggleAndShow(current_view, font);
-}
-
-void LangCB(string const & l)
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- Languages::iterator lit = languages.find(l);
- if (lit != languages.end()) {
- font.setLanguage(&(*lit).second);
- ToggleAndShow(current_view, font);
- } else
- WriteAlert(_("Error! unknown language"),l);
-}
-
-
-void StyleReset()
-{
- LyXFont font(LyXFont::ALL_INHERIT, ignore_language);
- ToggleAndShow(current_view, font);
-}
-
-
-/* -------> Returns the current font and depth by printing a message. In the
- * future perhaps we could try to implement a callback to the button-bar.
- * That is, `light' the bold button when the font is currently bold, etc.
- */
-string CurrentState()
-{
- string state;
- if (current_view->available()) {
- // I think we should only show changes from the default
- // font. (Asger)
- Buffer * buffer = current_view->buffer();
- LyXFont font = current_view->text->real_current_font;
- LyXFont defaultfont = textclasslist.TextClass(buffer->
- params.textclass).defaultfont();
- font.reduce(defaultfont);
- state = _("Font: ") + font.stateText();
-
- int depth = current_view->text->GetDepth();
- if (depth > 0)
- state += string(_(", Depth: ")) + tostr(depth);
- }
- return state;
-}
-
-
-// candidate for move to BufferView
-/* -------> Does the actual toggle job of the XxxCB() calls above.
- * Also shows the current font state.
- */
-static
-void ToggleAndShow(BufferView * bv, LyXFont const & font)
-{
- if (bv->available()) {
- bv->hideCursor();
- bv->update(-2);
- if (bv->the_locking_inset)
- bv->the_locking_inset->SetFont(bv, font, toggleall);
- else
- bv->text->ToggleFree(font, toggleall);
- bv->update(1);
- }
-}
-
-
-// candidate for move to BufferView
-void Margin(BufferView * bv)
-{
- if (bv->available()) {
- bv->owner()->getMiniBuffer()->Set(_("Inserting margin note..."));
- bv->hideCursor();
- bv->update(-2);
- bv->text->InsertFootnoteEnvironment(LyXParagraph::MARGIN);
- bv->update(1);
- }
-}
-
-
-void Figure()
-{
- if (fd_form_figure->form_figure->visible) {
- fl_raise_form(fd_form_figure->form_figure);
- } else {
- fl_show_form(fd_form_figure->form_figure,
- FL_PLACE_MOUSE, FL_FULLBORDER,
- _("Insert Figure"));
- }
-}
-
-
-void Table()
-{
- if (fd_form_table->form_table->visible) {
- fl_raise_form(fd_form_table->form_table);
- } else {
- fl_show_form(fd_form_table->form_table,
- FL_PLACE_MOUSE, FL_FULLBORDER,
- _("Insert Table"));
- }
-}
-
-
-// candidate for move to BufferView
-void Melt(BufferView * bv)
-{
- if (!bv->available()) return;
-
- bv->owner()->getMiniBuffer()->Set(_("Melt"));
- bv->hideCursor();
- bv->beforeChange();
- bv->update(-2);
- bv->text->MeltFootnoteEnvironment();
- bv->update(1);
-}
-
-
-// candidate for move to BufferView
-// Change environment depth.
-// if decInc >= 0, increment depth
-// if decInc < 0, decrement depth
-void changeDepth(BufferView * bv, int decInc)
-{
- if (!bv->available()) return;
-
- bv->hideCursor();
- bv->update(-2);
- if (decInc >= 0)
- bv->text->IncDepth();
- else
- bv->text->DecDepth();
- bv->update(1);
- bv->owner()->getMiniBuffer()
- ->Set(_("Changed environment depth"
- " (in possible range, maybe not)"));
-}
-
-