-// candidate for move to BufferView
-void OpenStuff()
-{
- if (current_view->available()) {
- current_view->owner()->getMiniBuffer()->Set(_("Open/Close..."));
- current_view->getScreen()->HideCursor();
- BeforeChange();
- current_view->update(-2);
- current_view->text->OpenStuff();
- current_view->update(0);
- }
-}
-
-
-// candidate for move to BufferView
-void ToggleFloat()
-{
- if (current_view->available()) {
- current_view->owner()->getMiniBuffer()->Set(_("Open/Close..."));
- current_view->getScreen()->HideCursor();
- BeforeChange();
- current_view->update(-2);
- current_view->text->ToggleFootnote();
- current_view->update(0);
- }
-}
-
-
-// candidate for move to BufferView
-void MenuUndo()
-{
-/* if (current_view->buffer()->the_locking_inset) {
- current_view->owner()->getMiniBuffer()->Set(_("Undo not yet supported in math mode"));
- return;
- }*/
-
- if (current_view->available()) {
- current_view->owner()->getMiniBuffer()->Set(_("Undo"));
- current_view->getScreen()->HideCursor();
- BeforeChange();
- current_view->update(-2);
- if (!current_view->text->TextUndo())
- current_view->owner()->getMiniBuffer()->Set(_("No further undo information"));
- else
- current_view->update(-1);
- }
-}
-
-
-// candidate for move to BufferView
-void MenuRedo()
-{
- if (current_view->buffer()->the_locking_inset) {
- current_view->owner()->getMiniBuffer()->Set(_("Redo not yet supported in math mode"));
- return;
- }
-
- if (current_view->available()) {
- current_view->owner()->getMiniBuffer()->Set(_("Redo"));
- current_view->getScreen()->HideCursor();
- BeforeChange();
- current_view->update(-2);
- if (!current_view->text->TextRedo())
- current_view->owner()->getMiniBuffer()->Set(_("No further redo information"));
- else
- current_view->update(-1);
- }
-}
-
-
-// candidate for move to BufferView
-void HyphenationPoint()
-{
- if (current_view->available()) {
- current_view->getScreen()->HideCursor();
- current_view->update(-2);
- InsetSpecialChar * new_inset =
- new InsetSpecialChar(InsetSpecialChar::HYPHENATION);
- current_view->buffer()->insertInset(new_inset);
- }
-}
-
-
-// candidate for move to BufferView
-void Ldots()
-{
- if (current_view->available()) {
- current_view->getScreen()->HideCursor();
- current_view->update(-2);
- InsetSpecialChar * new_inset =
- new InsetSpecialChar(InsetSpecialChar::LDOTS);
- current_view->buffer()->insertInset(new_inset);
- }
-}
-
-
-// candidate for move to BufferView
-void EndOfSentenceDot()
-{
- if (current_view->available()) {
- current_view->getScreen()->HideCursor();
- current_view->update(-2);
- InsetSpecialChar * new_inset =
- new InsetSpecialChar(InsetSpecialChar::END_OF_SENTENCE);
- current_view->buffer()->insertInset(new_inset);
- }
-}
-
-
-// candidate for move to BufferView
-void MenuSeparator()
-{
- if (current_view->available()) {
- current_view->getScreen()->HideCursor();
- current_view->update(-2);
- InsetSpecialChar * new_inset =
- new InsetSpecialChar(InsetSpecialChar::MENU_SEPARATOR);
- current_view->buffer()->insertInset(new_inset);
- }
-}
-
-
-// candidate for move to BufferView
-void Newline()
-{
- if (current_view->available()) {
- current_view->getScreen()->HideCursor();
- current_view->update(-2);
- current_view->text->InsertChar(LyXParagraph::META_NEWLINE);
- current_view->update(-1);
- }
-}
-
-
-// candidate for move to BufferView
-void ProtectedBlank()
-{
- if (current_view->available()) {
- current_view->getScreen()->HideCursor();
- current_view->update(-2);
- current_view->text->InsertChar(LyXParagraph::META_PROTECTED_SEPARATOR);
- current_view->update(-1);
- }
-}
-
-
-// candidate for move to BufferView
-void HFill()
-{
- if (current_view->available()) {
- current_view->getScreen()->HideCursor();
- current_view->update(-2);
- current_view->text->InsertChar(LyXParagraph::META_HFILL);
- current_view->update(-1);
- }
-}
-
-
-/* -------> These CB's use ToggleFree() as the (one and only?) font-changer.
- They also show the current font state. */
-
-static
-void ToggleAndShow(LyXFont const &);
-
-
-void FontSizeCB(string const & size)
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setGUISize(size);
- ToggleAndShow(font);
-}
-
-
-void EmphCB()
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setEmph(LyXFont::TOGGLE);
- ToggleAndShow(font);
-}
-
-
-void NounCB()
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setNoun(LyXFont::TOGGLE);
- ToggleAndShow(font);
-}
-
-
-void BoldCB()
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setSeries(LyXFont::BOLD_SERIES);
- ToggleAndShow(font);
-}
-
-
-void UnderlineCB()
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setUnderbar(LyXFont::TOGGLE);
- ToggleAndShow(font);
-}
-
-
-void CodeCB()
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setFamily(LyXFont::TYPEWRITER_FAMILY); // no good
- ToggleAndShow(font);
-}
-
-
-void SansCB()
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setFamily(LyXFont::SANS_FAMILY);
- ToggleAndShow(font);
-}
-
-
-void RomanCB()
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setFamily(LyXFont::ROMAN_FAMILY);
- ToggleAndShow(font);
-}
-
-
-void TexCB()
-{
- LyXFont font(LyXFont::ALL_IGNORE);
- font.setLatex (LyXFont::TOGGLE);
- ToggleAndShow(font);
-}
-
-
-void StyleResetCB()
-{
- LyXFont font(LyXFont::ALL_INHERIT);
- ToggleAndShow(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(LyXFont const & font)
-{
- if (current_view->available()) {
- current_view->getScreen()->HideCursor();
- current_view->update(-2);
- current_view->text->ToggleFree(font, toggleall);
- current_view->update(1);
- }
- // removed since it overrides the ToggleFree Message about the style
- // Since Styles are more "High Level" than raw fonts I think the user
- // prefers it like this Matthias
- // FontStateShowCB( 0, 0 );
-}
-
-
-// candidate for move to BufferView
-extern "C" void MarginCB(FL_OBJECT *, long)
-{
- if (current_view->available()) {
- current_view->owner()->getMiniBuffer()->Set(_("Inserting margin note..."));
- current_view->getScreen()->HideCursor();
- current_view->update(-2);
- current_view->text->InsertFootnoteEnvironment(LyXParagraph::MARGIN);
- current_view->update(1);
- }
-}
-
-
-extern "C" void FigureCB(FL_OBJECT *, long)
-{
- 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"));
- }
-}
-
-
-extern "C" void TableCB(FL_OBJECT *, long)
-{
- 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 CopyEnvironmentCB()
-{
- if (current_view->available()) {
- current_view->text->copyEnvironmentType();
- /* clear the selection, even if mark_set */
- current_view->getScreen()->ToggleSelection();
- current_view->text->ClearSelection();
- current_view->update(-2);
- current_view->owner()->getMiniBuffer()->Set(_("Paragraph environment type copied"));
- }
-}
-
-
-// candidate for move to BufferView
-void PasteEnvironmentCB()
-{
- if (current_view->available()) {
- current_view->text->pasteEnvironmentType();
- current_view->owner()->getMiniBuffer()->Set(_("Paragraph environment type set"));
- current_view->update(1);
- }
-}
-
-
-// candidate for move to BufferView
-void CopyCB()
-{
- if (current_view->available()) {
- current_view->text->CopySelection();
- /* clear the selection, even if mark_set */
- current_view->getScreen()->ToggleSelection();
- current_view->text->ClearSelection();
- current_view->update(-2);
- current_view->owner()->getMiniBuffer()->Set(_("Copy"));
- }
-}
-
-
-// candidate for move to BufferView
-void CutCB()
-{
- if (current_view->available()) {
- current_view->getScreen()->HideCursor();
- current_view->update(-2);
- current_view->text->CutSelection();
- current_view->update(1);
- current_view->owner()->getMiniBuffer()->Set(_("Cut"));
- }
-}
-
-
-// candidate for move to BufferView
-void PasteCB()
-{
- if (!current_view->available()) return;
-
- current_view->owner()->getMiniBuffer()->Set(_("Paste"));
- current_view->getScreen()->HideCursor();
- /* clear the selection */
- current_view->getScreen()->ToggleSelection();
- current_view->text->ClearSelection();
- current_view->update(-2);
-
- /* paste */
- current_view->text->PasteSelection();
- current_view->update(1);
-
- /* clear the selection */
- current_view->getScreen()->ToggleSelection();
- current_view->text->ClearSelection();
- current_view->update(-2);
-}
-
-
-// candidate for move to BufferView
-extern "C" void MeltCB(FL_OBJECT *, long)
-{
- if (!current_view->available()) return;
-
- current_view->owner()->getMiniBuffer()->Set(_("Melt"));
- current_view->getScreen()->HideCursor();
- BeforeChange();
- current_view->update(-2);
- current_view->text->MeltFootnoteEnvironment();
- current_view->update(1);
-}
-
-
-// candidate for move to BufferView
-// Change environment depth.
-// if decInc == 0, depth change taking mouse button number into account
-// if decInc == 1, increment depth
-// if decInc == -1, decrement depth
-extern "C" void DepthCB(FL_OBJECT * ob, long decInc)
-{
- int button = 1;
-
- /* When decInc != 0, fake a mouse button. This allows us to
- implement depth-plus and depth-min commands. RVDK_PATCH_5. */
- /* check out wether ob is defined, too (Matthias) */
- if ( decInc < 0 )
- button = 0;
- else if (!decInc && ob) {
- button = fl_get_button_numb(ob);
- }
-
- if (current_view->available()) {
- current_view->getScreen()->HideCursor();
- current_view->update(-2);
- if (button == 1)
- current_view->text->IncDepth();
- else
- current_view->text->DecDepth();
- current_view->update(1);
- current_view->owner()->getMiniBuffer()->Set(_("Changed environment depth"
- " (in possible range, maybe not)"));
- }
-}
-
-
-// This is both GUI and LyXFont dependent. Don't know where to put it. (Asger)
-// Well, it's mostly GUI dependent, so I guess it will stay here. (Asger)
-LyXFont UserFreeFont()
-{
- LyXFont font(LyXFont::ALL_IGNORE);
-
- int pos = fl_get_choice(fd_form_character->choice_family);
- switch(pos) {
- case 1: font.setFamily(LyXFont::IGNORE_FAMILY); break;
- case 2: font.setFamily(LyXFont::ROMAN_FAMILY); break;
- case 3: font.setFamily(LyXFont::SANS_FAMILY); break;
- case 4: font.setFamily(LyXFont::TYPEWRITER_FAMILY); break;
- case 5: font.setFamily(LyXFont::INHERIT_FAMILY); break;