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>
|
2003-11-05 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||||
|
|
||||||
* Makefile.am (install-xfonts): fix error when PSres.upr does not
|
* Makefile.am (install-xfonts): fix error when PSres.upr does not
|
||||||
|
@ -59,9 +59,9 @@
|
|||||||
% the variable chk_<name>.
|
% the variable chk_<name>.
|
||||||
%%%
|
%%%
|
||||||
\newcommand{\prefix}{+} % the character used by grep to filter 'good' output
|
\newcommand{\prefix}{+} % the character used by grep to filter 'good' output
|
||||||
\newcommand{\AddLayout}[3][\default]{
|
\newcommand{\AddLayout}[4][\default]{
|
||||||
\def\default{#2}
|
\def\default{#2}
|
||||||
\immediate\write\layouts{"#2" "#1" "#3"}}
|
\immediate\write\layouts{"#2" "#1" "#3" "#4"}}
|
||||||
\newcommand{\AddVariable}[2]{
|
\newcommand{\AddVariable}[2]{
|
||||||
\immediate\write\sed{s!@chk_#1@!#2!g}
|
\immediate\write\sed{s!@chk_#1@!#2!g}
|
||||||
\immediate\write\vars{chk_#1='#2'}}
|
\immediate\write\vars{chk_#1='#2'}}
|
||||||
@ -107,15 +107,17 @@
|
|||||||
}
|
}
|
||||||
\newcommand{\DeclareLaTeXClass}[2][\default]{
|
\newcommand{\DeclareLaTeXClass}[2][\default]{
|
||||||
\TestItem[#1]{\layoutname}{document class}{cls}
|
\TestItem[#1]{\layoutname}{document class}{cls}
|
||||||
{\AddLayout[\firstelement]{\layoutname}{#2}}{}
|
{\AddLayout[\firstelement]{\layoutname}{#2}{true}}
|
||||||
|
{\AddLayout[\firstelement]{\layoutname}{#2}{false}}
|
||||||
\expandafter\endinput
|
\expandafter\endinput
|
||||||
}
|
}
|
||||||
\newcommand{\DeclareLinuxDocClass}[2][\default]{
|
\newcommand{\DeclareLinuxDocClass}[2][\default]{
|
||||||
\message{^^J\prefix checking for linuxdoc class \layoutname... }
|
\message{^^J\prefix checking for linuxdoc class \layoutname... }
|
||||||
\@ifundefined{haslinuxdoc}
|
\@ifundefined{haslinuxdoc}
|
||||||
{\message{no^^J}}
|
{\message{no^^J}
|
||||||
|
\AddLayout[#1]{\layoutname}{#2}{false}}
|
||||||
{\message{yes^^J}
|
{\message{yes^^J}
|
||||||
\AddLayout[#1]{\layoutname}{#2}}
|
\AddLayout[#1]{\layoutname}{#2}{true}}
|
||||||
\expandafter\endinput
|
\expandafter\endinput
|
||||||
}
|
}
|
||||||
% Only for compatibility. Will be removed later.
|
% Only for compatibility. Will be removed later.
|
||||||
@ -124,9 +126,10 @@
|
|||||||
\newcommand{\DeclareDocBookClass}[2][\default]{
|
\newcommand{\DeclareDocBookClass}[2][\default]{
|
||||||
\message{^^J\prefix checking for docbook\space\space class \layoutname... }
|
\message{^^J\prefix checking for docbook\space\space class \layoutname... }
|
||||||
\@ifundefined{hasdocbook}
|
\@ifundefined{hasdocbook}
|
||||||
{\message{no^^J}}
|
{\message{no^^J}
|
||||||
|
\AddLayout[#1]{\layoutname}{#2}{false}}
|
||||||
{\message{yes^^J}
|
{\message{yes^^J}
|
||||||
\AddLayout[#1]{\layoutname}{#2}}
|
\AddLayout[#1]{\layoutname}{#2}{true}}
|
||||||
\expandafter\endinput
|
\expandafter\endinput
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,11 +408,7 @@ PROVIDE_DEFAULT_FILE(textclass.lst,dnl
|
|||||||
# It contains only default values, since chkconfig.ltx could not be run
|
# 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
|
# for some reason. Run ./configure if you need to update it after a
|
||||||
# configuration change.
|
# configuration change.
|
||||||
article article article
|
article article article false])
|
||||||
report report report
|
|
||||||
book book book
|
|
||||||
linuxdoc linuxdoc linuxdoc
|
|
||||||
letter letter letter])
|
|
||||||
|
|
||||||
PROVIDE_DEFAULT_FILE(chkconfig.sed,[s/@.*@/???/g])
|
PROVIDE_DEFAULT_FILE(chkconfig.sed,[s/@.*@/???/g])
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#% Do not delete the line below; configure depends on this
|
#% Do not delete the line below; configure depends on this
|
||||||
# \DeclareLaTeXClass{Curriculum Vitae}
|
# \DeclareLaTeXClass{curriculum vitae}
|
||||||
# CV textclass definition file.
|
# CV textclass definition file.
|
||||||
# Author : Jean-Marc Lasgouttes (Jean-Marc.Lasgouttes@inria.fr)
|
# 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
|
#endif
|
||||||
params.textclass = 0;
|
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") {
|
} else if (token == "\\options") {
|
||||||
lex.eatLine();
|
lex.eatLine();
|
||||||
params.options = lex.getString();
|
params.options = lex.getString();
|
||||||
|
@ -169,7 +169,8 @@ string const Exporter::BufferFormat(Buffer const * buffer)
|
|||||||
vector<string> const Exporter::Backends(Buffer const * buffer)
|
vector<string> const Exporter::Backends(Buffer const * buffer)
|
||||||
{
|
{
|
||||||
vector<string> v;
|
vector<string> v;
|
||||||
v.push_back(BufferFormat(buffer));
|
if (buffer->params.getLyXTextClass().isTeXClassAvailable())
|
||||||
|
v.push_back(BufferFormat(buffer));
|
||||||
v.push_back("text");
|
v.push_back("text");
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,12 @@ void QDocument::build_dialog()
|
|||||||
// layout
|
// layout
|
||||||
for (LyXTextClassList::const_iterator cit = textclasslist.begin();
|
for (LyXTextClassList::const_iterator cit = textclasslist.begin();
|
||||||
cit != textclasslist.end(); ++cit) {
|
cit != textclasslist.end(); ++cit) {
|
||||||
dialog_->layoutModule->classCO->insertItem(toqstr(cit->description()));
|
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) {
|
for (int n = 0; tex_fonts[n][0]; ++n) {
|
||||||
@ -467,13 +472,7 @@ void QDocument::update_contents()
|
|||||||
|
|
||||||
|
|
||||||
// layout
|
// layout
|
||||||
for (int n = 0; n<dialog_->layoutModule->classCO->count(); ++n) {
|
dialog_->layoutModule->classCO->setCurrentItem(params.textclass);
|
||||||
if (dialog_->layoutModule->classCO->text(n) ==
|
|
||||||
toqstr(controller().textClass().description())) {
|
|
||||||
dialog_->layoutModule->classCO->setCurrentItem(n);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dialog_->updateFontsize(controller().textClass().opt_fontsize(),
|
dialog_->updateFontsize(controller().textClass().opt_fontsize(),
|
||||||
params.fontsize);
|
params.fontsize);
|
||||||
|
@ -145,7 +145,11 @@ void FormDocument::build()
|
|||||||
fl_end_form();
|
fl_end_form();
|
||||||
for (LyXTextClassList::const_iterator cit = textclasslist.begin();
|
for (LyXTextClassList::const_iterator cit = textclasslist.begin();
|
||||||
cit != textclasslist.end(); ++cit) {
|
cit != textclasslist.end(); ++cit) {
|
||||||
combo_doc_class->addto(cit->description());
|
if (cit->isTeXClassAvailable()) {
|
||||||
|
combo_doc_class->addto(cit->description());
|
||||||
|
} else {
|
||||||
|
combo_doc_class->addto("Unavailable: " + cit->description());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fl_addto_choice(class_->choice_doc_spacing,
|
fl_addto_choice(class_->choice_doc_spacing,
|
||||||
@ -852,7 +856,7 @@ void FormDocument::UpdateClassParams(BufferParams const & params)
|
|||||||
|
|
||||||
LyXTextClass const & tclass = textclasslist[params.textclass];
|
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_clear_choice(class_->choice_doc_fontsize);
|
||||||
fl_addto_choice(class_->choice_doc_fontsize, "default");
|
fl_addto_choice(class_->choice_doc_fontsize, "default");
|
||||||
fl_addto_choice(class_->choice_doc_fontsize,
|
fl_addto_choice(class_->choice_doc_fontsize,
|
||||||
|
@ -49,9 +49,9 @@ struct compare_name {
|
|||||||
|
|
||||||
|
|
||||||
LyXTextClass::LyXTextClass(string const & fn, string const & cln,
|
LyXTextClass::LyXTextClass(string const & fn, string const & cln,
|
||||||
string const & desc)
|
string const & desc, bool texClassAvail )
|
||||||
: name_(fn), latexname_(cln), description_(desc),
|
: name_(fn), latexname_(cln), description_(desc),
|
||||||
floatlist_(new FloatList), ctrs_(new Counters)
|
floatlist_(new FloatList), ctrs_(new Counters), texClassAvail_(texClassAvail)
|
||||||
{
|
{
|
||||||
outputType_ = LATEX;
|
outputType_ = LATEX;
|
||||||
columns_ = 1;
|
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)
|
bool LyXTextClass::do_readStyle(LyXLex & lexrc, LyXLayout & lay)
|
||||||
{
|
{
|
||||||
lyxerr[Debug::TCLASS] << "Reading style " << lay.name() << endl;
|
lyxerr[Debug::TCLASS] << "Reading style " << lay.name() << endl;
|
||||||
|
@ -39,7 +39,11 @@ public:
|
|||||||
explicit
|
explicit
|
||||||
LyXTextClass(string const & = string(),
|
LyXTextClass(string const & = string(),
|
||||||
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.
|
/// paragraph styles begin iterator.
|
||||||
const_iterator begin() const { return layoutlist_.begin(); }
|
const_iterator begin() const { return layoutlist_.begin(); }
|
||||||
@ -150,6 +154,8 @@ public:
|
|||||||
///
|
///
|
||||||
int size() const;
|
int size() const;
|
||||||
private:
|
private:
|
||||||
|
/// Is the TeX class available?
|
||||||
|
bool texClassAvail_;
|
||||||
///
|
///
|
||||||
bool delete_layout(string const &);
|
bool delete_layout(string const &);
|
||||||
///
|
///
|
||||||
|
@ -69,7 +69,9 @@ LyXTextClassList::operator[](textclass_type textclass) const
|
|||||||
class less_textclass_desc {
|
class less_textclass_desc {
|
||||||
public:
|
public:
|
||||||
int operator()(LyXTextClass const & tc1, LyXTextClass const & tc2) {
|
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,13 +132,17 @@ bool LyXTextClassList::Read ()
|
|||||||
if (lex.next()) {
|
if (lex.next()) {
|
||||||
string const desc = lex.getString();
|
string const desc = lex.getString();
|
||||||
lyxerr[Debug::TCLASS] << "Desc: " << desc << endl;
|
lyxerr[Debug::TCLASS] << "Desc: " << desc << endl;
|
||||||
// This code is run when we have
|
if (lex.next()) {
|
||||||
// fname, clname and desc
|
bool avail = lex.getBool();
|
||||||
LyXTextClass tmpl(fname, clname, desc);
|
lyxerr[Debug::TCLASS] << "Avail: " << avail << endl;
|
||||||
if (lyxerr.debugging(Debug::TCLASS)) {
|
// This code is run when we have
|
||||||
tmpl.load();
|
// fname, clname, desc, and avail
|
||||||
|
LyXTextClass tmpl(fname, clname, desc, avail);
|
||||||
|
if (lyxerr.debugging(Debug::TCLASS)) {
|
||||||
|
tmpl.load();
|
||||||
|
}
|
||||||
|
classlist_.push_back(tmpl);
|
||||||
}
|
}
|
||||||
classlist_.push_back(tmpl);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,13 @@ What's new
|
|||||||
|
|
||||||
** Updates
|
** 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
|
- add support for \boldsymbol in math editor
|
||||||
|
|
||||||
- update danish, italian, romanian and slovenian interface localizations
|
- update danish, italian, romanian and slovenian interface localizations
|
||||||
|
Loading…
Reference in New Issue
Block a user