]> git.lyx.org Git - lyx.git/commitdiff
floats in layout files
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 4 Sep 2002 06:52:26 +0000 (06:52 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 4 Sep 2002 06:52:26 +0000 (06:52 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5202 a592a061-630c-0410-9148-cb99ea01b6c8

lib/ChangeLog
lib/layouts/stdclass.inc
lib/layouts/stdfloats.inc [new file with mode: 0644]
src/ChangeLog
src/FloatList.C
src/lyxtextclass.C
src/lyxtextclass.h

index 95510a8ccbce22ebef03341b671046816490d608..d214aaa8a53470bf5347161670ac365ece1a65a9 100644 (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.
 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
 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
 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.
        * 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
 
 
        * 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:
 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
 
 
 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:
        * 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:
        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
        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>
 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
        * encodings: add pt154
 
 2002-06-27  André Pönitz <poenitz@gmx.net>
-       
+
        * configure.m4: add support for lyxpreview "format"
 
        * scripts/lyxpreview2xpm: add file
 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>
 
 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
 
 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
index 17a7498e32342eb59b0454a1fc688d5eb6ce86ac..bb1700e72d16a58c724f562fda98e55f9c6f4347 100644 (file)
@@ -42,4 +42,5 @@ Input stdtitle.inc
 Input stdstruct.inc
 Input lyxmacros.inc
 Input stdlayouts.inc
+Input stdfloats.inc
 Input obsolete.inc
diff --git a/lib/layouts/stdfloats.inc b/lib/layouts/stdfloats.inc
new file mode 100644 (file)
index 0000000..54a2384
--- /dev/null
@@ -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
index 761f4758e3e89cf274dbc2e9055a50cd3373e91e..6c81472a7f4cc5ea1742a206c4f58ac5949c0149 100644 (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
 
        * 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:
        * 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
 
 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>
index 932eda5e8650b5914ee96f184e1b56ba5ee42156..2e12fcf31f5c4f28e1edf1f23dc84ae24dc519d6 100644 (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);
 }
-
index 63c6f92bb8c290e9ce28c91f6535c83ecda300d7..5d87ca71aaed38558355166449488e3bb0b71b7c 100644 (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_;
index 2d1021f792d438591087ed20f1887b4a27c2f246..33cc930851348ec282eae9c8ba14d208ff1892b6 100644 (file)
@@ -54,6 +54,8 @@ public:
        ///
        void readClassOptions(LyXLex &);
        ///
+       void readFloat(LyXLex &);
+       ///
        bool hasLayout(string const & name) const;
 
        ///