def checkFormatEntries():
''' Check all formats (\Format entries) '''
checkProg('a Tgif viewer and editor', ['tgif'],
- rc_entry = [ r'\Format tgif obj Tgif "" "%%" "%%"'])
+ rc_entry = [ r'\Format tgif obj Tgif "" "%%" "%%" ""'])
#
checkProg('a FIG viewer and editor', ['xfig'],
- rc_entry = [ r'\Format fig fig FIG "" "%%" "%%"'] )
+ rc_entry = [ r'\Format fig fig FIG "" "%%" "%%" ""'] )
#
checkProg('a Grace viewer and editor', ['xmgrace'],
- rc_entry = [ r'\Format agr agr Grace "" "%%" "%%"'] )
+ rc_entry = [ r'\Format agr agr Grace "" "%%" "%%" ""'] )
#
checkProg('a FEN viewer and editor', ['xboard -lpf $$i -mode EditPosition'],
- rc_entry = [ r'\Format fen fen FEN "" "%%" "%%"' ])
+ rc_entry = [ r'\Format fen fen FEN "" "%%" "%%" ""' ])
#
path, iv = checkProg('a raster image viewer', ['xv', 'kview', 'gimp'])
path, ie = checkProg('a raster image editor', ['gimp'])
- addToRC(r'''\Format bmp bmp BMP "" "%s" "%s"
-\Format gif gif GIF "" "%s" "%s"
-\Format jpg jpg JPEG "" "%s" "%s"
-\Format pbm pbm PBM "" "%s" "%s"
-\Format pgm pgm PGM "" "%s" "%s"
-\Format png png PNG "" "%s" "%s"
-\Format ppm ppm PPM "" "%s" "%s"
-\Format tiff tif TIFF "" "%s" "%s"
-\Format xbm xbm XBM "" "%s" "%s"
-\Format xpm xpm XPM "" "%s" "%s"''' % \
+ addToRC(r'''\Format bmp bmp BMP "" "%s" "%s" ""
+\Format gif gif GIF "" "%s" "%s" ""
+\Format jpg jpg JPEG "" "%s" "%s" ""
+\Format pbm pbm PBM "" "%s" "%s" ""
+\Format pgm pgm PGM "" "%s" "%s" ""
+\Format png png PNG "" "%s" "%s" ""
+\Format ppm ppm PPM "" "%s" "%s" ""
+\Format tiff tif TIFF "" "%s" "%s" ""
+\Format xbm xbm XBM "" "%s" "%s" ""
+\Format xpm xpm XPM "" "%s" "%s" ""''' % \
(iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, ie, iv, ie) )
#
checkProg('a text editor', ['xemacs', 'gvim', 'kedit', 'kwrite', 'kate', \
'nedit', 'gedit', 'notepad'],
- rc_entry = [ r'''\Format asciichess asc "Plain text (chess output)" "" "" "%%"
-\Format asciiimage asc "Plain text (image)" "" "" "%%"
-\Format asciixfig asc "Plain text (Xfig output)" "" "" "%%"
-\Format dateout tmp "date (output)" "" "" "%%"
-\Format docbook sgml DocBook B "" "%%"
-\Format docbook-xml xml "Docbook (XML)" "" "" "%%"
-\Format literate nw NoWeb N "" "%%"
-\Format latex tex "LaTeX (plain)" L "" "%%"
-\Format linuxdoc sgml LinuxDoc x "" "%%"
-\Format pdflatex tex "LaTeX (pdflatex)" "" "" "%%"
-\Format text txt "Plain text" a "" "%%"
-\Format textparagraph txt "Plain text (paragraphs)" "" "" "%%"''' ])
+ rc_entry = [ r'''\Format asciichess asc "Plain text (chess output)" "" "" "%%" ""
+\Format asciiimage asc "Plain text (image)" "" "" "%%" ""
+\Format asciixfig asc "Plain text (Xfig output)" "" "" "%%" ""
+\Format dateout tmp "date (output)" "" "" "%%" ""
+\Format docbook sgml DocBook B "" "%%" "document"
+\Format docbook-xml xml "Docbook (XML)" "" "" "%%" "document"
+\Format literate nw NoWeb N "" "%%" "document"
+\Format latex tex "LaTeX (plain)" L "" "%%" "document"
+\Format linuxdoc sgml LinuxDoc x "" "%%" "document"
+\Format pdflatex tex "LaTeX (pdflatex)" "" "" "%%" "document"
+\Format text txt "Plain text" a "" "%%" "document"
+\Format textparagraph txt "Plain text (paragraphs)" "" "" "%%" "document"''' ])
#
#checkProg('a Postscript interpreter', ['gs'],
# rc_entry = [ r'\ps_command "%%"' ])
checkProg('a Postscript previewer', ['gv', 'ghostview -swap', 'kghostview'],
- rc_entry = [ r'''\Format eps eps EPS "" "%%" ""
-\Format ps ps Postscript t "%%" ""''' ])
+ rc_entry = [ r'''\Format eps eps EPS "" "%%" "" ""
+\Format ps ps Postscript t "%%" "" "document"''' ])
#
checkProg('a PDF previewer', ['acrobat', 'acroread', 'gv', 'ghostview', \
'xpdf', 'kpdf', 'kghostview'],
- rc_entry = [ r'''\Format pdf pdf "PDF (ps2pdf)" P "%%" ""
-\Format pdf2 pdf "PDF (pdflatex)" F "%%" ""
-\Format pdf3 pdf "PDF (dvipdfm)" m "%%" ""''' ])
+ rc_entry = [ r'''\Format pdf pdf "PDF (ps2pdf)" P "%%" "" "document"
+\Format pdf2 pdf "PDF (pdflatex)" F "%%" "" "document"
+\Format pdf3 pdf "PDF (dvipdfm)" m "%%" "" "document"''' ])
#
checkProg('a DVI previewer', ['xdvi', 'kdvi'],
- rc_entry = [ r'\Format dvi dvi DVI D "%%" ""' ])
+ rc_entry = [ r'\Format dvi dvi DVI D "%%" "" "document"' ])
#
checkProg('a HTML previewer', ['mozilla file://$$p$$i', 'netscape'],
- rc_entry = [ r'\Format html html HTML H "%%" ""' ])
+ rc_entry = [ r'\Format html html HTML H "%%" "" "document"' ])
#
# entried that do not need checkProg
- addToRC(r'''\Format date "" "date command" "" "" ""
-\Format fax "" Fax "" "" ""
-\Format lyx lyx LyX "" "" ""
-\Format lyx13x lyx13 "LyX 1.3.x" "" "" ""
-\Format lyxpreview lyxpreview "LyX Preview" "" "" ""
-\Format pdftex pdftex_t PDFTEX "" "" ""
-\Format program "" Program "" "" ""
-\Format pstex pstex_t PSTEX "" "" ""
-\Format sxw sxw "OpenOffice.Org Writer" O "" ""
-\Format word doc "MS Word" W "" ""
-\Format wordhtml html "MS Word (HTML)" "" "" ""
+ addToRC(r'''\Format date "" "date command" "" "" "" ""
+\Format fax "" Fax "" "" "" "document"
+\Format lyx lyx LyX "" "" "" ""
+\Format lyx13x lyx13 "LyX 1.3.x" "" "" "" "document"
+\Format lyxpreview lyxpreview "LyX Preview" "" "" "" ""
+\Format pdftex pdftex_t PDFTEX "" "" "" ""
+\Format program "" Program "" "" "" ""
+\Format pstex pstex_t PSTEX "" "" "" ""
+\Format sxw sxw "OpenOffice.Org Writer" O "" "" "document"
+\Format word doc "MS Word" W "" "" "document"
+\Format wordhtml html "MS Word (HTML)" "" "" "" "document"
''')
-#LyX 1.4.0svn created this file. For more info see http://www.lyx.org/
+#LyX 1.5.0svn created this file. For more info see http://www.lyx.org/
\lyxformat 245
\begin_document
\begin_header
directory and may modify it in the process.
\end_layout
+\begin_layout Standard
+With the checkbox
+\family sans
+Document Format
+\family default
+ you can choose whether the format is a document format or not.
+ The difference between document and non--document formats is that you can
+ export your LyX document only to document formats.
+ Non--document formats are used for included graphics.
+ Examples for document formats are
+\family typewriter
+dvi
+\family default
+ or
+\family typewriter
+ps.
+
+\family default
+Examples for non--document formats are
+\family typewriter
+png
+\family default
+ or
+\family typewriter
+jpeg
+\family default
+.
+ Some formats like
+\family typewriter
+pdf
+\family default
+ are both document formats and non--document formats.
+ The checkbox
+\family sans
+Document Format
+\family default
+ should be checked for these formats.
+\end_layout
+
\begin_layout Section
BibTeX and makeindex
\end_layout
\begin_layout Standard
+
\backslash
begin{sloppypar}
\end_layout
\begin_layout Standard
+
\backslash
end{sloppypar}
\end_layout
\begin_layout Standard
+
\backslash
b o
\end_layout
\begin_layout Standard
+
\backslash
d o
\end_layout
\begin_layout Standard
+
\backslash
t o
\end_layout
\begin_layout Standard
+
\backslash
u o
\end_layout
\begin_layout Standard
+
\backslash
.s
\end_layout
\begin_layout Standard
+
\backslash
begin{sloppypar}
\end_layout
\begin_layout Standard
+
\backslash
end{sloppypar}
\end_layout
\begin_layout Standard
+
\backslash
begin{sloppypar}
\end_layout
\begin_layout Standard
+
\backslash
end{sloppypar}
\end_layout
if ((*fit)->dummy())
continue;
string label = (*fit)->prettyname();
- // we need to hide the default graphic export formats
- // from the external menu, because we need them only
- // for the internal lyx-view and external latex run
- if (label == "EPS" || label == "XPM" || label == "PNG")
- continue;
- if (kind == MenuItem::ImportFormats) {
+ switch (kind) {
+ case MenuItem::ImportFormats:
if ((*fit)->name() == "text")
label = _("Plain Text as Lines");
else if ((*fit)->name() == "textparagraph")
label = _("Plain Text as Paragraphs");
label += "...";
- } else if (kind == MenuItem::ExportFormats) {
- // exporting to LyX does not make sense
- // FIXME: Introduce noexport flag
- if ((*fit)->name() == "lyx")
+ break;
+ case MenuItem::ViewFormats:
+ case MenuItem::ExportFormats:
+ if (!(*fit)->documentFormat())
continue;
+ break;
+ case MenuItem::UpdateFormats:
+ break;
}
if (!(*fit)->shortcut().empty())
label += '|' + (*fit)->shortcut();
return compare_ascii_no_case(a.prettyname(), b.prettyname()) < 0;
}
+
Format::Format(string const & n, string const & e, string const & p,
- string const & s, string const & v, string const & ed)
- : name_(n), extension_(e), prettyname_(p), shortcut_(s), viewer_(v), editor_(ed)
+ string const & s, string const & v, string const & ed,
+ bool d)
+ : name_(n), extension_(e), prettyname_(p), shortcut_(s), viewer_(v),
+ editor_(ed), document_(d)
{}
void Formats::add(string const & name)
{
if (!getFormat(name))
- add(name, name, name, string(), string(), string());
+ add(name, name, name, string(), string(), string(), true);
}
void Formats::add(string const & name, string const & extension,
string const & prettyname, string const & shortcut,
- string const & viewer, string const & editor)
+ string const & viewer, string const & editor, bool document)
{
FormatList::iterator it =
find_if(formatlist.begin(), formatlist.end(),
FormatNamesEqual(name));
if (it == formatlist.end())
formatlist.push_back(Format(name, extension, prettyname,
- shortcut, viewer, editor));
+ shortcut, viewer, editor,
+ document));
else
- *it = Format(name, extension, prettyname, shortcut, viewer, editor);
+ *it = Format(name, extension, prettyname, shortcut, viewer,
+ editor, document);
}
public:
///
Format(std::string const & n, std::string const & e, std::string const & p,
- std::string const & s, std::string const & v, std::string const & ed);
+ std::string const & s, std::string const & v, std::string const & ed,
+ bool ex);
///
bool dummy() const;
- ///
+ /// Tell whether this format is a child format.
+ /// Child formats inherit settings like the viewer from their parent.
bool isChildFormat() const;
- ///
+ /// Name fo the parent format
std::string const parentFormat() const;
///
std::string const & name() const {
void setEditor(std::string const & v) {
editor_ = v;
}
+ ///
+ bool documentFormat() const {
+ return document_;
+ }
private:
+ /// Internal name. Needs to be unique.
std::string name_;
- ///
+ /// Filename extension
std::string extension_;
- ///
+ /// Name presented to the user. Needs to be unique.
std::string prettyname_;
- ///
+ /// Keyboard shortcut for the View and Export menu.
std::string shortcut_;
- ///
+ /*!
+ * Viewer for this format. Needs to be in the PATH or an absolute
+ * filename.
+ * This format cannot be viewed if \c viewer_ is empty.
+ * If it is \c auto the default viewer of the OS for this format is
+ * used.
+ */
std::string viewer_;
- ///
+ /// Editor for this format. \sa viewer_.
std::string editor_;
+ /// Is this format a document format? (as opposed to e.g. image formats)
+ /// Some formats are both (e.g. pdf), they have this flag set.
+ bool document_;
};
void add(std::string const & name);
///
void add(std::string const & name, std::string const & extension,
- std::string const & prettyname, std::string const & shortcut,
- std::string const & viewer, std::string const & editor);
+ std::string const & prettyname, std::string const & shortcut,
+ std::string const & viewer, std::string const & editor,
+ bool document);
///
void erase(std::string const & name);
///
connect(fileformatsModule->extensionED, SIGNAL(textChanged(const QString&)), this, SLOT(fileformat_changed()));
connect(fileformatsModule->viewerED, SIGNAL(textChanged(const QString&)), this, SLOT(fileformat_changed()));
connect(fileformatsModule->editorED, SIGNAL(textChanged(const QString&)), this, SLOT(fileformat_changed()));
+ connect(fileformatsModule->documentCB, SIGNAL(toggled(bool)), this, SLOT(fileformat_changed()));
connect(convertersModule->converterNewPB, SIGNAL(clicked()), this, SLOT(new_converter()));
connect(convertersModule->converterRemovePB, SIGNAL(clicked()), this, SLOT(remove_converter()));
fileformatsModule->shortcutED->setText(toqstr(f.shortcut()));
fileformatsModule->viewerED->setText(toqstr(f.viewer()));
fileformatsModule->editorED->setText(toqstr(f.editor()));
+ fileformatsModule->documentCB->setChecked(f.documentFormat());
fileformatsModule->formatRemovePB->setEnabled(
!form_->converters().formatIsUsed(f.name()));
string const old_extension(f.extension());
string const old_viewer(f.viewer());
string const old_editor(f.editor());
+ bool const old_document(f.documentFormat());
string const new_pretty(fromqstr(gui_name));
string const new_shortcut(fromqstr(fileformatsModule->shortcutED->text()));
string const new_extension(fromqstr(fileformatsModule->extensionED->text()));
string const new_viewer(fromqstr(fileformatsModule->viewerED->text()));
string const new_editor(fromqstr(fileformatsModule->editorED->text()));
+ bool const new_document(fileformatsModule->documentCB->isChecked());
bool modified = ((old_pretty != new_pretty) || (old_shortcut != new_shortcut)
|| (old_extension != new_extension) || (old_viewer != new_viewer)
- || (old_editor != new_editor));
+ || (old_editor != new_editor)) || old_document != new_document;
fileformatsModule->formatModifyPB->setEnabled(
valid && known && modified && !known_otherwise);
string const shortcut = fromqstr(fileformatsModule->shortcutED->text());
string const viewer = fromqstr(fileformatsModule->viewerED->text());
string const editor = fromqstr(fileformatsModule->editorED->text());
+ bool const document = fileformatsModule->documentCB->isChecked();
- form_->formats().add(name, extension, prettyname, shortcut, viewer, editor);
+ form_->formats().add(name, extension, prettyname, shortcut, viewer,
+ editor, document);
form_->formats().sort();
updateFormats();
fileformatsModule->formatsLB->setCurrentItem(form_->formats().getNumber(name));
string const shortcut = fromqstr(fileformatsModule->shortcutED->text());
string const viewer = fromqstr(fileformatsModule->viewerED->text());
string const editor = fromqstr(fileformatsModule->editorED->text());
+ bool const document = fileformatsModule->documentCB->isChecked();
- form_->formats().add(name, extension, prettyname, shortcut, viewer, editor);
+ form_->formats().add(name, extension, prettyname, shortcut, viewer,
+ editor, document);
form_->formats().sort();
fileformatsModule->formatsLB->setUpdatesEnabled(false);
<x>0</x>
<y>0</y>
<width>419</width>
- <height>261</height>
+ <height>286</height>
</rect>
</property>
<property name="caption">
<cstring>editorED</cstring>
</property>
</widget>
+ <widget class="QCheckBox" row="6" column="1">
+ <property name="name">
+ <cstring>documentCB</cstring>
+ </property>
+ <property name="text">
+ <string>&Document format</string>
+ </property>
+ <property name="accel">
+ <string>Alt+D</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Tell whether this format is a document format. A document can not be exported to or viewed in a non-document format.</string>
+ </property>
+ </widget>
<widget class="QLineEdit" row="2" column="1">
<property name="name">
<cstring>shortcutED</cstring>
<tabstop>extensionED</tabstop>
<tabstop>viewerED</tabstop>
<tabstop>editorED</tabstop>
+ <tabstop>documentCB</tabstop>
</tabstops>
<includes>
<include location="global" impldecl="in implementation">config.h</include>
connect(extensionED, SIGNAL(textChanged(const QString&)), this, SLOT(fileformat_changed()));
connect(viewerED, SIGNAL(textChanged(const QString&)), this, SLOT(fileformat_changed()));
connect(editorED, SIGNAL(textChanged(const QString&)), this, SLOT(fileformat_changed()));
+ connect(documentCB, SIGNAL(toggled(bool)), this, SLOT(fileformat_changed()));
connect(formatNewPB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(formatRemovePB, SIGNAL(clicked()),
shortcutED->setText(toqstr(f.shortcut()));
viewerED->setText(toqstr(f.viewer()));
editorED->setText(toqstr(f.editor()));
+ documentCB->setChecked((f.documentFormat()));
formatRemovePB->setEnabled(
!form_->converters().formatIsUsed(f.name()));
string const old_extension(f.extension());
string const old_viewer(f.viewer());
string const old_editor(f.editor());
+ bool const old_document(f.documentFormat());
string const new_pretty(fromqstr(gui_name));
string const new_shortcut(fromqstr(shortcutED->text()));
string const new_extension(fromqstr(extensionED->text()));
string const new_viewer(fromqstr(viewerED->text()));
string const new_editor(fromqstr(editorED->text()));
+ bool const new_document(documentCB->isChecked());
bool modified = ((old_pretty != new_pretty) || (old_shortcut != new_shortcut)
|| (old_extension != new_extension) || (old_viewer != new_viewer)
- || (old_editor != new_editor));
+ || (old_editor != new_editor) || old_document != new_document);
formatModifyPB->setEnabled(
valid && known && modified && !known_otherwise);
string const shortcut = fromqstr(shortcutED->text());
string const viewer = fromqstr(viewerED->text());
string const editor = fromqstr(editorED->text());
+ bool const document = documentCB->isChecked();
- form_->formats().add(name, extension, prettyname, shortcut, viewer, editor);
+ form_->formats().add(name, extension, prettyname, shortcut, viewer,
+ editor, document);
form_->formats().sort();
update();
string const shortcut = fromqstr(shortcutED->text());
string const viewer = fromqstr(viewerED->text());
string const editor = fromqstr(editorED->text());
+ bool const document = documentCB->isChecked();
- form_->formats().add(name, extension, prettyname, shortcut, viewer, editor);
+ form_->formats().add(name, extension, prettyname, shortcut, viewer,
+ editor, document);
form_->formats().sort();
formatsLW->setUpdatesEnabled(false);
<item row="3" column="1" >
<widget class="QLineEdit" name="extensionED" />
</item>
+ <item row="6" column="0" >
+ <widget class="QCheckBox" name="documentCB" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" >
+ <string>Tell whether this format is a document format. A document can not be exported to or viewed in a non-document format.</string>
+ </property>
+ <property name="text" >
+ <string>&Document format</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item row="4" column="0" >
<tabstop>extensionED</tabstop>
<tabstop>viewerED</tabstop>
<tabstop>editorED</tabstop>
+ <tabstop>documentCB</tabstop>
</tabstops>
<resources/>
<connections/>
setPrehandler(dialog_->input_viewer);
setPrehandler(dialog_->input_editor);
setPrehandler(dialog_->input_shrtcut);
+ setPrehandler(dialog_->check_document);
}
return _("Remove the current format from the list of available "
"formats. Note: you must then \"Apply\" the change.");
+ if (ob == dialog_->check_document)
+ return _("Tell whether this format is a document format. "
+ "A document can not be exported to or viewed in a non-document format.");
+
if (ob == dialog_->button_add) {
if (string(ob->label) == _("Add"))
return _("Add the current format to the list of available "
|| ob == dialog_->input_shrtcut
|| ob == dialog_->input_extension
|| ob == dialog_->input_viewer
- || ob == dialog_->input_editor)
+ || ob == dialog_->input_editor
+ || ob == dialog_->check_document)
return Input();
if (ob == dialog_->button_add)
string const shortcut = getString(dialog_->input_shrtcut);
string const viewer = getString(dialog_->input_viewer);
string const editor = getString(dialog_->input_editor);
+ bool const document = fl_get_button(dialog_->check_document);
Format const * old = formats().getFormat(name);
string const old_prettyname = old ? old->prettyname() : string();
- formats().add(name, extension, prettyname, shortcut, viewer, editor);
+ formats().add(name, extension, prettyname, shortcut, viewer, editor,
+ document);
if (!old || prettyname != old_prettyname) {
UpdateBrowser();
if (old)
fl_set_input(dialog_->input_extension, f.extension().c_str());
fl_set_input(dialog_->input_viewer, f.viewer().c_str());
fl_set_input(dialog_->input_editor, f.editor().c_str());
+ fl_set_button(dialog_->check_document, f.documentFormat());
fl_set_object_label(dialog_->button_add,
idex(_("Modify|#M")).c_str());
=============== FORM ===============
Name: form_preferences_formats
Width: 450
-Height: 400
-Number of Objects: 10
+Height: 440
+Number of Objects: 11
--------------------
class: FL_BOX
callback: C_FormDialogView_InputCB
argument: 0
+--------------------
+class: FL_CHECKBUTTON
+type: PUSH_BUTTON
+box: 200 270 150 30
+boxtype: FL_NO_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Document format|#D
+shortcut:
+resize: FL_RESIZE_NONE
+gravity: FL_West FL_West
+name: check_document
+callback: C_FormDialogView_InputCB
+argument: 0
+
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
-box: 240 300 90 30
+box: 240 340 90 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
-box: 340 300 90 30
+box: 340 340 90 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
using lyx::support::getEnv;
using lyx::support::libFileSearch;
using lyx::support::token;
+using lyx::support::tokenPos;
using std::cout;
using std::endl;
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 (lexrc.next()) {
- editor = lexrc.getString();
- }
- } 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;
}
<< "#\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