floats in layout files

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5202 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-09-04 06:52:26 +00:00
parent b1736dc48a
commit 6b9e0044d3
7 changed files with 223 additions and 58 deletions

View File

@ -1,3 +1,9 @@
2002-09-04 Lars Gullik Bjønnes <larsbj@gullik.net>
* layouts/stdclass.inc: include stdfloats.h
* layouts/stdfloats.inc: new file
2002-09-03 Angus Leeming <leeming@lyx.org>
* scripts/lyxpreview2ppm.sh: test expects integer arguments.
@ -26,13 +32,13 @@
2002-08-29 John Levon <levon@movementarian.org>
* images/math/: add AMS nrel
2002-08-29 John Levon <levon@movementarian.org>
* images/: add math sub/super script
* images/math/: add \brace, \vec etc.
2002-08-29 John Levon <levon@movementarian.org>
* Makefile.am: install mathed icons
@ -40,11 +46,11 @@
2002-08-29 John Levon <levon@movementarian.org>
* images/math/: add all icons except AMS nrel
2002-08-29 John Levon <levon@movementarian.org>
* images/math/: add most of the normal XPMs
2002-08-28 Rob Lahaye <lahaye@snu.ac.kr>
* lyx2lyx/lyx2lyx: add new format number "221"
@ -52,7 +58,7 @@
2002-08-25 John Levon <levon@movementarian.org>
* images/find-replace.xpm: add
2002-08-23 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* configure.m4: fix epsi->eps converter
@ -81,7 +87,7 @@
2002-08-15 John Levon <levon@movementarian.org>
* scripts/convertDefault.sh: use /bin/sh not /bin/bash
2002-08-15 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* doc/LaTeXConfig.lyx.in: add description of cl2emult class
@ -101,20 +107,20 @@
2002-08-08 Herbert Voss <voss@perce.de>
* ui/default.ui: put gather into math menu
2002-08-07 John Levon <levon@movementarian.org>
* images/layout_LaTeX.xpm: remove - obsolete
2002-08-05 John Levon <levon@movementarian.org>
* images/dialog-tabular-insert.xpm: remove unneeded xpm
2002-08-05 John Levon <levon@movementarian.org>
* ui/default.ui:
* bind/xemacs.bind: back to tabular-insert
2002-08-03 Dekel Tsur <dekelts@tau.ac.il>
* lyx2lyx/lyxconvert_218.py (remove_oldert): Few fixes.
@ -126,7 +132,7 @@
* lyx2lyx/lyxconvert_218.py: Convert ERT and figinsets.
2002-07-30 André Pönitz <poenitz@gmx.net>
* configure.m4:
* ui/default.ui: make math-extern a bit more visible in Edit->Math
@ -153,13 +159,13 @@
* scripts/convertDefault.sh: defines a converter which is used
when no userdefined was found
2002-07-20 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* ui/default.ui: cleanup after change of Menu syntax. the
foo_nobuffer menus are gone
* bind/sv_menus.bind:
* bind/sv_menus.bind:
* bind/sciword.bind: remove some cruft
* tex/iletter.cls:
@ -176,10 +182,10 @@
2002-07-18 Angus Leeming <leeming@lyx.org>
* scripts/lyxpreview2ppm.sh: clean-up. Get it to work with
scary_eqns.lyx.
scary_eqns.lyx.
2002-07-17 André Pönitz <poenitz@gmx.net>
* configure.m4: fix typo in last change
* symbols: add \hbar
@ -194,9 +200,9 @@
2002-07-16 Andrew Zabolotny <zap@cobra.ru>
* bind/emacs.bind:
* bind/xemacs.bind:
* bind/sciword.bind:
* bind/emacs.bind:
* bind/xemacs.bind:
* bind/sciword.bind:
* bind/cua.bind: include greekkeys and cyrkeys bindings
* bind/greekkeys.bind:
@ -221,15 +227,15 @@
* lyxpreview2ppm.sh: use the pnmraw device in preference to pnm.
2002-07-12 André Pönitz <poenitz@gmx.net>
* ui/default.ui: add menu for font changes
* symbols: add textt
2002-07-10 Andrew Zabolotny <zap@cobra.ru>
* bind/emacs.bind:
* bind/xemacs.bind:
* bind/sciword.bind:
* bind/emacs.bind:
* bind/xemacs.bind:
* bind/sciword.bind:
* bind/cua.bind: better support for selection from numeric keypad
* kbd/cp1251.cdef:
@ -248,7 +254,7 @@
as it's not portable apparently.
2002-07-09 André Pönitz <poenitz@gmx.net>
* symbols: use it to define insets, too
* configure.m4:
* symbols: wasy symbols added
@ -259,7 +265,7 @@
left and right if so desired.
2002-07-08 André Pönitz <poenitz@gmx.net>
* symbols: more stuff missing from the Porto changes
2002-07-05 Angus Leeming <leeming@lyx.org>
@ -270,7 +276,7 @@
2002-06-19 Herbert Voss <voss@perce.de>
* configure.m4: add converters for epsi and (x)fig
2002-07-03 Vitaly Lipatov <LAV@VL3143.spb.edu>
* languages: add support for belarusian and kazakh
@ -278,7 +284,7 @@
* encodings: add pt154
2002-06-27 André Pönitz <poenitz@gmx.net>
* configure.m4: add support for lyxpreview "format"
* scripts/lyxpreview2xpm: add file
@ -295,23 +301,23 @@
2002-06-21 John Levon <moz@compsoc.man.ac.uk>
* ui/default.ui: fix ellipses
2002-06-20 John Levon <moz@compsoc.man.ac.uk>
* ui/default.ui: remove Index Entry of last word
* ui/old-default.ui: remove
2002-06-19 Dekel Tsur <dekelts@tau.ac.il>
* examples/mathed.lyx: Remove obsolete part.
2002-06-17 Herbert Voss <voss@perce.de>
* configure.m4: install only those converters which are different
to convert, because this is taken as the default. SO we can get
rid of all problems when user do not have installed the right
converters.
* configure.m4: install only those converters which are different
to convert, because this is taken as the default. SO we can get
rid of all problems when user do not have installed the right
converters.
2002-06-16 Adrien Rebollo <adrien.rebollo@gmx.fr>
@ -336,7 +342,7 @@
2002-05-30 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* templates/IEEEtran.lyx: update to 1.2.0 format from Michael
Schmitt
Schmitt
* reLyX/reLyX.in: honor variable LYX_DIR_13x
@ -352,7 +358,7 @@
2002-05-28 John Levon <moz@compsoc.man.ac.uk>
* images/buffer-new.xpm: icon from Vitaly Lipatov
2002-05-24 John Levon <moz@compsoc.man.ac.uk>
* CREDITS: kill mention of KDE

View File

@ -42,4 +42,5 @@ Input stdtitle.inc
Input stdstruct.inc
Input lyxmacros.inc
Input stdlayouts.inc
Input stdfloats.inc
Input obsolete.inc

38
lib/layouts/stdfloats.inc Normal file
View File

@ -0,0 +1,38 @@
# Author : Lars Gullik Bjønnes <larsbj@lyx.org>
# This include file contains all the floats that are defined as standard
# in most LyX layouts.
Float
Type table
GuiName Table
Placement tbp
Extension lot
NumberWithin none
Style plain
ListName "List of Tables"
LaTeXBuiltin true
End
Float
Type figure
GuiName Figure
Placement tbp
Extension lof
NumberWithin none
Style plain
ListName "List of Figures"
LaTeXBuiltin true
End
Float
Type algorithm
GuiName Algorithm
Placement tbp
Extension loa
NumberWithin none
Style ruled
ListName "List of Algorithms"
LaTeXBuiltin false
End

View File

@ -1,3 +1,15 @@
2002-09-04 Lars Gullik Bjønnes <larsbj@gullik.net>
* lyxtextclass.C (TextClassTags): add TC_FLOAT
(Read): add float->TC_FLOAT to textclassTags
(Read): and handle it in the switch
(readFloat): new function
* FloatList.C (FloatList): comment out the hardcoded float
definitions.
* lyxlayout.h: ws change.
2002-08-29 Dekel Tsur <dekelts@tau.ac.il>
* buffer.C (readFile): Look for lyx2lyx in LYXDIR/lyx2lyx/
@ -34,7 +46,7 @@
* BufferView_pimpl.C (dispatch): do not continue when
no buffer
2002-08-28 André Pönitz <poenitz@gmx.net>
* commandtags.h: new LFUN_MOUSE_DOUBLE, LFUN_MOUSE_TRIPLE
@ -48,23 +60,23 @@
* lyxrc.[Ch]: declare display_graphics as grfx::DisplayType and use
grfx::displayTranslator.find(foo); include graphics/GraphicsTypes.h.
* lyxrc.C: use more "if (...) { } else { }" style (John's advice).
* lyx_main.C: call once the setDisplayTranslator(); is that okay here?
2002-08-27 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* factory.C (createInset): use LyXTextClass::floats
* MenuBackend.C (expandFloatListInsert):
(expandFloatInsert):
(expandToc):
* MenuBackend.C (expandFloatListInsert):
(expandFloatInsert):
(expandToc):
* text2.C (setCounter):
* text2.C (setCounter):
* LaTeXFeatures.C (useFloat):
(getFloatDefinitions):
* LaTeXFeatures.C (useFloat):
(getFloatDefinitions):
* BufferView_pimpl.C (dispatch): use LyXTextClass::floats()
@ -85,7 +97,7 @@
2002-08-25 John Levon <levon@movementarian.org>
* LyXAction.C: fix margin note description
2002-08-24 John Levon <levon@movementarian.org>
* buffer.C:
@ -95,15 +107,15 @@
* undo_funcs.C: cleanups
* lyxfunc.C: disable CUT/COPY when no selection
2002-08-23 Rob Lahaye <lahaye@snu.ac.kr>
* lyxlength.[Ch]: use better (three letters) mnemonics for percentage units
in "enum UNIT"; e.g. PTW for Percent of TextWidth
* lyxrc.C: graphics display is now monochrome|grayscale|color|none.
Add backward compatibility to "mono", "gray" and "no".
* lyxlength.[Ch]: use better (three letters) mnemonics for percentage units
in "enum UNIT"; e.g. PTW for Percent of TextWidth
* lyxrc.C: graphics display is now monochrome|grayscale|color|none.
Add backward compatibility to "mono", "gray" and "no".
2002-08-24 Dekel Tsur <dekelts@tau.ac.il>
* buffer.C (readFile): Always run lyx2lyx if file_format < LYX_FORMAT
@ -140,7 +152,7 @@
2002-08-22 Martin Vermeer <martin.vermeer@hut.fi>
* text2.C (setCounter): fixed enumeration mis-count as reported by
* text2.C (setCounter): fixed enumeration mis-count as reported by
Dr. Richard Hawkins.
2002-08-21 Lars Gullik Bjønnes <larsbj@birdstep.com>

View File

@ -26,6 +26,7 @@
FloatList::FloatList()
{
#if 0
// Insert the latex builtin float-types
// (these will later be read from a layout file)
@ -36,7 +37,7 @@ FloatList::FloatList()
// figure
Floating figure("figure", "tbp", "lof",
"", "plain", N_("Figure"),
"", "plain", N_("Figure"),
N_("List of Figures"), true);
newFloat(figure);
@ -47,6 +48,7 @@ FloatList::FloatList()
"", "ruled", N_("Algorithm"),
N_("List of Algorithms"));
newFloat(algorithm);
#endif
}
@ -103,4 +105,3 @@ FloatList::const_iterator FloatList::operator[](string const & t) const
{
return list.find(t);
}

View File

@ -107,7 +107,8 @@ enum TextClassTags {
TC_PROVIDESMAKEIDX,
TC_PROVIDESURL,
TC_LEFTMARGIN,
TC_RIGHTMARGIN
TC_RIGHTMARGIN,
TC_FLOAT
};
@ -119,6 +120,7 @@ bool LyXTextClass::Read(string const & filename, bool merge)
{ "columns", TC_COLUMNS },
{ "defaultfont", TC_DEFAULTFONT },
{ "defaultstyle", TC_DEFAULTSTYLE },
{ "float", TC_FLOAT },
{ "input", TC_INPUT },
{ "leftmargin", TC_LEFTMARGIN },
{ "maxcounter", TC_MAXCOUNTER },
@ -146,7 +148,7 @@ bool LyXTextClass::Read(string const & filename, bool merge)
<< MakeDisplayPath(filename)
<< endl;
LyXLex lexrc(textClassTags, TC_RIGHTMARGIN);
LyXLex lexrc(textClassTags, TC_FLOAT);
bool error = false;
lexrc.setFile(filename);
@ -322,6 +324,9 @@ bool LyXTextClass::Read(string const & filename, bool merge)
if (lexrc.next())
rightmargin_ = lexrc.getString();
break;
case TC_FLOAT:
readFloat(lexrc);
break;
}
}
@ -495,6 +500,106 @@ void LyXTextClass::readClassOptions(LyXLex & lexrc)
}
enum FloatTags {
FT_TYPE = 1,
FT_NAME,
FT_PLACEMENT,
FT_EXT,
FT_WITHIN,
FT_STYLE,
FT_LISTNAME,
FT_BUILTIN,
FT_END
};
void LyXTextClass::readFloat(LyXLex & lexrc)
{
keyword_item floatTags[] = {
{ "end", FT_END },
{ "extension", FT_EXT },
{ "guiname", FT_NAME },
{ "latexbuiltin", FT_BUILTIN },
{ "listname", FT_LISTNAME },
{ "numberwithin", FT_WITHIN },
{ "placement", FT_PLACEMENT },
{ "style", FT_STYLE },
{ "type", FT_TYPE }
};
lexrc.pushTable(floatTags, FT_END);
string type;
string placement;
string ext;
string within;
string style;
string name;
string listname;
bool builtin = false;
bool getout = false;
while (!getout && lexrc.isOK()) {
int le = lexrc.lex();
switch (le) {
case LyXLex::LEX_UNDEF:
lexrc.printError("Unknown ClassOption tag `$$Token'");
continue;
default: break;
}
switch (static_cast<FloatTags>(le)) {
case FT_TYPE:
lexrc.next();
type = lexrc.getString();
// Here we could check if this type is already defined
// and modify it with the rest of the vars instead.
break;
case FT_NAME:
lexrc.next();
name = lexrc.getString();
break;
case FT_PLACEMENT:
lexrc.next();
placement = lexrc.getString();
break;
case FT_EXT:
lexrc.next();
ext = lexrc.getString();
break;
case FT_WITHIN:
lexrc.next();
within = lexrc.getString();
if (within == "none")
within.erase();
break;
case FT_STYLE:
lexrc.next();
style = lexrc.getString();
break;
case FT_LISTNAME:
lexrc.next();
listname = lexrc.getString();
break;
case FT_BUILTIN:
lexrc.next();
builtin = lexrc.getBool();
break;
case FT_END:
getout = true;
break;
}
}
// Here if have a full float if getout == true
if (getout) {
Floating newfloat(type, placement, ext, within,
style, name, listname, builtin);
floatlist_.newFloat(newfloat);
}
lexrc.popTable();
}
LyXFont const & LyXTextClass::defaultfont() const
{
return defaultfont_;

View File

@ -54,6 +54,8 @@ public:
///
void readClassOptions(LyXLex &);
///
void readFloat(LyXLex &);
///
bool hasLayout(string const & name) const;
///