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 "support/lyxlib.h"
41 //#include "lyxserver.h"
44 //#include "CutAndPaste.h"
45 //#include "exporter.h"
49 using std::back_inserter;
53 using std::istream_iterator;
59 extern Combox * combo_language;
60 extern Combox * combo_language2;
61 extern BufferList bufferlist;
62 extern void show_symbols_form();
63 extern FD_form_title * fd_form_title;
64 extern FD_form_character * fd_form_character;
65 extern FD_form_preamble * fd_form_preamble;
66 extern FD_form_figure * fd_form_figure;
68 extern BufferView * current_view; // called too many times in this file...
70 extern void DeleteSimpleCutBuffer(); /* for the cleanup when exiting */
73 extern bool send_fax(string const & fname, string const & sendcmd);
76 extern void MenuSendto();
78 //extern LyXServer * lyxserver;
80 // this should be static, but I need it in buffer.C
81 bool quitting; // flag, that we are quitting the program
82 extern bool finished; // all cleanup done just let it run through now.
84 char ascii_type; /* for selection notify callbacks */
86 bool scrolling = false;
88 // This is used to make the dreaded font toggle problem hopefully go
89 // away. Definitely not the best solution, but I think it sorta works.
90 bool toggleall = true;
93 This is the inset locking stuff needed for mathed --------------------
95 an inset can simple call LockInset in it's edit call and *ONLY* in it's
97 Inset::Edit() can only be called by the main lyx module.
99 Then the inset may modify the menu's and/or iconbars.
101 Unlocking is either done by LyX or the inset itself with a UnlockInset-call
103 During the lock, all button and keyboard events will be modified
104 and send to the inset through the following inset-features. Note that
105 Inset::InsetUnlock will be called from inside UnlockInset. It is meant
106 to contain the code for restoring the menus and things like this.
109 virtual void InsetButtonPress(int x, int y, int button);
110 virtual void InsetButtonRelease(int x, int y, int button);
111 virtual void InsetKeyPress(XKeyEvent *ev);
112 virtual void InsetMotionNotify(int x, int y, int state);
113 virtual void InsetUnlock();
115 If a inset wishes any redraw and/or update it just has to call
117 It's is completly irrelevant, where the inset is. UpdateInset will
118 find it in any paragraph in any buffer.
119 Of course the_locking_inset and the insets in the current paragraph/buffer
120 are checked first, so no performance problem should occur.
122 Hope that's ok for the beginning, Alejandro,
123 sorry that I needed so much time,
128 //void UpdateInset(BufferView * bv, Inset * inset, bool mark_dirty = true);
130 /* these functions return 1 if an error occured,
132 // Now they work only for updatable insets. [Alejandro 080596]
133 //int LockInset(UpdatableInset * inset);
134 void ToggleLockedInsetCursor(int x, int y, int asc, int desc);
135 //void FitLockedInsetCursor(long x, long y, int asc, int desc);
136 //int UnlockInset(UpdatableInset * inset);
137 //void LockedInsetStoreUndo(Undo::undo_kind kind);
139 /* this is for asyncron updating. UpdateInsetUpdateList will be called
140 automatically from LyX. Just insert the Inset into the Updatelist */
141 //void UpdateInsetUpdateList();
142 //void PutInsetIntoInsetUpdateList(Inset * inset);
144 //InsetUpdateStruct * InsetUpdateList = 0;
148 -----------------------------------------------------------------------
151 /* some function prototypes */
153 int RunLinuxDoc(BufferView *, int, string const &);
154 int RunDocBook(int, string const &);
155 bool MenuWrite(Buffer * buf);
156 bool MenuWriteAs(Buffer * buffer);
157 void MenuReload(Buffer * buf);
158 void MenuLayoutSave();
161 void ShowMessage(Buffer const * buf,
164 string const & msg3, int delay)
167 buf->getUser()->owner()->getMiniBuffer()->Set(msg1, msg2,
170 lyxerr << msg1 << msg2 << msg3 << endl;
182 // should be moved to lyxfunc.C
183 bool MenuWrite(Buffer * buffer)
185 XFlush(fl_get_display());
186 if (!buffer->save()) {
187 string fname = buffer->fileName();
188 string s = MakeAbsPath(fname);
189 if (AskQuestion(_("Save failed. Rename and try again?"),
190 MakeDisplayPath(s, 50),
191 _("(If not, document is not saved.)"))) {
192 return MenuWriteAs(buffer);
196 lastfiles->newFile(buffer->fileName());
202 // should be moved to BufferView.C
203 // Half of this func should be in LyXView, the rest in BufferView.
204 bool MenuWriteAs(Buffer * buffer)
206 // Why do we require BufferView::text to be able to write a
207 // document? I see no point in that. (Lgb)
208 //if (!bv->text) return;
210 string fname = buffer->fileName();
211 string oldname = fname;
214 ProhibitInput(current_view);
215 fileDlg.SetButton(0, _("Documents"), lyxrc.document_path);
216 fileDlg.SetButton(1, _("Templates"), lyxrc.template_path);
218 if (!IsLyXFilename(fname))
221 if (buffer->isUnnamed()) {
222 fname = fileDlg.Select(_("Enter Filename to Save Document as"),
227 fname = fileDlg.Select(_("Enter Filename to Save Document as"),
230 OnlyFilename(fname));
232 AllowInput(current_view);
237 // Make sure the absolute filename ends with appropriate suffix
238 string s = MakeAbsPath(fname);
239 if (!IsLyXFilename(s))
242 // Same name as we have already?
244 if (!AskQuestion(_("Same name as document already has:"),
245 MakeDisplayPath(s, 50),
248 // Falls through to name change and save
250 // No, but do we have another file with this name open?
251 else if (bufferlist.exists(s)) {
252 if (AskQuestion(_("Another document with same name open!"),
253 MakeDisplayPath(s, 50),
254 _("Replace with current document?")))
256 bufferlist.close(bufferlist.getBuffer(s));
258 // Ok, change the name of the buffer, but don't save!
259 buffer->setFileName(s);
262 ShowMessage(buffer, _("Document renamed to '"),
263 MakeDisplayPath(s), _("', but not saved..."));
266 } // Check whether the file exists
269 if (myfile.isOK() && !AskQuestion(_("Document already exists:"),
270 MakeDisplayPath(s, 50),
275 // Ok, change the name of the buffer
276 buffer->setFileName(s);
278 bool unnamed = buffer->isUnnamed();
279 buffer->setUnnamed(false);
281 // Small bug: If the save fails, we have irreversible changed the name
283 // Hope this is fixed this way! (Jug)
284 if (!MenuWrite(buffer)) {
285 buffer->setFileName(oldname);
286 buffer->setUnnamed(unnamed);
287 ShowMessage(buffer, _("Document could not be saved!"),
288 _("Holding the old name."), MakeDisplayPath(oldname));
291 // now remove the oldname autosave file if existant!
292 removeAutosaveFile(oldname);
297 int MenuRunChktex(Buffer * buffer)
301 if (buffer->isSGML()) {
302 WriteAlert(_("Chktex does not work with SGML derived documents."));
305 ret = buffer->runChktex();
311 s = _("No warnings found.");
312 } else if (ret == 1) {
313 s = _("One warning found.");
314 t = _("Use 'Edit->Go to Error' to find it.");
317 s += _(" warnings found.");
318 t = _("Use 'Edit->Go to Error' to find them.");
320 WriteAlert(_("Chktex run successfully"), s, t);
322 WriteAlert(_("Error!"), _("It seems chktex does not work."));
328 void MenuFax(Buffer * buffer)
330 // Generate postscript file
331 if (!Exporter::Export(buffer, "ps", true))
335 string const ps = OnlyFilename(ChangeExtension(buffer->fileName(),
338 string path = OnlyPath (buffer->fileName());
339 if (lyxrc.use_tempdir || (IsDirWriteable(path) < 1)) {
340 path = buffer->tmppath;
343 if (!lyxrc.fax_program.empty()) {
344 string help2 = subst(lyxrc.fax_program, "$$FName", ps);
346 Systemcalls one(Systemcalls::System, help2);
348 send_fax(ps, lyxrc.fax_command);
355 lyxerr.debug() << "Running QuitLyX." << endl;
357 if (!bufferlist.QwriteAll())
360 lastfiles->writeFile(lyxrc.lastfiles);
362 // Set a flag that we do quitting from the program,
363 // so no refreshes are necessary.
366 // close buffers first
367 bufferlist.closeAll();
369 // do any other cleanup procedures now
370 lyxerr.debug() << "Deleting tmp dir " << system_tempdir << endl;
372 DestroyLyXTmpDir(system_tempdir);
379 void AutoSave(BufferView * bv)
380 // should probably be moved into BufferList (Lgb)
381 // Perfect target for a thread...
383 if (!bv->available())
386 if (bv->buffer()->isBakClean() || bv->buffer()->isReadonly()) {
387 // We don't save now, but we'll try again later
388 bv->owner()->resetAutosaveTimer();
392 bv->owner()->getMiniBuffer()->Set(_("Autosaving current document..."));
394 // create autosave filename
395 string fname = OnlyPath(bv->buffer()->fileName());
397 fname += OnlyFilename(bv->buffer()->fileName());
400 // tmp_ret will be located (usually) in /tmp
401 // will that be a problem?
402 pid_t pid = fork(); // If you want to debug the autosave
403 // you should set pid to -1, and comment out the
405 if (pid == 0 || pid == -1) {
406 // pid = -1 signifies that lyx was unable
407 // to fork. But we will do the save
411 string tmp_ret = lyx::tempName();
412 if (!tmp_ret.empty()) {
413 bv->buffer()->writeFile(tmp_ret, 1);
414 // assume successful write of tmp_ret
415 if (lyx::rename(tmp_ret, fname)) {
417 // most likely couldn't move between filesystems
418 // unless write of tmp_ret failed
419 // so remove tmp file (if it exists)
420 lyx::unlink(tmp_ret);
427 // failed to write/rename tmp_ret so try writing direct
428 if (!bv->buffer()->writeFile(fname, 1)) {
429 // It is dangerous to do this in the child,
430 // but safe in the parent, so...
432 bv->owner()->getMiniBuffer()->Set(_("Autosave Failed!"));
435 if (pid == 0) { // we are the child so...
440 bv->buffer()->markBakClean();
441 bv->owner()->resetAutosaveTimer();
446 // Copyright CHT Software Service GmbH
449 // create new file with template
452 Buffer * NewLyxFile(string const & filename)
454 // Split argument by :
456 string tmpname = split(filename, name, ':');
457 #ifdef __EMX__ // Fix me! lyx_cb.C may not be low level enough to allow this.
458 if (name.length() == 1
459 && isalpha(static_cast<unsigned char>(name[0]))
460 && (prefixIs(tmpname, "/") || prefixIs(tmpname, "\\"))) {
462 name += token(tmpname, ':', 0);
463 tmpname = split(tmpname, ':');
466 lyxerr.debug() << "Arg is " << filename
467 << "\nName is " << name
468 << "\nTemplate is " << tmpname << endl;
470 // find a free buffer
471 Buffer * tmpbuf = bufferlist.newFile(name, tmpname);
473 lastfiles->newFile(tmpbuf->fileName());
478 // Insert ascii file (if filename is empty, prompt for one)
479 void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
484 if (!bv->available()) return;
488 fname = fileDlg.Select(_("File to Insert"),
489 bv->owner()->buffer()->filepath,
492 if (fname.empty()) return;
497 if (!fi.readable()) {
498 WriteFSAlert(_("Error! Specified file is unreadable: "),
499 MakeDisplayPath(fname, 50));
503 ifstream ifs(fname.c_str());
505 WriteFSAlert(_("Error! Cannot open specified file: "),
506 MakeDisplayPath(fname, 50));
510 ifs.unsetf(ios::skipws);
511 istream_iterator<char> ii(ifs);
512 istream_iterator<char> end;
513 #if !defined(USE_INCLUDED_STRING) && !defined(STD_STRING_IS_GOOD)
514 // We use this until the compilers get better...
516 copy(ii, end, back_inserter(tmp));
517 string tmpstr(tmp.begin(), tmp.end());
519 // This is what we want to use and what we will use once the
520 // compilers get good enough.
521 //string tmpstr(ii, end); // yet a reason for using std::string
522 // alternate approach to get the file into a string:
524 copy(ii, end, back_inserter(tmpstr));
529 // clear the selection
532 bv->text->InsertStringA(bv, tmpstr);
534 bv->text->InsertStringB(bv, tmpstr);
535 bv->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
539 void MenuInsertLabel(string const & arg)
542 ProhibitInput(current_view);
545 result = askForText(_("Enter new label to insert:"));
547 label = frontStrip(strip(result.second));
550 if (!label.empty()) {
551 InsetCommandParams p( "label", label );
552 InsetLabel * inset = new InsetLabel( p );
553 current_view->insertInset( inset );
555 AllowInput(current_view);
559 // This is _only_ used in Toolbar_pimpl.C, move it there and get rid of
560 // current_view. (Lgb)
561 void LayoutsCB(int sel, void *, Combox *)
563 string tmp = tostr(sel);
564 current_view->owner()->getLyXFunc()->Dispatch(LFUN_LAYOUTNO,
569 void MenuLayoutCharacter()
571 static int ow = -1, oh;
573 if (fd_form_character->form_character->visible) {
574 fl_raise_form(fd_form_character->form_character);
576 fl_show_form(fd_form_character->form_character,
577 FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT,
578 _("Character Style"));
580 ow = fd_form_character->form_character->w;
581 oh = fd_form_character->form_character->h;
583 fl_set_form_minsize(fd_form_character->form_character, ow, oh);
588 bool UpdateLayoutPreamble()
591 if (!current_view->available())
595 fl_set_input(fd_form_preamble->input_preamble,
596 current_view->buffer()->params.preamble.c_str());
598 if (current_view->buffer()->isReadonly()) {
599 fl_deactivate_object(fd_form_preamble->input_preamble);
600 fl_deactivate_object(fd_form_preamble->button_ok);
601 fl_deactivate_object(fd_form_preamble->button_apply);
602 fl_set_object_lcol(fd_form_preamble->button_ok, FL_INACTIVE);
603 fl_set_object_lcol(fd_form_preamble->button_apply, FL_INACTIVE);
606 fl_activate_object(fd_form_preamble->input_preamble);
607 fl_activate_object(fd_form_preamble->button_ok);
608 fl_activate_object(fd_form_preamble->button_apply);
609 fl_set_object_lcol(fd_form_preamble->button_ok, FL_BLACK);
610 fl_set_object_lcol(fd_form_preamble->button_apply, FL_BLACK);
612 } else if (fd_form_preamble->form_preamble->visible) {
613 fl_hide_form(fd_form_preamble->form_preamble);
619 void MenuLayoutPreamble()
621 static int ow = -1, oh;
623 if (UpdateLayoutPreamble()) {
624 if (fd_form_preamble->form_preamble->visible) {
625 fl_raise_form(fd_form_preamble->form_preamble);
627 fl_show_form(fd_form_preamble->form_preamble,
628 FL_PLACE_MOUSE | FL_FREE_SIZE,
630 _("LaTeX Preamble"));
632 ow = fd_form_preamble->form_preamble->w;
633 oh = fd_form_preamble->form_preamble->h;
635 fl_set_form_minsize(fd_form_preamble->form_preamble,
642 void MenuLayoutSave()
644 if (!current_view->available())
647 if (AskQuestion(_("Do you want to save the current settings"),
648 _("for Character, Document, Paper and Quotes"),
649 _("as default for new documents?")))
650 current_view->buffer()->saveParamsAsDefaults();
654 // This is both GUI and LyXFont dependent. Don't know where to put it. (Asger)
655 // Well, it's mostly GUI dependent, so I guess it will stay here. (Asger)
656 LyXFont const UserFreeFont(BufferParams const & params)
658 LyXFont font(LyXFont::ALL_IGNORE);
660 int pos = fl_get_choice(fd_form_character->choice_family);
662 case 1: font.setFamily(LyXFont::IGNORE_FAMILY); break;
663 case 2: font.setFamily(LyXFont::ROMAN_FAMILY); break;
664 case 3: font.setFamily(LyXFont::SANS_FAMILY); break;
665 case 4: font.setFamily(LyXFont::TYPEWRITER_FAMILY); break;
666 case 5: font.setFamily(LyXFont::INHERIT_FAMILY); break;
669 pos = fl_get_choice(fd_form_character->choice_series);
671 case 1: font.setSeries(LyXFont::IGNORE_SERIES); break;
672 case 2: font.setSeries(LyXFont::MEDIUM_SERIES); break;
673 case 3: font.setSeries(LyXFont::BOLD_SERIES); break;
674 case 4: font.setSeries(LyXFont::INHERIT_SERIES); break;
677 pos = fl_get_choice(fd_form_character->choice_shape);
679 case 1: font.setShape(LyXFont::IGNORE_SHAPE); break;
680 case 2: font.setShape(LyXFont::UP_SHAPE); break;
681 case 3: font.setShape(LyXFont::ITALIC_SHAPE); break;
682 case 4: font.setShape(LyXFont::SLANTED_SHAPE); break;
683 case 5: font.setShape(LyXFont::SMALLCAPS_SHAPE); break;
684 case 6: font.setShape(LyXFont::INHERIT_SHAPE); break;
687 pos = fl_get_choice(fd_form_character->choice_size);
689 case 1: font.setSize(LyXFont::IGNORE_SIZE); break;
690 case 2: font.setSize(LyXFont::SIZE_TINY); break;
691 case 3: font.setSize(LyXFont::SIZE_SCRIPT); break;
692 case 4: font.setSize(LyXFont::SIZE_FOOTNOTE); break;
693 case 5: font.setSize(LyXFont::SIZE_SMALL); break;
694 case 6: font.setSize(LyXFont::SIZE_NORMAL); break;
695 case 7: font.setSize(LyXFont::SIZE_LARGE); break;
696 case 8: font.setSize(LyXFont::SIZE_LARGER); break;
697 case 9: font.setSize(LyXFont::SIZE_LARGEST); break;
698 case 10: font.setSize(LyXFont::SIZE_HUGE); break;
699 case 11: font.setSize(LyXFont::SIZE_HUGER); break;
700 case 12: font.setSize(LyXFont::INCREASE_SIZE); break;
701 case 13: font.setSize(LyXFont::DECREASE_SIZE); break;
702 case 14: font.setSize(LyXFont::INHERIT_SIZE); break;
705 pos = fl_get_choice(fd_form_character->choice_bar);
707 case 1: font.setEmph(LyXFont::IGNORE);
708 font.setUnderbar(LyXFont::IGNORE);
709 font.setNoun(LyXFont::IGNORE);
710 font.setLatex(LyXFont::IGNORE);
712 case 2: font.setEmph(LyXFont::TOGGLE); break;
713 case 3: font.setUnderbar(LyXFont::TOGGLE); break;
714 case 4: font.setNoun(LyXFont::TOGGLE); break;
715 case 5: font.setLatex(LyXFont::TOGGLE); break;
716 case 6: font.setEmph(LyXFont::INHERIT);
717 font.setUnderbar(LyXFont::INHERIT);
718 font.setNoun(LyXFont::INHERIT);
719 font.setLatex(LyXFont::INHERIT);
723 pos = fl_get_choice(fd_form_character->choice_color);
725 case 1: font.setColor(LColor::ignore); break;
726 case 2: font.setColor(LColor::none); break;
727 case 3: font.setColor(LColor::black); break;
728 case 4: font.setColor(LColor::white); break;
729 case 5: font.setColor(LColor::red); break;
730 case 6: font.setColor(LColor::green); break;
731 case 7: font.setColor(LColor::blue); break;
732 case 8: font.setColor(LColor::cyan); break;
733 case 9: font.setColor(LColor::magenta); break;
734 case 10: font.setColor(LColor::yellow); break;
735 case 11: font.setColor(LColor::inherit); break;
738 int const choice = combo_language2->get();
740 font.setLanguage(ignore_language);
741 else if (choice == 2)
742 font.setLanguage(params.language);
744 font.setLanguage(languages.getLanguage(combo_language2->getline()));
750 /* callbacks for form form_title */
751 extern "C" void TimerCB(FL_OBJECT *, long)
753 // only if the form still exists
754 if (lyxrc.show_banner
756 && fd_form_title->form_title) {
757 if (fd_form_title->form_title->visible) {
758 fl_hide_form(fd_form_title->form_title);
760 fl_free_form(fd_form_title->form_title);
761 fd_form_title->form_title = 0;
766 /* callbacks for form form_character */
768 extern "C" void CharacterApplyCB(FL_OBJECT *, long)
770 // we set toggleall locally here, since it should be true for
771 // all other uses of ToggleAndShow() (JMarc)
772 toggleall = fl_get_button(fd_form_character->check_toggle_all);
773 ToggleAndShow(current_view, UserFreeFont(current_view->buffer()->params));
774 current_view->setState();
779 extern "C" void CharacterCloseCB(FL_OBJECT *, long)
781 fl_hide_form(fd_form_character->form_character);
785 extern "C" void CharacterOKCB(FL_OBJECT *ob, long data)
787 CharacterApplyCB(ob, data);
788 CharacterCloseCB(ob, data);
792 /* callbacks for form form_preamble */
794 extern "C" void PreambleCancelCB(FL_OBJECT *, long)
796 fl_hide_form(fd_form_preamble->form_preamble);
800 extern "C" void PreambleApplyCB(FL_OBJECT *, long)
802 if (!current_view->available())
805 current_view->buffer()->params.preamble =
806 fl_get_input(fd_form_preamble->input_preamble);
807 current_view->buffer()->markDirty();
808 current_view->owner()->getMiniBuffer()->Set(_("LaTeX preamble set"));
812 extern "C" void PreambleOKCB(FL_OBJECT * ob, long data)
814 PreambleApplyCB(ob, data);
815 PreambleCancelCB(ob, data);
821 if (fd_form_figure->form_figure->visible) {
822 fl_raise_form(fd_form_figure->form_figure);
824 fl_show_form(fd_form_figure->form_figure,
825 FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT,
831 /* callbacks for form form_figure */
833 void FigureApplyCB(FL_OBJECT *, long)
835 if (!current_view->available())
838 Buffer * buffer = current_view->buffer();
839 if (buffer->isReadonly()) // paranoia
842 current_view->owner()->getMiniBuffer()->Set(_("Inserting figure..."));
843 if (fl_get_button(fd_form_figure->radio_inline)) {
844 InsetFig * new_inset = new InsetFig(100, 20, *buffer);
845 current_view->insertInset(new_inset);
846 current_view->owner()->getMiniBuffer()->Set(_("Figure inserted"));
847 new_inset->Edit(current_view, 0, 0, 0);
851 current_view->hideCursor();
852 current_view->update(BufferView::SELECT|BufferView::FITCUR);
853 current_view->beforeChange();
855 current_view->text->SetCursorParUndo(current_view->buffer());
856 current_view->text->FreezeUndo();
858 current_view->text->BreakParagraph(current_view);
859 current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
861 if (current_view->text->cursor.par()->Last()) {
862 current_view->text->CursorLeft(current_view);
864 current_view->text->BreakParagraph(current_view);
865 current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
868 // The standard layout should always be numer 0;
869 current_view->text->SetLayout(current_view, 0);
872 if (current_view->text->cursor.par()->footnoteflag ==
873 LyXParagraph::NO_FOOTNOTE) {
876 SetParagraph(current_view, 0, 0,
878 VSpace (0.3 * buffer->params.spacing.getValue(),
881 buffer->params.spacing.getValue(),
883 LYX_ALIGN_CENTER, string(), 0);
886 current_view->text->SetParagraph(current_view, 0, 0,
888 VSpace(VSpace::NONE),
889 VSpace(VSpace::NONE),
896 current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
898 Inset * new_inset = new InsetFig(100, 100, *buffer);
899 current_view->insertInset(new_inset);
900 new_inset->Edit(current_view, 0, 0, 0);
901 current_view->update(BufferView::SELECT|BufferView::FITCUR);
902 current_view->owner()->getMiniBuffer()->Set(_("Figure inserted"));
903 current_view->text->UnFreezeUndo();
904 current_view->setState();
908 extern "C" void FigureCancelCB(FL_OBJECT *, long)
910 fl_hide_form(fd_form_figure->form_figure);
914 extern "C" void FigureOKCB(FL_OBJECT * ob, long data)
916 FigureApplyCB(ob, data);
917 FigureCancelCB(ob, data);
921 // This function runs "configure" and then rereads lyx.defaults to
922 // reconfigure the automatic settings.
923 void Reconfigure(BufferView * bv)
925 bv->owner()->getMiniBuffer()->Set(_("Running configure..."));
927 // Run configure in user lyx directory
929 Systemcalls one(Systemcalls::System,
930 AddName(system_lyxdir, "configure"));
932 bv->owner()->getMiniBuffer()->Set(_("Reloading configuration..."));
933 lyxrc.read(LibFileSearch(string(), "lyxrc.defaults"));
934 WriteAlert(_("The system has been reconfigured."),
935 _("You need to restart LyX to make use of any"),
936 _("updated document class specifications."));