#include "converter.h"
#include "format.h"
#include "gettext.h"
-#include "lastfiles.h"
+#include "session.h"
#include "LColor.h"
#include "lyxlex.h"
#include "lyxfont.h"
using lyx::support::ascii_lowercase;
using lyx::support::bformat;
-using lyx::support::ExpandPath;
+using lyx::support::expandPath;
using lyx::support::getEnv;
-using lyx::support::LibFileSearch;
+using lyx::support::libFileSearch;
using lyx::support::token;
+using lyx::support::tokenPos;
using std::cout;
using std::endl;
{ "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
{ "\\custom_export_command", LyXRC::RC_CUSTOM_EXPORT_COMMAND },
{ "\\custom_export_format", LyXRC::RC_CUSTOM_EXPORT_FORMAT },
- { "\\cygwin_path_fix_needed", LyXRC::RC_CYGWIN_PATH_FIX },
{ "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
{ "\\default_language", LyXRC::RC_DEFAULT_LANGUAGE },
{ "\\default_papersize", LyXRC::RC_DEFAULT_PAPERSIZE },
{ "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
{ "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
{ "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
- { "\\lastfiles", LyXRC::RC_LASTFILES },
+ { "\\load_session", LyXRC::RC_LOADSESSION },
{ "\\make_backup", LyXRC::RC_MAKE_BACKUP },
{ "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
{ "\\num_lastfiles", LyXRC::RC_NUMLASTFILES },
{ "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES },
{ "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER },
{ "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY },
+ { "\\screen_geometry_height", LyXRC::RC_SCREEN_GEOMETRY_HEIGHT },
+ { "\\screen_geometry_width", LyXRC::RC_SCREEN_GEOMETRY_WIDTH },
+ { "\\screen_geometry_xysaved", LyXRC::RC_SCREEN_GEOMETRY_XYSAVED },
{ "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM },
{ "\\serverpipe", LyXRC::RC_SERVERPIPE },
{ "\\set_color", LyXRC::RC_SET_COLOR },
{ "\\tempdir_path", LyXRC::RC_TEMPDIRPATH },
{ "\\template_path", LyXRC::RC_TEMPLATEPATH },
{ "\\tex_allows_spaces", LyXRC::RC_TEX_ALLOWS_SPACES },
+ { "\\tex_expects_windows_paths", LyXRC::RC_TEX_EXPECTS_WINDOWS_PATHS },
{ "\\ui_file", LyXRC::RC_UIFILE },
{ "\\use_alt_language", LyXRC::RC_USE_ALT_LANG },
{ "\\use_escape_chars", LyXRC::RC_USE_ESC_CHARS },
{ "\\use_input_encoding", LyXRC::RC_USE_INP_ENC },
+ { "\\use_lastfilepos", LyXRC::RC_USELASTFILEPOS },
{ "\\use_personal_dictionary", LyXRC::RC_USE_PERS_DICT },
// compatibility with versions older than 1.4.0 only
{ "\\use_pspell", LyXRC::RC_USE_SPELL_LIB },
print_paper_flag = "-t";
print_paper_dimension_flag = "-T";
document_path.erase();
- tempdir_path = "/tmp";
view_dvi_paper_option.erase();
default_papersize = PAPER_DEFAULT;
custom_export_format = "ps";
dpi = 75;
// Because a screen typically is wider than a piece of paper:
zoom = 150;
+ geometry_width = 0;
+ geometry_height = 0;
+ geometry_xysaved = true;
wheel_jump = 5;
// Default LaTeX font size:
font_sizes[LyXFont::SIZE_TINY] = "5.0";
ascii_linelen = 65;
num_lastfiles = maxlastfiles;
check_lastfiles = true;
+ use_lastfilepos = true;
+ load_session = false;
make_backup = true;
backupdir_path.erase();
display_graphics = lyx::graphics::ColorDisplay;
language_command_local = "\\foreignlanguage{$$lang}{";
default_language = "english";
show_banner = true;
- cygwin_path_fix = false;
+ windows_style_tex_paths = false;
tex_allows_spaces = false;
date_insert_format = "%A, %e %B %Y";
cursor_follows_scrollbar = false;
case RC_INPUT: // Include file
if (lexrc.next()) {
string const tmp =
- LibFileSearch(string(),
+ libFileSearch(string(),
lexrc.getString());
if (read(tmp)) {
lexrc.printError("Error reading "
}
break;
- case RC_CYGWIN_PATH_FIX:
+ case RC_TEX_EXPECTS_WINDOWS_PATHS:
if (lexrc.next()) {
- cygwin_path_fix = lexrc.getBool();
- }
- break;
+ windows_style_tex_paths = lexrc.getBool();
+ }
+ break;
case RC_TEX_ALLOWS_SPACES:
if (lexrc.next()) {
tex_allows_spaces = lexrc.getBool();
- }
- break;
+ }
+ break;
case RC_KBMAP:
if (lexrc.next()) {
string const kmap(os::internal_path(lexrc.getString()));
if (kmap.empty()) {
// nothing
- } else if (!LibFileSearch("kbd", kmap,
+ } else if (!libFileSearch("kbd", kmap,
"kmap").empty()) {
primary_kbmap = kmap;
} else {
string const kmap(os::internal_path(lexrc.getString()));
if (kmap.empty()) {
// nothing
- } else if (!LibFileSearch("kbd", kmap,
+ } else if (!libFileSearch("kbd", kmap,
"kmap").empty()) {
secondary_kbmap = kmap;
} else {
}
break;
+ case RC_SCREEN_GEOMETRY_HEIGHT:
+ if (lexrc.next()) {
+ geometry_height = lexrc.getInteger();
+ }
+ break;
+
+ case RC_SCREEN_GEOMETRY_WIDTH:
+ if (lexrc.next()) {
+ geometry_width = lexrc.getInteger();
+ }
+ break;
+
+ case RC_SCREEN_GEOMETRY_XYSAVED:
+ if (lexrc.next()) {
+ geometry_xysaved = lexrc.getBool();
+ }
+ break;
+
case RC_WHEEL_JUMP:
if (lexrc.next()) {
wheel_jump = lexrc.getInteger();
case RC_DOCUMENTPATH:
if (lexrc.next()) {
document_path = os::internal_path(lexrc.getString());
- document_path = ExpandPath(document_path);
+ document_path = expandPath(document_path);
}
break;
case RC_TEMPLATEPATH:
if (lexrc.next()) {
template_path = os::internal_path(lexrc.getString());
- template_path = ExpandPath(template_path);
+ template_path = expandPath(template_path);
}
break;
case RC_TEMPDIRPATH:
if (lexrc.next()) {
tempdir_path = os::internal_path(lexrc.getString());
- tempdir_path = ExpandPath(tempdir_path);
+ tempdir_path = expandPath(tempdir_path);
}
break;
}
break;
- case RC_LASTFILES:
+ case RC_USELASTFILEPOS:
+ if (lexrc.next()) {
+ use_lastfilepos = lexrc.getBool();
+ }
+ break;
+
+ case RC_LOADSESSION:
if (lexrc.next()) {
- lastfiles = ExpandPath(os::internal_path(lexrc.getString()));
+ load_session = lexrc.getBool();
}
break;
case RC_SERVERPIPE:
if (lexrc.next()) {
lyxpipes = os::internal_path(lexrc.getString());
- lyxpipes = ExpandPath(lyxpipes);
+ lyxpipes = expandPath(lyxpipes);
}
break;
case RC_BACKUPDIR_PATH:
if (lexrc.next()) {
backupdir_path = os::internal_path(lexrc.getString());
- backupdir_path = ExpandPath(backupdir_path);
+ backupdir_path = expandPath(backupdir_path);
}
break;
case RC_DATE_INSERT_FORMAT:
if (lexrc.next()) {
flags = lexrc.getString();
}
- if (command.empty()
- || token(command, ' ', 0) == "none") {
+ if (command.empty()) {
converters.erase(from, to);
} else {
converters.add(from, to, command, flags);
}
if (lexrc.next()) {
command = lexrc.getString();
- if (token(command, ' ', 0) == "none")
- command.erase();
}
formats.setViewer(format, command);
break;
shortcut = lexrc.getString();
}
string viewer, editor;
+ if (lexrc.next())
+ viewer = lexrc.getString();
+ if (lexrc.next())
+ editor = lexrc.getString();
+ // The only supported flag for now is "document".
+ // More flags could be added in the future.
+ // Therefore we use tokenPos below to read the flag.
+ string flags;
// Hack to ensure compatibility with versions older
- // than 1.4.0
+ // than 1.5.0
int le = lexrc.lex();
if (le != LyXLex::LEX_FEOF && le != LyXLex::LEX_UNDEF) {
- viewer = lexrc.getString();
- if (le == LyXLex::LEX_DATA) {
- if (token(viewer, ' ', 0) == "none")
- viewer.erase();
- if (lexrc.next()) {
- editor = lexrc.getString();
- if (token(editor, ' ', 0) == "none")
- editor.erase();
- }
- } else {
+ flags = lexrc.getString();
+ if (le != LyXLex::LEX_DATA) {
// We have got a known token.
// Therefore this is an old style
// format definition without
- // viewer and editor.
- lexrc.pushToken(viewer);
- viewer.erase();
+ // flags.
+ lexrc.pushToken(flags);
+ flags.erase();
}
}
+ bool const document =
+ (tokenPos(flags, ',', "document") >= 0);
+ if (!flags.empty() && flags != "document")
+ lyxerr << "Ignoring flags other than "
+ "`document' in `" << flags
+ << "' for format `" << format << "'."
+ << endl;
if (prettyname.empty()) {
if (converters.formatIsUsed(format)) {
lyxerr << "Can't delete format "
}
} else {
formats.add(format, extension, prettyname,
- shortcut, viewer, editor);
+ shortcut, viewer, editor, document);
}
break;
}
index_command != system_lyxrc.index_command) {
os << "\\index_command \"" << index_command << "\"\n";
}
- case RC_CYGWIN_PATH_FIX:
+ case RC_TEX_EXPECTS_WINDOWS_PATHS:
if (ignore_system_lyxrc ||
- cygwin_path_fix != system_lyxrc.cygwin_path_fix) {
- os << "\\cygwin_path_fix_needed "
- << convert<string>(cygwin_path_fix) << '\n';
+ windows_style_tex_paths != system_lyxrc.windows_style_tex_paths) {
+ os << "\\tex_expects_windows_paths "
+ << convert<string>(windows_style_tex_paths) << '\n';
}
case RC_TEX_ALLOWS_SPACES:
if (tex_allows_spaces != system_lyxrc.tex_allows_spaces) {
os << "\\tex_allows_spaces "
<< convert<string>(tex_allows_spaces) << '\n';
- }
+ }
case RC_KBMAP:
if (ignore_system_lyxrc ||
use_kbmap != system_lyxrc.use_kbmap) {
zoom != system_lyxrc.zoom) {
os << "\\screen_zoom " << zoom << '\n';
}
+ case RC_SCREEN_GEOMETRY_HEIGHT:
+ if (ignore_system_lyxrc ||
+ geometry_height != system_lyxrc.geometry_height) {
+ os << "\\screen_geometry_height " << geometry_height
+ << '\n';
+ }
+ case RC_SCREEN_GEOMETRY_WIDTH:
+ if (ignore_system_lyxrc ||
+ geometry_width != system_lyxrc.geometry_width) {
+ os << "\\screen_geometry_width " << geometry_width
+ << '\n';
+ }
+ case RC_SCREEN_GEOMETRY_XYSAVED:
+ if (ignore_system_lyxrc ||
+ geometry_xysaved != system_lyxrc.geometry_xysaved) {
+ os << "\\screen_geometry_xysaved " << convert<string>(geometry_xysaved)
+ << '\n';
+ }
case RC_WHEEL_JUMP:
if (ignore_system_lyxrc ||
wheel_jump != system_lyxrc.wheel_jump) {
string const path = os::external_path(document_path);
os << "\\document_path \"" << path << "\"\n";
}
- case RC_LASTFILES:
+ case RC_USELASTFILEPOS:
if (ignore_system_lyxrc ||
- lastfiles != system_lyxrc.lastfiles) {
- string const path = os::external_path(lastfiles);
- os << "\\lastfiles \"" << path << "\"\n";
+ use_lastfilepos != system_lyxrc.use_lastfilepos) {
+ os << "\\use_lastfilepos " << convert<string>(use_lastfilepos)
+ << '\n';
+ }
+ case RC_LOADSESSION:
+ if (ignore_system_lyxrc ||
+ load_session != system_lyxrc.load_session) {
+ os << "\\load_session " << convert<string>(load_session)
+ << "\n";
}
case RC_NUMLASTFILES:
if (ignore_system_lyxrc ||
<< "#\n\n";
case RC_FORMAT:
- // New/modifed formats
+ // New/modified formats
for (Formats::const_iterator cit = formats.begin();
cit != formats.end(); ++cit) {
Format const * format =
format->prettyname() != cit->prettyname() ||
format->shortcut() != cit->shortcut() ||
format->viewer() != cit->viewer() ||
- format->editor() != cit->editor())
+ format->editor() != cit->editor() ||
+ format->documentFormat() != cit->documentFormat()) {
os << "\\format \"" << cit->name() << "\" \""
<< cit->extension() << "\" \""
<< cit->prettyname() << "\" \""
<< cit->shortcut() << "\" \""
<< cit->viewer() << "\" \""
- << cit->editor() << "\"\n";
+ << cit->editor() << "\" \"";
+ if (cit->documentFormat())
+ os << "document";
+ os << "\"\n";
+ }
}
// Look for deleted formats
cit != system_formats.end(); ++cit)
if (!formats.getFormat(cit->name()))
os << "\\format \"" << cit->name()
- << "\" \"\" \"\" \"\" \"\" \"\"\n";
+ << "\" \"\" \"\" \"\" \"\" \"\" \"\"\n";
case RC_VIEWER:
// Ignore it
break;
case RC_ASCIIROFF_COMMAND:
- str = _("Use to define an external program to render tables in plain text output. E.g. \"groff -t -Tlatin1 $$FName\" where $$FName is the input file. If \"none\" is specified, an internal routine is used.");
+ str = _("Use to define an external program to render tables in plain text output. E.g. \"groff -t -Tlatin1 $$FName\" where $$FName is the input file. If \"\" is specified, an internal routine is used.");
break;
case RC_ASCII_LINELEN:
case RC_CUSTOM_EXPORT_FORMAT:
break;
- case RC_CYGWIN_PATH_FIX:
- break;
-
case RC_DATE_INSERT_FORMAT:
//xgettext:no-c-format
str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
break;
- case RC_LASTFILES:
- str = _("The file where the last-files information should be stored.");
+ case RC_USELASTFILEPOS:
+ str = _("De-select if you do not want LyX to scroll to saved position.");
+ break;
+
+ case RC_LOADSESSION:
+ str = _("De-select to prevent loading files opened from the last lyx session.");
break;
case RC_MAKE_BACKUP:
str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper.");
break;
+ case RC_SCREEN_GEOMETRY_HEIGHT:
+ case RC_SCREEN_GEOMETRY_WIDTH:
+ str = _("Specify geometry of the main view in width x height (values from last session will not be used if non-zero values are specified).");
+ break;
+
+ case RC_SCREEN_GEOMETRY_XYSAVED:
+ str = _("Allow session manager to save and restore windows position.");
+ break;
+
case RC_SERVERPIPE:
str = _("This starts the lyxserver. The pipes get an additional extension \".in\" and \".out\". Only for advanced users.");
break;
case RC_TEX_ALLOWS_SPACES:
break;
+ case RC_TEX_EXPECTS_WINDOWS_PATHS:
+ break;
+
case RC_UIFILE:
str = _("The UI (user interface) file. Can either specify an absolute path, or LyX will look in its global and local ui/ directories.");
break;