1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich,
7 * Copyright 1995-2000 The LyX Team.
9 * ====================================================== */
17 #include FORMS_H_LOCATION
19 #include "layout_forms.h"
23 #include "insets/insetref.h"
24 #include "insets/insetlabel.h"
25 #include "insets/figinset.h"
27 #include "minibuffer.h"
29 #include "bufferlist.h"
31 #include "lyx_gui_misc.h"
33 #include "BufferView.h"
34 #include "lastfiles.h"
35 #include "bufferview_funcs.h"
36 #include "support/FileInfo.h"
37 #include "support/syscall.h"
38 #include "support/filetools.h"
39 #include "support/path.h"
40 #include "lyxserver.h"
43 #include "CutAndPaste.h"
48 using std::back_inserter;
52 using std::istream_iterator;
58 extern Combox * combo_language;
59 extern Combox * combo_language2;
60 extern BufferList bufferlist;
61 extern void show_symbols_form();
62 extern FD_form_title * fd_form_title;
63 extern FD_form_character * fd_form_character;
64 extern FD_form_preamble * fd_form_preamble;
65 extern FD_form_figure * fd_form_figure;
67 extern BufferView * current_view; // called too many times in this file...
69 extern void DeleteSimpleCutBuffer(); /* for the cleanup when exiting */
71 extern bool send_fax(string const & fname, string const & sendcmd);
72 extern void MenuSendto();
74 extern LyXServer * lyxserver;
76 // this should be static, but I need it in buffer.C
77 bool quitting; // flag, that we are quitting the program
78 extern bool finished; // all cleanup done just let it run through now.
80 char ascii_type; /* for selection notify callbacks */
82 bool scrolling = false;
84 // This is used to make the dreaded font toggle problem hopefully go
85 // away. Definitely not the best solution, but I think it sorta works.
86 bool toggleall = true;
89 This is the inset locking stuff needed for mathed --------------------
91 an inset can simple call LockInset in it's edit call and *ONLY* in it's
93 Inset::Edit() can only be called by the main lyx module.
95 Then the inset may modify the menu's and/or iconbars.
97 Unlocking is either done by LyX or the inset itself with a UnlockInset-call
99 During the lock, all button and keyboard events will be modified
100 and send to the inset through the following inset-features. Note that
101 Inset::InsetUnlock will be called from inside UnlockInset. It is meant
102 to contain the code for restoring the menus and things like this.
105 virtual void InsetButtonPress(int x, int y, int button);
106 virtual void InsetButtonRelease(int x, int y, int button);
107 virtual void InsetKeyPress(XKeyEvent *ev);
108 virtual void InsetMotionNotify(int x, int y, int state);
109 virtual void InsetUnlock();
111 If a inset wishes any redraw and/or update it just has to call
113 It's is completly irrelevant, where the inset is. UpdateInset will
114 find it in any paragraph in any buffer.
115 Of course the_locking_inset and the insets in the current paragraph/buffer
116 are checked first, so no performance problem should occur.
118 Hope that's ok for the beginning, Alejandro,
119 sorry that I needed so much time,
124 //void UpdateInset(BufferView * bv, Inset * inset, bool mark_dirty = true);
126 /* these functions return 1 if an error occured,
128 // Now they work only for updatable insets. [Alejandro 080596]
129 //int LockInset(UpdatableInset * inset);
130 void ToggleLockedInsetCursor(int x, int y, int asc, int desc);
131 //void FitLockedInsetCursor(long x, long y, int asc, int desc);
132 //int UnlockInset(UpdatableInset * inset);
133 //void LockedInsetStoreUndo(Undo::undo_kind kind);
135 /* this is for asyncron updating. UpdateInsetUpdateList will be called
136 automatically from LyX. Just insert the Inset into the Updatelist */
137 //void UpdateInsetUpdateList();
138 //void PutInsetIntoInsetUpdateList(Inset * inset);
140 //InsetUpdateStruct * InsetUpdateList = 0;
144 -----------------------------------------------------------------------
147 /* some function prototypes */
149 int RunLinuxDoc(BufferView *, int, string const &);
150 int RunDocBook(int, string const &);
151 bool MenuWrite(Buffer * buf);
152 bool MenuWriteAs(Buffer * buffer);
153 void MenuReload(Buffer * buf);
154 void MenuLayoutSave();
157 void ShowMessage(Buffer const * buf,
160 string const & msg3, int delay)
163 buf->getUser()->owner()->getMiniBuffer()->Set(msg1, msg2,
166 // can somebody think of something more clever? cerr?
167 cout << msg1 << msg2 << msg3 << endl;
180 // should be moved to lyxfunc.C
181 bool MenuWrite(Buffer * buffer)
184 if (!buffer->save()) {
185 string fname = buffer->fileName();
186 string s = MakeAbsPath(fname);
187 if (AskQuestion(_("Save failed. Rename and try again?"),
188 MakeDisplayPath(s, 50),
189 _("(If not, document is not saved.)"))) {
190 return MenuWriteAs(buffer);
194 lastfiles->newFile(buffer->fileName());
200 // should be moved to BufferView.C
201 // Half of this func should be in LyXView, the rest in BufferView.
202 bool MenuWriteAs(Buffer * buffer)
204 // Why do we require BufferView::text to be able to write a
205 // document? I see no point in that. (Lgb)
206 //if (!bv->text) return;
208 string fname = buffer->fileName();
209 string oldname = fname;
212 ProhibitInput(current_view);
213 fileDlg.SetButton(0, _("Documents"), lyxrc.document_path);
214 fileDlg.SetButton(1, _("Templates"), lyxrc.template_path);
216 if (!IsLyXFilename(fname))
219 if (buffer->isUnnamed()) {
220 fname = fileDlg.Select(_("Enter Filename to Save Document as"),
225 fname = fileDlg.Select(_("Enter Filename to Save Document as"),
228 OnlyFilename(fname));
230 AllowInput(current_view);
235 // Make sure the absolute filename ends with appropriate suffix
236 string s = MakeAbsPath(fname);
237 if (!IsLyXFilename(s))
240 // Same name as we have already?
242 if (!AskQuestion(_("Same name as document already has:"),
243 MakeDisplayPath(s, 50),
246 // Falls through to name change and save
248 // No, but do we have another file with this name open?
249 else if (bufferlist.exists(s)) {
250 if (AskQuestion(_("Another document with same name open!"),
251 MakeDisplayPath(s, 50),
252 _("Replace with current document?")))
254 bufferlist.close(bufferlist.getBuffer(s));
256 // Ok, change the name of the buffer, but don't save!
260 ShowMessage(buffer, _("Document renamed to '"),
261 MakeDisplayPath(s), _("', but not saved..."));
264 } // Check whether the file exists
267 if (myfile.isOK() && !AskQuestion(_("Document already exists:"),
268 MakeDisplayPath(s, 50),
273 // Ok, change the name of the buffer
276 bool unnamed = buffer->isUnnamed();
277 buffer->setUnnamed(false);
279 // Small bug: If the save fails, we have irreversible changed the name
281 // Hope this is fixed this way! (Jug)
282 if (!MenuWrite(buffer)) {
283 buffer->fileName(oldname);
284 buffer->setUnnamed(unnamed);
285 ShowMessage(buffer, _("Document could not be saved!"),
286 _("Holding the old name."), MakeDisplayPath(oldname));
289 // now remove the oldname autosave file if existant!
290 removeAutosaveFile(oldname);
295 int MenuRunChktex(Buffer * buffer)
299 if (buffer->isSGML()) {
300 WriteAlert(_("Chktex does not work with SGML derived documents."));
303 ret = buffer->runChktex();
309 s = _("No warnings found.");
310 } else if (ret == 1) {
311 s = _("One warning found.");
312 t = _("Use 'Edit->Go to Error' to find it.");
315 s += _(" warnings found.");
316 t = _("Use 'Edit->Go to Error' to find them.");
318 WriteAlert(_("Chktex run successfully"), s, t);
320 WriteAlert(_("Error!"), _("It seems chktex does not work."));
326 void MenuFax(Buffer * buffer)
328 // Generate postscript file
329 if (!Exporter::Export(buffer, "ps", true))
333 string const ps = OnlyFilename(ChangeExtension(buffer->fileName(),
336 string path = OnlyPath (buffer->fileName());
337 if (lyxrc.use_tempdir || (IsDirWriteable(path) < 1)) {
338 path = buffer->tmppath;
341 if (!lyxrc.fax_program.empty()) {
342 string help2 = subst(lyxrc.fax_program, "$$FName", ps);
344 Systemcalls one(Systemcalls::System, help2);
346 send_fax(ps, lyxrc.fax_command);
352 lyxerr.debug() << "Running QuitLyX." << endl;
354 if (!bufferlist.QwriteAll())
357 lastfiles->writeFile(lyxrc.lastfiles);
359 // Set a flag that we do quitting from the program,
360 // so no refreshes are necessary.
363 // close buffers first
364 bufferlist.closeAll();
366 // do any other cleanup procedures now
367 lyxerr.debug() << "Deleting tmp dir " << system_tempdir << endl;
369 DestroyLyXTmpDir(system_tempdir);
376 void AutoSave(BufferView * bv)
377 // should probably be moved into BufferList (Lgb)
378 // Perfect target for a thread...
380 if (!bv->available())
383 if (bv->buffer()->isBakClean() || bv->buffer()->isReadonly()) {
384 // We don't save now, but we'll try again later
385 bv->owner()->resetAutosaveTimer();
389 bv->owner()->getMiniBuffer()->Set(_("Autosaving current document..."));
391 // create autosave filename
392 string fname = OnlyPath(bv->buffer()->fileName());
394 fname += OnlyFilename(bv->buffer()->fileName());
397 // tmp_ret will be located (usually) in /tmp
398 // will that be a problem?
399 string tmp_ret = tmpnam(0);
401 pid_t pid = fork(); // If you want to debug the autosave
402 // you should set pid to -1, and comment out the
404 if (pid == 0 || pid == -1) {
405 // pid = -1 signifies that lyx was unable
406 // to fork. But we will do the save
409 if (!tmp_ret.empty()) {
410 bv->buffer()->writeFile(tmp_ret, 1);
411 // assume successful write of tmp_ret
412 if (lyx::rename(tmp_ret, fname)) {
414 // most likely couldn't move between filesystems
415 // unless write of tmp_ret failed
416 // so remove tmp file (if it exists)
417 lyx::unlink(tmp_ret);
424 // failed to write/rename tmp_ret so try writing direct
425 if (!bv->buffer()->writeFile(fname, 1)) {
426 // It is dangerous to do this in the child,
427 // but safe in the parent, so...
429 bv->owner()->getMiniBuffer()->Set(_("Autosave Failed!"));
432 if (pid == 0) { // we are the child so...
437 bv->buffer()->markBakClean();
438 bv->owner()->resetAutosaveTimer();
443 // Copyright CHT Software Service GmbH
446 // create new file with template
449 Buffer * NewLyxFile(string const & filename)
451 // Split argument by :
453 string tmpname = split(filename, name, ':');
454 #ifdef __EMX__ // Fix me! lyx_cb.C may not be low level enough to allow this.
455 if (name.length() == 1
456 && isalpha(static_cast<unsigned char>(name[0]))
457 && (prefixIs(tmpname, "/") || prefixIs(tmpname, "\\"))) {
459 name += token(tmpname, ':', 0);
460 tmpname = split(tmpname, ':');
463 lyxerr.debug() << "Arg is " << filename
464 << "\nName is " << name
465 << "\nTemplate is " << tmpname << endl;
467 // find a free buffer
468 Buffer * tmpbuf = bufferlist.newFile(name, tmpname);
470 lastfiles->newFile(tmpbuf->fileName());
475 // Insert ascii file (if filename is empty, prompt for one)
476 void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
481 if (!bv->available()) return;
485 fname = fileDlg.Select(_("File to Insert"),
486 bv->owner()->buffer()->filepath,
489 if (fname.empty()) return;
494 if (!fi.readable()) {
495 WriteFSAlert(_("Error! Specified file is unreadable: "),
496 MakeDisplayPath(fname, 50));
500 ifstream ifs(fname.c_str());
502 WriteFSAlert(_("Error! Cannot open specified file: "),
503 MakeDisplayPath(fname, 50));
507 ifs.unsetf(ios::skipws);
508 istream_iterator<char> ii(ifs);
509 istream_iterator<char> end;
510 #if !defined(USE_INCLUDED_STRING) && !defined(STD_STRING_IS_GOOD)
511 // We use this until the compilers get better...
513 copy(ii, end, back_inserter(tmp));
514 string tmpstr(tmp.begin(), tmp.end());
516 // This is what we want to use and what we will use once the
517 // compilers get good enough.
518 //string tmpstr(ii, end); // yet a reason for using std::string
519 // alternate approach to get the file into a string:
521 copy(ii, end, back_inserter(tmpstr));
526 // clear the selection
529 bv->text->InsertStringA(bv, tmpstr);
531 bv->text->InsertStringB(bv, tmpstr);
532 bv->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
536 void MenuInsertLabel(string const & arg)
539 ProhibitInput(current_view);
542 result = askForText(_("Enter new label to insert:"));
544 label = frontStrip(strip(result.second));
547 if (!label.empty()) {
548 InsetCommandParams p( "label", label );
549 InsetLabel * inset = new InsetLabel( p );
550 current_view->insertInset( inset );
552 AllowInput(current_view);
556 // This is _only_ used in Toolbar_pimpl.C, move it there and get rid of
557 // current_view. (Lgb)
558 void LayoutsCB(int sel, void *, Combox *)
560 string tmp = tostr(sel);
561 current_view->owner()->getLyXFunc()->Dispatch(LFUN_LAYOUTNO,
566 void MenuLayoutCharacter()
568 static int ow = -1, oh;
570 if (fd_form_character->form_character->visible) {
571 fl_raise_form(fd_form_character->form_character);
573 fl_show_form(fd_form_character->form_character,
574 FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
575 _("Character Style"));
577 ow = fd_form_character->form_character->w;
578 oh = fd_form_character->form_character->h;
580 fl_set_form_minsize(fd_form_character->form_character, ow, oh);
585 bool UpdateLayoutPreamble()
588 if (!current_view->available())
592 fl_set_input(fd_form_preamble->input_preamble,
593 current_view->buffer()->params.preamble.c_str());
595 if (current_view->buffer()->isReadonly()) {
596 fl_deactivate_object(fd_form_preamble->input_preamble);
597 fl_deactivate_object(fd_form_preamble->button_ok);
598 fl_deactivate_object(fd_form_preamble->button_apply);
599 fl_set_object_lcol(fd_form_preamble->button_ok, FL_INACTIVE);
600 fl_set_object_lcol(fd_form_preamble->button_apply, FL_INACTIVE);
603 fl_activate_object(fd_form_preamble->input_preamble);
604 fl_activate_object(fd_form_preamble->button_ok);
605 fl_activate_object(fd_form_preamble->button_apply);
606 fl_set_object_lcol(fd_form_preamble->button_ok, FL_BLACK);
607 fl_set_object_lcol(fd_form_preamble->button_apply, FL_BLACK);
609 } else if (fd_form_preamble->form_preamble->visible) {
610 fl_hide_form(fd_form_preamble->form_preamble);
616 void MenuLayoutPreamble()
618 static int ow = -1, oh;
620 if (UpdateLayoutPreamble()) {
621 if (fd_form_preamble->form_preamble->visible) {
622 fl_raise_form(fd_form_preamble->form_preamble);
624 fl_show_form(fd_form_preamble->form_preamble,
625 FL_PLACE_MOUSE | FL_FREE_SIZE,
627 _("LaTeX Preamble"));
629 ow = fd_form_preamble->form_preamble->w;
630 oh = fd_form_preamble->form_preamble->h;
632 fl_set_form_minsize(fd_form_preamble->form_preamble,
639 void MenuLayoutSave()
641 if (!current_view->available())
644 if (AskQuestion(_("Do you want to save the current settings"),
645 _("for Character, Document, Paper and Quotes"),
646 _("as default for new documents?")))
647 current_view->buffer()->saveParamsAsDefaults();
651 // This is both GUI and LyXFont dependent. Don't know where to put it. (Asger)
652 // Well, it's mostly GUI dependent, so I guess it will stay here. (Asger)
653 LyXFont const UserFreeFont(BufferParams const & params)
655 LyXFont font(LyXFont::ALL_IGNORE);
657 int pos = fl_get_choice(fd_form_character->choice_family);
659 case 1: font.setFamily(LyXFont::IGNORE_FAMILY); break;
660 case 2: font.setFamily(LyXFont::ROMAN_FAMILY); break;
661 case 3: font.setFamily(LyXFont::SANS_FAMILY); break;
662 case 4: font.setFamily(LyXFont::TYPEWRITER_FAMILY); break;
663 case 5: font.setFamily(LyXFont::INHERIT_FAMILY); break;
666 pos = fl_get_choice(fd_form_character->choice_series);
668 case 1: font.setSeries(LyXFont::IGNORE_SERIES); break;
669 case 2: font.setSeries(LyXFont::MEDIUM_SERIES); break;
670 case 3: font.setSeries(LyXFont::BOLD_SERIES); break;
671 case 4: font.setSeries(LyXFont::INHERIT_SERIES); break;
674 pos = fl_get_choice(fd_form_character->choice_shape);
676 case 1: font.setShape(LyXFont::IGNORE_SHAPE); break;
677 case 2: font.setShape(LyXFont::UP_SHAPE); break;
678 case 3: font.setShape(LyXFont::ITALIC_SHAPE); break;
679 case 4: font.setShape(LyXFont::SLANTED_SHAPE); break;
680 case 5: font.setShape(LyXFont::SMALLCAPS_SHAPE); break;
681 case 6: font.setShape(LyXFont::INHERIT_SHAPE); break;
684 pos = fl_get_choice(fd_form_character->choice_size);
686 case 1: font.setSize(LyXFont::IGNORE_SIZE); break;
687 case 2: font.setSize(LyXFont::SIZE_TINY); break;
688 case 3: font.setSize(LyXFont::SIZE_SCRIPT); break;
689 case 4: font.setSize(LyXFont::SIZE_FOOTNOTE); break;
690 case 5: font.setSize(LyXFont::SIZE_SMALL); break;
691 case 6: font.setSize(LyXFont::SIZE_NORMAL); break;
692 case 7: font.setSize(LyXFont::SIZE_LARGE); break;
693 case 8: font.setSize(LyXFont::SIZE_LARGER); break;
694 case 9: font.setSize(LyXFont::SIZE_LARGEST); break;
695 case 10: font.setSize(LyXFont::SIZE_HUGE); break;
696 case 11: font.setSize(LyXFont::SIZE_HUGER); break;
697 case 12: font.setSize(LyXFont::INCREASE_SIZE); break;
698 case 13: font.setSize(LyXFont::DECREASE_SIZE); break;
699 case 14: font.setSize(LyXFont::INHERIT_SIZE); break;
702 pos = fl_get_choice(fd_form_character->choice_bar);
704 case 1: font.setEmph(LyXFont::IGNORE);
705 font.setUnderbar(LyXFont::IGNORE);
706 font.setNoun(LyXFont::IGNORE);
707 font.setLatex(LyXFont::IGNORE);
709 case 2: font.setEmph(LyXFont::TOGGLE); break;
710 case 3: font.setUnderbar(LyXFont::TOGGLE); break;
711 case 4: font.setNoun(LyXFont::TOGGLE); break;
712 case 5: font.setLatex(LyXFont::TOGGLE); break;
713 case 6: font.setEmph(LyXFont::INHERIT);
714 font.setUnderbar(LyXFont::INHERIT);
715 font.setNoun(LyXFont::INHERIT);
716 font.setLatex(LyXFont::INHERIT);
720 pos = fl_get_choice(fd_form_character->choice_color);
722 case 1: font.setColor(LColor::ignore); break;
723 case 2: font.setColor(LColor::none); break;
724 case 3: font.setColor(LColor::black); break;
725 case 4: font.setColor(LColor::white); break;
726 case 5: font.setColor(LColor::red); break;
727 case 6: font.setColor(LColor::green); break;
728 case 7: font.setColor(LColor::blue); break;
729 case 8: font.setColor(LColor::cyan); break;
730 case 9: font.setColor(LColor::magenta); break;
731 case 10: font.setColor(LColor::yellow); break;
732 case 11: font.setColor(LColor::inherit); break;
735 int choice = combo_language2->get();
737 font.setLanguage(ignore_language);
738 else if (choice == 2)
739 font.setLanguage(params.language_info);
741 font.setLanguage(&languages[combo_language2->getline()]);
747 /* callbacks for form form_title */
748 extern "C" void TimerCB(FL_OBJECT *, long)
750 // only if the form still exists
751 if (lyxrc.show_banner && fd_form_title->form_title != 0) {
752 if (fd_form_title->form_title->visible) {
753 fl_hide_form(fd_form_title->form_title);
755 fl_free_form(fd_form_title->form_title);
756 fd_form_title->form_title = 0;
761 /* callbacks for form form_character */
763 extern "C" void CharacterApplyCB(FL_OBJECT *, long)
765 // we set toggleall locally here, since it should be true for
766 // all other uses of ToggleAndShow() (JMarc)
767 toggleall = fl_get_button(fd_form_character->check_toggle_all);
768 ToggleAndShow(current_view, UserFreeFont(current_view->buffer()->params));
769 current_view->setState();
774 extern "C" void CharacterCloseCB(FL_OBJECT *, long)
776 fl_hide_form(fd_form_character->form_character);
780 extern "C" void CharacterOKCB(FL_OBJECT *ob, long data)
782 CharacterApplyCB(ob, data);
783 CharacterCloseCB(ob, data);
787 /* callbacks for form form_preamble */
789 extern "C" void PreambleCancelCB(FL_OBJECT *, long)
791 fl_hide_form(fd_form_preamble->form_preamble);
795 extern "C" void PreambleApplyCB(FL_OBJECT *, long)
797 if (!current_view->available())
800 current_view->buffer()->params.preamble =
801 fl_get_input(fd_form_preamble->input_preamble);
802 current_view->buffer()->markDirty();
803 current_view->owner()->getMiniBuffer()->Set(_("LaTeX preamble set"));
807 extern "C" void PreambleOKCB(FL_OBJECT * ob, long data)
809 PreambleApplyCB(ob, data);
810 PreambleCancelCB(ob, data);
816 if (fd_form_figure->form_figure->visible) {
817 fl_raise_form(fd_form_figure->form_figure);
819 fl_show_form(fd_form_figure->form_figure,
820 FL_PLACE_MOUSE, FL_FULLBORDER,
826 /* callbacks for form form_figure */
828 void FigureApplyCB(FL_OBJECT *, long)
830 if (!current_view->available())
833 Buffer * buffer = current_view->buffer();
834 if(buffer->isReadonly()) // paranoia
837 current_view->owner()->getMiniBuffer()->Set(_("Inserting figure..."));
838 if (fl_get_button(fd_form_figure->radio_inline)) {
839 InsetFig * new_inset = new InsetFig(100, 20, *buffer);
840 current_view->insertInset(new_inset);
841 current_view->owner()->getMiniBuffer()->Set(_("Figure inserted"));
842 new_inset->Edit(current_view, 0, 0, 0);
846 current_view->hideCursor();
847 current_view->update(BufferView::SELECT|BufferView::FITCUR);
848 current_view->beforeChange();
850 current_view->text->SetCursorParUndo(current_view->buffer());
851 current_view->text->FreezeUndo();
853 current_view->text->BreakParagraph(current_view);
854 current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
856 if (current_view->text->cursor.par()->Last()) {
857 current_view->text->CursorLeft(current_view);
859 current_view->text->BreakParagraph(current_view);
860 current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
863 // The standard layout should always be numer 0;
864 current_view->text->SetLayout(current_view, 0);
867 if (current_view->text->cursor.par()->footnoteflag ==
868 LyXParagraph::NO_FOOTNOTE) {
871 SetParagraph(current_view, 0, 0,
873 VSpace (0.3 * buffer->params.spacing.getValue(),
876 buffer->params.spacing.getValue(),
878 LYX_ALIGN_CENTER, string(), 0);
881 current_view->text->SetParagraph(current_view, 0, 0,
883 VSpace(VSpace::NONE),
884 VSpace(VSpace::NONE),
891 current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
893 Inset * new_inset = new InsetFig(100, 100, *buffer);
894 current_view->insertInset(new_inset);
895 new_inset->Edit(current_view, 0, 0, 0);
896 current_view->update(BufferView::SELECT|BufferView::FITCUR);
897 current_view->owner()->getMiniBuffer()->Set(_("Figure inserted"));
898 current_view->text->UnFreezeUndo();
899 current_view->setState();
903 extern "C" void FigureCancelCB(FL_OBJECT *, long)
905 fl_hide_form(fd_form_figure->form_figure);
909 extern "C" void FigureOKCB(FL_OBJECT * ob, long data)
911 FigureApplyCB(ob, data);
912 FigureCancelCB(ob, data);
916 // This function runs "configure" and then rereads lyx.defaults to
917 // reconfigure the automatic settings.
918 void Reconfigure(BufferView * bv)
920 bv->owner()->getMiniBuffer()->Set(_("Running configure..."));
922 // Run configure in user lyx directory
924 Systemcalls one(Systemcalls::System,
925 AddName(system_lyxdir, "configure"));
927 bv->owner()->getMiniBuffer()->Set(_("Reloading configuration..."));
928 lyxrc.read(LibFileSearch(string(), "lyxrc.defaults"));
929 WriteAlert(_("The system has been reconfigured."),
930 _("You need to restart LyX to make use of any"),
931 _("updated document class specifications."));