mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
implement DependsOn tag for layout files; more uninteresting cleanup
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4729 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b14cdca9e6
commit
8a91f206c6
@ -44,11 +44,23 @@
|
||||
# - Fact
|
||||
# - Fact*
|
||||
|
||||
# A hack: this is used to provide a preamble which is needed by other
|
||||
# style. Since this style has been obsoleted, it does not show up in
|
||||
# layout lists
|
||||
Style TheoremStyle
|
||||
ObsoletedBy Standard
|
||||
Preamble
|
||||
\theoremstyle{plain}
|
||||
EndPreamble
|
||||
End
|
||||
|
||||
|
||||
# Theorem-numbered style declaration
|
||||
Style Theorem
|
||||
Margin First_Dynamic
|
||||
LatexType Environment
|
||||
LatexName thm
|
||||
DependsOn TheoremStyle
|
||||
NextNoIndent 1
|
||||
LabelSep xx
|
||||
ParIndent MMM
|
||||
|
@ -236,7 +236,7 @@ BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
|
||||
(static_cast<int>(uc1) | static_cast<int>(uc2));
|
||||
}
|
||||
|
||||
bool BufferView::Dispatch(kb_action action, string const & argument)
|
||||
bool BufferView::dispatch(kb_action action, string const & argument)
|
||||
{
|
||||
return pimpl_->Dispatch(action, argument);
|
||||
return pimpl_->dispatch(action, argument);
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ public:
|
||||
///
|
||||
void stuffClipboard(string const &) const;
|
||||
///
|
||||
bool Dispatch(kb_action action, string const & argument);
|
||||
bool dispatch(kb_action action, string const & argument);
|
||||
private:
|
||||
///
|
||||
struct Pimpl;
|
||||
|
@ -1468,7 +1468,7 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen)
|
||||
}
|
||||
|
||||
|
||||
bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
||||
bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
|
||||
{
|
||||
lyxerr[Debug::ACTION] << "BufferView::Pimpl::Dispatch: action["
|
||||
<< action <<"] arg[" << argument << "]" << endl;
|
||||
|
@ -125,7 +125,7 @@ struct BufferView::Pimpl : public boost::signals::trackable {
|
||||
///
|
||||
void updateInset(Inset * inset, bool mark_dirty);
|
||||
///
|
||||
bool Dispatch(kb_action action, string const & argument);
|
||||
bool dispatch(kb_action action, string const & argument);
|
||||
private:
|
||||
/**
|
||||
* Return the on-screen dimensions of the inset at the cursor.
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-07-20 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||
|
||||
* lyxfunc.C (dispatch): add 'done' message to minibuffer when
|
||||
saving is finished
|
||||
|
||||
2002-07-20 Dekel Tsur <dekelts@tau.ac.il>
|
||||
|
||||
* BufferView_pimpl.C (workAreaButtonRelease): Fix opening of
|
||||
@ -13,6 +18,18 @@
|
||||
|
||||
2002-07-20 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||
|
||||
* lyxfunc.C (dispatch):
|
||||
* BufferView_pimpl.C:
|
||||
* BufferView_pimpl.h:
|
||||
* BufferView.C:
|
||||
* BufferView.h: rename Dispatch() to dispatch()
|
||||
|
||||
* LaTeXFeatures.C (useLayout): honor LyXLayout::depends_on()
|
||||
|
||||
* lyxlayout.C (Read): honor DependsOn tag
|
||||
|
||||
* lyxlayout.[Ch] (depends_on): new method
|
||||
|
||||
* version.C.in: update lyx_docversion
|
||||
|
||||
* LaTeXFeatures.C (getMacros): only define \LyX when needed
|
||||
|
@ -51,9 +51,42 @@ void LaTeXFeatures::require(string const & name)
|
||||
}
|
||||
|
||||
|
||||
void LaTeXFeatures::useLayout(string const & lyt)
|
||||
void LaTeXFeatures::useLayout(string const & layoutname)
|
||||
{
|
||||
layout.insert(lyt);
|
||||
// Some code to avoid loops in dependency definition
|
||||
static int level = 0;
|
||||
const int maxlevel = 30;
|
||||
if (level > maxlevel) {
|
||||
lyxerr << "LaTeXFeatures::useLayout: maximum level of "
|
||||
<< "recursion attained by layout "
|
||||
<< layoutname << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
LyXTextClass tclass = textclasslist[params.textclass];
|
||||
if (tclass.hasLayout(layoutname)) {
|
||||
// Is this layout already in usedLayouts?
|
||||
vector<string>::const_iterator cit = usedLayouts.begin();
|
||||
vector<string>::const_iterator end = usedLayouts.end();
|
||||
for (; cit != end; ++cit) {
|
||||
if (layoutname == *cit)
|
||||
return;
|
||||
}
|
||||
|
||||
LyXLayout_ptr lyt = tclass[layoutname];
|
||||
if (!lyt->depends_on().empty()) {
|
||||
++level;
|
||||
useLayout(lyt->depends_on());
|
||||
--level;
|
||||
}
|
||||
usedLayouts.push_back(layoutname);
|
||||
} else {
|
||||
lyxerr << "LaTeXFeatures::useLayout: layout `"
|
||||
<< layoutname << "' does not exist in this class"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
--level;
|
||||
}
|
||||
|
||||
|
||||
@ -337,8 +370,8 @@ string const LaTeXFeatures::getTClassPreamble() const
|
||||
|
||||
tcpreamble << tclass.preamble();
|
||||
|
||||
set<string>::const_iterator cit = layout.begin();
|
||||
set<string>::const_iterator end = layout.end();
|
||||
vector<string>::const_iterator cit = usedLayouts.begin();
|
||||
vector<string>::const_iterator end = usedLayouts.end();
|
||||
for (; cit != end; ++cit) {
|
||||
tcpreamble << tclass[*cit]->preamble();
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
private:
|
||||
string externalPreambles;
|
||||
|
||||
std::set<string> layout;
|
||||
std::vector<string> usedLayouts;
|
||||
|
||||
/// Static preamble bits from the external material insets
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-07-20 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||
|
||||
* insettext.C (localDispatch): BufferView::Dispatch has been
|
||||
renamed to BufferView::dispatch
|
||||
|
||||
2002-07-19 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||
|
||||
* insetgraphicsParams.C (as_grfxParams): use the new
|
||||
|
@ -1246,7 +1246,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
|
||||
case LFUN_DEFAULT:
|
||||
case LFUN_UNDERLINE:
|
||||
case LFUN_FONT_SIZE:
|
||||
if (bv->Dispatch(action, arg))
|
||||
if (bv->dispatch(action, arg))
|
||||
result = DISPATCHED;
|
||||
break;
|
||||
default:
|
||||
|
@ -1528,7 +1528,7 @@ InsetText::localDispatch(BufferView * bv,
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!bv->Dispatch(action, arg))
|
||||
if (!bv->dispatch(action, arg))
|
||||
result = UNDISPATCHED;
|
||||
break;
|
||||
}
|
||||
|
@ -709,7 +709,7 @@ void LyXFunc::dispatch(int ac, bool verbose)
|
||||
|
||||
void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
{
|
||||
lyxerr[Debug::ACTION] << "LyXFunc::Dispatch: action[" << action
|
||||
lyxerr[Debug::ACTION] << "LyXFunc::dispatch: action[" << action
|
||||
<<"] arg[" << argument << "]" << endl;
|
||||
|
||||
// we have not done anything wrong yet.
|
||||
@ -730,7 +730,7 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
|
||||
// We cannot use this function here
|
||||
if (getStatus(action, argument).disabled()) {
|
||||
lyxerr[Debug::ACTION] << "LyXFunc::Dispatch: "
|
||||
lyxerr[Debug::ACTION] << "LyXFunc::dispatch: "
|
||||
<< lyxaction.getActionName(action)
|
||||
<< " [" << action << "] is disabled at this location"
|
||||
<< endl;
|
||||
@ -965,6 +965,8 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
<< MakeDisplayPath(owner->buffer()->fileName() + "...");
|
||||
owner->message(s1.str().c_str());
|
||||
MenuWrite(owner->view(), owner->buffer());
|
||||
s1 << _(" done.");
|
||||
owner->message(s1.str().c_str());
|
||||
} else
|
||||
WriteAs(owner->view(), owner->buffer());
|
||||
break;
|
||||
@ -1534,7 +1536,7 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
|
||||
default:
|
||||
// Then if it was none of the above
|
||||
// Trying the BufferView::pimpl dispatch:
|
||||
if (!owner->view()->Dispatch(action, argument))
|
||||
if (!owner->view()->dispatch(action, argument))
|
||||
lyxerr << "A truly unknown func ["
|
||||
<< lyxaction.getActionName(action) << "]!"
|
||||
<< endl;
|
||||
|
@ -32,6 +32,7 @@ enum LayoutTags {
|
||||
LT_MARGIN,
|
||||
LT_BOTTOMSEP,
|
||||
LT_COPYSTYLE,
|
||||
LT_DEPENDSON,
|
||||
LT_OBSOLETEDBY,
|
||||
//LT_EMPTY,
|
||||
LT_END,
|
||||
@ -114,45 +115,46 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass)
|
||||
{
|
||||
// This table is sorted alphabetically [asierra 30March96]
|
||||
keyword_item layoutTags[] = {
|
||||
{ "align", LT_ALIGN },
|
||||
{ "alignpossible", LT_ALIGNPOSSIBLE },
|
||||
{ "bottomsep", LT_BOTTOMSEP },
|
||||
{ "copystyle", LT_COPYSTYLE },
|
||||
{ "end", LT_END },
|
||||
{ "align", LT_ALIGN },
|
||||
{ "alignpossible", LT_ALIGNPOSSIBLE },
|
||||
{ "bottomsep", LT_BOTTOMSEP },
|
||||
{ "copystyle", LT_COPYSTYLE },
|
||||
{ "dependson", LT_DEPENDSON },
|
||||
{ "end", LT_END },
|
||||
{ "endlabelstring", LT_ENDLABELSTRING },
|
||||
{ "endlabeltype", LT_ENDLABELTYPE },
|
||||
{ "fill_bottom", LT_FILL_BOTTOM },
|
||||
{ "fill_top", LT_FILL_TOP },
|
||||
{ "font", LT_FONT },
|
||||
{ "freespacing", LT_FREE_SPACING },
|
||||
{ "intitle", LT_INTITLE },
|
||||
{ "itemsep", LT_ITEMSEP },
|
||||
{ "keepempty", LT_KEEPEMPTY },
|
||||
{ "labelbottomsep", LT_LABEL_BOTTOMSEP },
|
||||
{ "labelfont", LT_LABELFONT },
|
||||
{ "fill_bottom", LT_FILL_BOTTOM },
|
||||
{ "fill_top", LT_FILL_TOP },
|
||||
{ "font", LT_FONT },
|
||||
{ "freespacing", LT_FREE_SPACING },
|
||||
{ "intitle", LT_INTITLE },
|
||||
{ "itemsep", LT_ITEMSEP },
|
||||
{ "keepempty", LT_KEEPEMPTY },
|
||||
{ "labelbottomsep", LT_LABEL_BOTTOMSEP },
|
||||
{ "labelfont", LT_LABELFONT },
|
||||
{ "labelindent", LT_LABELINDENT },
|
||||
{ "labelsep", LT_LABELSEP },
|
||||
{ "labelsep", LT_LABELSEP },
|
||||
{ "labelstring", LT_LABELSTRING },
|
||||
{ "labelstringappendix", LT_LABELSTRING_APPENDIX },
|
||||
{ "labeltype", LT_LABELTYPE },
|
||||
{ "latexname", LT_LATEXNAME },
|
||||
{ "latexparam", LT_LATEXPARAM },
|
||||
{ "latextype", LT_LATEXTYPE },
|
||||
{ "leftmargin", LT_LEFTMARGIN },
|
||||
{ "margin", LT_MARGIN },
|
||||
{ "needprotect", LT_NEED_PROTECT },
|
||||
{ "newline", LT_NEWLINE },
|
||||
{ "nextnoindent", LT_NEXTNOINDENT },
|
||||
{ "obsoletedby", LT_OBSOLETEDBY },
|
||||
{ "parindent", LT_PARINDENT },
|
||||
{ "parsep", LT_PARSEP },
|
||||
{ "parskip", LT_PARSKIP },
|
||||
{ "passthru", LT_PASS_THRU },
|
||||
{ "preamble", LT_PREAMBLE },
|
||||
{ "rightmargin", LT_RIGHTMARGIN },
|
||||
{ "spacing", LT_SPACING },
|
||||
{ "textfont", LT_TEXTFONT },
|
||||
{ "topsep", LT_TOPSEP }
|
||||
{ "labelstringappendix", LT_LABELSTRING_APPENDIX },
|
||||
{ "labeltype", LT_LABELTYPE },
|
||||
{ "latexname", LT_LATEXNAME },
|
||||
{ "latexparam", LT_LATEXPARAM },
|
||||
{ "latextype", LT_LATEXTYPE },
|
||||
{ "leftmargin", LT_LEFTMARGIN },
|
||||
{ "margin", LT_MARGIN },
|
||||
{ "needprotect", LT_NEED_PROTECT },
|
||||
{ "newline", LT_NEWLINE },
|
||||
{ "nextnoindent", LT_NEXTNOINDENT },
|
||||
{ "obsoletedby", LT_OBSOLETEDBY },
|
||||
{ "parindent", LT_PARINDENT },
|
||||
{ "parsep", LT_PARSEP },
|
||||
{ "parskip", LT_PARSKIP },
|
||||
{ "passthru", LT_PASS_THRU },
|
||||
{ "preamble", LT_PREAMBLE },
|
||||
{ "rightmargin", LT_RIGHTMARGIN },
|
||||
{ "spacing", LT_SPACING },
|
||||
{ "textfont", LT_TEXTFONT },
|
||||
{ "topsep", LT_TOPSEP }
|
||||
};
|
||||
|
||||
bool error = false;
|
||||
@ -225,6 +227,12 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass)
|
||||
}
|
||||
break;
|
||||
|
||||
case LT_DEPENDSON:
|
||||
if (lexrc.next()) {
|
||||
depends_on_ = lexrc.getString();
|
||||
}
|
||||
break;
|
||||
|
||||
case LT_MARGIN: // Margin style definition.
|
||||
readMargin(lexrc);
|
||||
break;
|
||||
@ -754,3 +762,9 @@ string const & LyXLayout::obsoleted_by() const
|
||||
{
|
||||
return obsoleted_by_;
|
||||
}
|
||||
|
||||
|
||||
string const & LyXLayout::depends_on() const
|
||||
{
|
||||
return depends_on_;
|
||||
}
|
||||
|
@ -52,6 +52,8 @@ public:
|
||||
///
|
||||
string const & obsoleted_by() const;
|
||||
///
|
||||
string const & depends_on() const;
|
||||
///
|
||||
string const & latexname() const { return latexname_; }
|
||||
///
|
||||
string const & labelstring() const { return labelstring_; }
|
||||
@ -196,6 +198,12 @@ private:
|
||||
*/
|
||||
string obsoleted_by_;
|
||||
|
||||
/** Name of an layout which preamble must come before this one
|
||||
This is used when the preamble snippet uses macros defined in
|
||||
another preamble
|
||||
*/
|
||||
string depends_on_;
|
||||
|
||||
/// LaTeX name for environment
|
||||
string latexname_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user