#include FORMS_H_LOCATION
#include "lyx.h"
#include "layout_forms.h"
-#include "form1.h"
+//#include "form1.h"
#include "lyx_main.h"
#include "lyx_cb.h"
-#include "insets/insetref.h"
+//#include "insets/insetref.h"
#include "insets/insetlabel.h"
#include "insets/figinset.h"
#include "lyxfunc.h"
#include "filedlg.h"
#include "lyx_gui_misc.h"
#include "LyXView.h"
-#include "BufferView.h"
+//#include "BufferView.h"
#include "lastfiles.h"
#include "bufferview_funcs.h"
#include "support/FileInfo.h"
#include "support/syscall.h"
#include "support/filetools.h"
#include "support/path.h"
-#include "lyxserver.h"
+//#include "support/lyxlib.h"
+//#include "lyxserver.h"
#include "lyxrc.h"
#include "lyxtext.h"
-#include "CutAndPaste.h"
-#include "exporter.h"
+//#include "CutAndPaste.h"
+//#include "exporter.h"
using std::ifstream;
using std::copy;
extern void MenuSendto();
-extern LyXServer * lyxserver;
+//extern LyXServer * lyxserver;
// this should be static, but I need it in buffer.C
bool quitting; // flag, that we are quitting the program
if (!IsLyXFilename(fname))
fname += ".lyx";
- if (buffer->isUnnamed()) {
- fname = fileDlg.Select(_("Enter Filename to Save Document as"),
- "",
- "*.lyx",
- "");
- } else {
- fname = fileDlg.Select(_("Enter Filename to Save Document as"),
- OnlyPath(fname),
- "*.lyx",
- OnlyFilename(fname));
- }
+ fname = fileDlg.Select(_("Enter Filename to Save Document as"),
+ OnlyPath(fname),
+ "*.lyx",
+ OnlyFilename(fname));
+
AllowInput(current_view);
- if (fname.empty()) {
+ if (fname.empty())
return false;
- }
+
// Make sure the absolute filename ends with appropriate suffix
string s = MakeAbsPath(fname);
if (!IsLyXFilename(s))
s += ".lyx";
// Same name as we have already?
- if (s == oldname) {
+ if (!buffer->isUnnamed() && s == oldname) {
if (!AskQuestion(_("Same name as document already has:"),
MakeDisplayPath(s, 50),
_("Save anyway?")))
// Falls through to name change and save
}
// No, but do we have another file with this name open?
- else if (bufferlist.exists(s)) {
+ else if (!buffer->isUnnamed() && bufferlist.exists(s)) {
if (AskQuestion(_("Another document with same name open!"),
MakeDisplayPath(s, 50),
_("Replace with current document?")))
// tmp_ret will be located (usually) in /tmp
// will that be a problem?
- string tmp_ret = tmpnam(0);
-
pid_t pid = fork(); // If you want to debug the autosave
// you should set pid to -1, and comment out the
// fork.
// to fork. But we will do the save
// anyway.
bool failed = false;
+
+ string tmp_ret = lyx::tempName();
if (!tmp_ret.empty()) {
bv->buffer()->writeFile(tmp_ret, 1);
// assume successful write of tmp_ret
fl_raise_form(fd_form_character->form_character);
} else {
fl_show_form(fd_form_character->form_character,
- FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
+ FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT,
_("Character Style"));
if (ow < 0) {
ow = fd_form_character->form_character->w;
} else {
fl_show_form(fd_form_preamble->form_preamble,
FL_PLACE_MOUSE | FL_FREE_SIZE,
- FL_FULLBORDER,
+ FL_TRANSIENT,
_("LaTeX Preamble"));
if (ow < 0) {
ow = fd_form_preamble->form_preamble->w;
LyXFont font(LyXFont::ALL_IGNORE);
int pos = fl_get_choice(fd_form_character->choice_family);
- switch(pos) {
+ 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;
}
pos = fl_get_choice(fd_form_character->choice_series);
- switch(pos) {
+ switch (pos) {
case 1: font.setSeries(LyXFont::IGNORE_SERIES); break;
case 2: font.setSeries(LyXFont::MEDIUM_SERIES); break;
case 3: font.setSeries(LyXFont::BOLD_SERIES); break;
}
pos = fl_get_choice(fd_form_character->choice_shape);
- switch(pos) {
+ switch (pos) {
case 1: font.setShape(LyXFont::IGNORE_SHAPE); break;
case 2: font.setShape(LyXFont::UP_SHAPE); break;
case 3: font.setShape(LyXFont::ITALIC_SHAPE); break;
}
pos = fl_get_choice(fd_form_character->choice_size);
- switch(pos) {
+ switch (pos) {
case 1: font.setSize(LyXFont::IGNORE_SIZE); break;
case 2: font.setSize(LyXFont::SIZE_TINY); break;
case 3: font.setSize(LyXFont::SIZE_SCRIPT); break;
}
pos = fl_get_choice(fd_form_character->choice_bar);
- switch(pos) {
+ switch (pos) {
case 1: font.setEmph(LyXFont::IGNORE);
font.setUnderbar(LyXFont::IGNORE);
font.setNoun(LyXFont::IGNORE);
}
pos = fl_get_choice(fd_form_character->choice_color);
- switch(pos) {
+ switch (pos) {
case 1: font.setColor(LColor::ignore); break;
case 2: font.setColor(LColor::none); break;
case 3: font.setColor(LColor::black); break;
fl_raise_form(fd_form_figure->form_figure);
} else {
fl_show_form(fd_form_figure->form_figure,
- FL_PLACE_MOUSE, FL_FULLBORDER,
+ FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT,
_("Insert Figure"));
}
}
return;
Buffer * buffer = current_view->buffer();
- if(buffer->isReadonly()) // paranoia
+ if (buffer->isReadonly()) // paranoia
return;
current_view->owner()->getMiniBuffer()->Set(_("Inserting figure..."));