mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-13 17:20:55 +00:00
allow to open documents when the textclass is unavailable (backport from 1.4.0cvs)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@8081 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
51be22303c
commit
556f26e8eb
@ -1,3 +1,11 @@
|
||||
2003-11-12 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* configure.m4: when latex configuration detection is disabled,
|
||||
fix the default textclass.lst to the new format. Also simplify it
|
||||
to contain only "article".
|
||||
|
||||
* layouts/cv.layout: change description to lowercase
|
||||
|
||||
2003-11-05 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* Makefile.am (install-xfonts): fix error when PSres.upr does not
|
||||
|
@ -59,9 +59,9 @@
|
||||
% the variable chk_<name>.
|
||||
%%%
|
||||
\newcommand{\prefix}{+} % the character used by grep to filter 'good' output
|
||||
\newcommand{\AddLayout}[3][\default]{
|
||||
\newcommand{\AddLayout}[4][\default]{
|
||||
\def\default{#2}
|
||||
\immediate\write\layouts{"#2" "#1" "#3"}}
|
||||
\immediate\write\layouts{"#2" "#1" "#3" "#4"}}
|
||||
\newcommand{\AddVariable}[2]{
|
||||
\immediate\write\sed{s!@chk_#1@!#2!g}
|
||||
\immediate\write\vars{chk_#1='#2'}}
|
||||
@ -107,15 +107,17 @@
|
||||
}
|
||||
\newcommand{\DeclareLaTeXClass}[2][\default]{
|
||||
\TestItem[#1]{\layoutname}{document class}{cls}
|
||||
{\AddLayout[\firstelement]{\layoutname}{#2}}{}
|
||||
{\AddLayout[\firstelement]{\layoutname}{#2}{true}}
|
||||
{\AddLayout[\firstelement]{\layoutname}{#2}{false}}
|
||||
\expandafter\endinput
|
||||
}
|
||||
\newcommand{\DeclareLinuxDocClass}[2][\default]{
|
||||
\message{^^J\prefix checking for linuxdoc class \layoutname... }
|
||||
\@ifundefined{haslinuxdoc}
|
||||
{\message{no^^J}}
|
||||
{\message{no^^J}
|
||||
\AddLayout[#1]{\layoutname}{#2}{false}}
|
||||
{\message{yes^^J}
|
||||
\AddLayout[#1]{\layoutname}{#2}}
|
||||
\AddLayout[#1]{\layoutname}{#2}{true}}
|
||||
\expandafter\endinput
|
||||
}
|
||||
% Only for compatibility. Will be removed later.
|
||||
@ -124,9 +126,10 @@
|
||||
\newcommand{\DeclareDocBookClass}[2][\default]{
|
||||
\message{^^J\prefix checking for docbook\space\space class \layoutname... }
|
||||
\@ifundefined{hasdocbook}
|
||||
{\message{no^^J}}
|
||||
{\message{no^^J}
|
||||
\AddLayout[#1]{\layoutname}{#2}{false}}
|
||||
{\message{yes^^J}
|
||||
\AddLayout[#1]{\layoutname}{#2}}
|
||||
\AddLayout[#1]{\layoutname}{#2}{true}}
|
||||
\expandafter\endinput
|
||||
}
|
||||
|
||||
|
@ -408,11 +408,7 @@ PROVIDE_DEFAULT_FILE(textclass.lst,dnl
|
||||
# It contains only default values, since chkconfig.ltx could not be run
|
||||
# for some reason. Run ./configure if you need to update it after a
|
||||
# configuration change.
|
||||
article article article
|
||||
report report report
|
||||
book book book
|
||||
linuxdoc linuxdoc linuxdoc
|
||||
letter letter letter])
|
||||
article article article false])
|
||||
|
||||
PROVIDE_DEFAULT_FILE(chkconfig.sed,[s/@.*@/???/g])
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#% Do not delete the line below; configure depends on this
|
||||
# \DeclareLaTeXClass{Curriculum Vitae}
|
||||
# \DeclareLaTeXClass{curriculum vitae}
|
||||
# CV textclass definition file.
|
||||
# Author : Jean-Marc Lasgouttes (Jean-Marc.Lasgouttes@inria.fr)
|
||||
|
||||
|
13
src/buffer.C
13
src/buffer.C
@ -650,6 +650,19 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
|
||||
#endif
|
||||
params.textclass = 0;
|
||||
}
|
||||
if (!params.getLyXTextClass().isTeXClassAvailable()) {
|
||||
#if USE_BOOST_FORMAT
|
||||
Alert::alert(_("Textclass error"),
|
||||
boost::io::str(boost::format(_("The document uses a missing TeX class \"%1$s\".")) % lex.getString()),
|
||||
_("LyX will not be able to produce output."));
|
||||
#else
|
||||
Alert::alert(
|
||||
_("Textclass error"),
|
||||
_("The document uses a missing TeX class ")
|
||||
+ lex.getString(),
|
||||
_("LyX will not be able to produce output."));
|
||||
#endif
|
||||
}
|
||||
} else if (token == "\\options") {
|
||||
lex.eatLine();
|
||||
params.options = lex.getString();
|
||||
|
@ -169,6 +169,7 @@ string const Exporter::BufferFormat(Buffer const * buffer)
|
||||
vector<string> const Exporter::Backends(Buffer const * buffer)
|
||||
{
|
||||
vector<string> v;
|
||||
if (buffer->params.getLyXTextClass().isTeXClassAvailable())
|
||||
v.push_back(BufferFormat(buffer));
|
||||
v.push_back("text");
|
||||
return v;
|
||||
|
@ -115,7 +115,12 @@ void QDocument::build_dialog()
|
||||
// layout
|
||||
for (LyXTextClassList::const_iterator cit = textclasslist.begin();
|
||||
cit != textclasslist.end(); ++cit) {
|
||||
if (cit->isTeXClassAvailable()) {
|
||||
dialog_->layoutModule->classCO->insertItem(toqstr(cit->description()));
|
||||
} else {
|
||||
dialog_->layoutModule->classCO->insertItem(toqstr("Unavailable: " +
|
||||
cit->description()));
|
||||
}
|
||||
}
|
||||
|
||||
for (int n = 0; tex_fonts[n][0]; ++n) {
|
||||
@ -467,13 +472,7 @@ void QDocument::update_contents()
|
||||
|
||||
|
||||
// layout
|
||||
for (int n = 0; n<dialog_->layoutModule->classCO->count(); ++n) {
|
||||
if (dialog_->layoutModule->classCO->text(n) ==
|
||||
toqstr(controller().textClass().description())) {
|
||||
dialog_->layoutModule->classCO->setCurrentItem(n);
|
||||
break;
|
||||
}
|
||||
}
|
||||
dialog_->layoutModule->classCO->setCurrentItem(params.textclass);
|
||||
|
||||
dialog_->updateFontsize(controller().textClass().opt_fontsize(),
|
||||
params.fontsize);
|
||||
|
@ -145,7 +145,11 @@ void FormDocument::build()
|
||||
fl_end_form();
|
||||
for (LyXTextClassList::const_iterator cit = textclasslist.begin();
|
||||
cit != textclasslist.end(); ++cit) {
|
||||
if (cit->isTeXClassAvailable()) {
|
||||
combo_doc_class->addto(cit->description());
|
||||
} else {
|
||||
combo_doc_class->addto("Unavailable: " + cit->description());
|
||||
}
|
||||
}
|
||||
|
||||
fl_addto_choice(class_->choice_doc_spacing,
|
||||
@ -852,7 +856,7 @@ void FormDocument::UpdateClassParams(BufferParams const & params)
|
||||
|
||||
LyXTextClass const & tclass = textclasslist[params.textclass];
|
||||
|
||||
combo_doc_class->select(tclass.description());
|
||||
combo_doc_class->select(params.textclass + 1);
|
||||
fl_clear_choice(class_->choice_doc_fontsize);
|
||||
fl_addto_choice(class_->choice_doc_fontsize, "default");
|
||||
fl_addto_choice(class_->choice_doc_fontsize,
|
||||
|
@ -49,9 +49,9 @@ struct compare_name {
|
||||
|
||||
|
||||
LyXTextClass::LyXTextClass(string const & fn, string const & cln,
|
||||
string const & desc)
|
||||
string const & desc, bool texClassAvail )
|
||||
: name_(fn), latexname_(cln), description_(desc),
|
||||
floatlist_(new FloatList), ctrs_(new Counters)
|
||||
floatlist_(new FloatList), ctrs_(new Counters), texClassAvail_(texClassAvail)
|
||||
{
|
||||
outputType_ = LATEX;
|
||||
columns_ = 1;
|
||||
@ -70,6 +70,11 @@ LyXTextClass::LyXTextClass(string const & fn, string const & cln,
|
||||
}
|
||||
|
||||
|
||||
bool LyXTextClass::isTeXClassAvailable() const {
|
||||
return texClassAvail_;
|
||||
}
|
||||
|
||||
|
||||
bool LyXTextClass::do_readStyle(LyXLex & lexrc, LyXLayout & lay)
|
||||
{
|
||||
lyxerr[Debug::TCLASS] << "Reading style " << lay.name() << endl;
|
||||
|
@ -39,7 +39,11 @@ public:
|
||||
explicit
|
||||
LyXTextClass(string const & = string(),
|
||||
string const & = string(),
|
||||
string const & = string());
|
||||
string const & = string(),
|
||||
bool = false);
|
||||
|
||||
/// check whether the TeX class is available
|
||||
bool isTeXClassAvailable() const;
|
||||
|
||||
/// paragraph styles begin iterator.
|
||||
const_iterator begin() const { return layoutlist_.begin(); }
|
||||
@ -150,6 +154,8 @@ public:
|
||||
///
|
||||
int size() const;
|
||||
private:
|
||||
/// Is the TeX class available?
|
||||
bool texClassAvail_;
|
||||
///
|
||||
bool delete_layout(string const &);
|
||||
///
|
||||
|
@ -69,7 +69,9 @@ LyXTextClassList::operator[](textclass_type textclass) const
|
||||
class less_textclass_desc {
|
||||
public:
|
||||
int operator()(LyXTextClass const & tc1, LyXTextClass const & tc2) {
|
||||
return tc1.description() < tc2.description();
|
||||
return (tc1.isTeXClassAvailable() && !tc2.isTeXClassAvailable()) ||
|
||||
(tc1.isTeXClassAvailable() == tc2.isTeXClassAvailable() &&
|
||||
tc1.description() < tc2.description());
|
||||
}
|
||||
};
|
||||
|
||||
@ -130,9 +132,12 @@ bool LyXTextClassList::Read ()
|
||||
if (lex.next()) {
|
||||
string const desc = lex.getString();
|
||||
lyxerr[Debug::TCLASS] << "Desc: " << desc << endl;
|
||||
if (lex.next()) {
|
||||
bool avail = lex.getBool();
|
||||
lyxerr[Debug::TCLASS] << "Avail: " << avail << endl;
|
||||
// This code is run when we have
|
||||
// fname, clname and desc
|
||||
LyXTextClass tmpl(fname, clname, desc);
|
||||
// fname, clname, desc, and avail
|
||||
LyXTextClass tmpl(fname, clname, desc, avail);
|
||||
if (lyxerr.debugging(Debug::TCLASS)) {
|
||||
tmpl.load();
|
||||
}
|
||||
@ -141,6 +146,7 @@ bool LyXTextClassList::Read ()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
lyxerr[Debug::TCLASS] << "End of parsing of textclass.lst" << endl;
|
||||
|
||||
if (classlist_.empty()) {
|
||||
|
@ -22,6 +22,13 @@ What's new
|
||||
|
||||
** Updates
|
||||
|
||||
- it is now possible to open documents which use a textclasse for
|
||||
which no LaTeX support is installed. The documents can be normally
|
||||
edited, but they can of course not be previewed or printed. Note
|
||||
that the format of the file .lyx/textclasses.lst has changed as a
|
||||
consequence and it is therefore not possible to use LyX 1.3.4 and an
|
||||
earlier version with the same .lyx/ directory.
|
||||
|
||||
- add support for \boldsymbol in math editor
|
||||
|
||||
- update danish, italian, romanian and slovenian interface localizations
|
||||
|
Loading…
Reference in New Issue
Block a user