Sorry, just found out that posting to gmane with lynx while not
remembering how to attach a file to the message is not a good idea :-(

Here come the patches and adds. Good luck. 

-- 
Martin Vermeer [EMAIL PROTECTED]
:wq
Index: BufferView_pimpl.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/BufferView_pimpl.C,v
retrieving revision 1.279
diff -u -p -r1.279 BufferView_pimpl.C
--- BufferView_pimpl.C  2002/08/12 09:35:51     1.279
+++ BufferView_pimpl.C  2002/08/16 12:39:02
@@ -67,6 +67,7 @@
 #include "insets/insetcaption.h"
 #include "insets/insetfloatlist.h"
 #include "insets/insetspecialchar.h"
+#include "insets/insetshorttitle.h"
 
 #include "mathed/formulabase.h"
 
@@ -2759,6 +2761,10 @@ bool BufferView::Pimpl::dispatch(FuncReq
 
        case LFUN_INSERT_NOTE:
                insertAndEditInset(new InsetNote(buffer_->params));
+               break;
+
+       case LFUN_INSET_SHORTTITLE:
+               insertAndEditInset(new InsetShortTitle(buffer_->params));
                break;
 
        case LFUN_INSET_FLOAT:
Index: LyXAction.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/LyXAction.C,v
retrieving revision 1.129
diff -u -p -r1.129 LyXAction.C
--- LyXAction.C 2002/08/08 22:03:27     1.129
+++ LyXAction.C 2002/08/16 12:39:03
@@ -249,6 +249,8 @@ void LyXAction::init()
                  ReadOnly },
                { LFUN_INSERT_LABEL, "label-insert", N_("Insert Label"),
                  Noop },
+               { LFUN_INSET_SHORTTITLE, "shorttitle-insert", N_("Insert Short Title"),
+                 Noop },
                { LFUN_LANGUAGE, "language", N_("Change language"), Noop },
                { LFUN_LATEX_LOG, "latex-view-log", N_("View LaTeX log"),
                  ReadOnly },
Index: buffer.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/buffer.C,v
retrieving revision 1.367
diff -u -p -r1.367 buffer.C
--- buffer.C    2002/08/12 00:15:16     1.367
+++ buffer.C    2002/08/16 12:39:06
@@ -70,6 +70,7 @@
 #include "insets/insetgraphics.h"
 #include "insets/insetfoot.h"
 #include "insets/insetmarginal.h"
+#include "insets/insetshorttitle.h"
 #include "insets/insetminipage.h"
 #include "insets/insetfloat.h"
 #include "insets/insettabular.h"
@@ -1631,6 +1632,8 @@ void Buffer::readInset(LyXLex & lex, Par
                        inset = new InsetFoot(params);
                } else if (tmptok == "Marginal") {
                        inset = new InsetMarginal(params);
+               } else if (tmptok == "ShortTitle") {
+                       inset = new InsetShortTitle(params);
                } else if (tmptok == "Minipage") {
                        inset = new InsetMinipage(params);
                } else if (tmptok == "Float") {
Index: commandtags.h
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/commandtags.h,v
retrieving revision 1.96
diff -u -p -r1.96 commandtags.h
--- commandtags.h       2002/08/12 09:53:03     1.96
+++ commandtags.h       2002/08/16 12:39:06
@@ -289,6 +289,7 @@ enum kb_action {
        LFUN_FORKS_SHOW,                // Angus 16 Feb 2002
        LFUN_FORKS_KILL,                // Angus 16 Feb 2002
        LFUN_TOOLTIPS_TOGGLE,           // Angus 8 Mar 2002
+       LFUN_INSET_SHORTTITLE,                  // Martin 12 Aug 2002
        LFUN_MOUSE_PRESS,               // André 9 Aug 2002
        LFUN_MOUSE_MOTION,              // André 9 Aug 2002
        LFUN_MOUSE_RELEASE,             // André 9 Aug 2002
Index: lyxfunc.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/lyxfunc.C,v
retrieving revision 1.364
diff -u -p -r1.364 lyxfunc.C
--- lyxfunc.C   2002/08/11 16:27:09     1.364
+++ lyxfunc.C   2002/08/16 12:39:08
@@ -542,6 +542,9 @@ FuncStatus LyXFunc::getStatus(FuncReques
        case LFUN_INSERT_LABEL:
                code = Inset::LABEL_CODE;
                break;
+       case LFUN_INSET_SHORTTITLE:
+               code = Inset::SHORTTITLE_CODE;
+               break;
        case LFUN_REF_INSERT:
                code = Inset::REF_CODE;
                break;
Index: paragraph.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/paragraph.C,v
retrieving revision 1.219
diff -u -p -r1.219 paragraph.C
--- paragraph.C 2002/08/11 20:34:20     1.219
+++ paragraph.C 2002/08/16 12:39:10
@@ -32,6 +32,7 @@
 #include "insets/insetinclude.h"
 #include "insets/insetbib.h"
 #include "insets/insettext.h"
+#include "insets/insetshorttitle.h"
 
 #include "support/filetools.h"
 #include "support/lstrings.h"
@@ -1114,6 +1115,20 @@ int Paragraph::getPositionOfInset(Inset 
        return -1;
 }
 
+//InsetList::iterator Paragraph::shortTitleInset() const
+InsetShortTitle * Paragraph::shortTitleInset() const
+{
+       // Find the entry.
+       InsetList::iterator it = insetlist.begin();
+       InsetList::iterator end = insetlist.end();
+       for (; it != end; ++it) {
+               Inset * ins = it.getInset();
+               if (ins->lyxCode() == Inset::SHORTTITLE_CODE) {
+                       return static_cast<InsetShortTitle *>(ins);
+               }
+       }
+       return 0;
+}
 
 Paragraph * Paragraph::TeXOnePar(Buffer const * buf,
                                 BufferParams const & bparams,
@@ -1209,11 +1224,21 @@ Paragraph * Paragraph::TeXOnePar(Buffer 
                texrow.newline();
        }
 
+       InsetShortTitle * it = shortTitleInset();
        switch (style->latextype) {
        case LATEX_COMMAND:
                os << '\\'
-                  << style->latexname()
-                  << style->latexparam();
+                  << style->latexname();
+
+               // Separate handling of shorttitle inset.
+               // This means you can put it into ANY LaTeX cmd
+               if (style->latexparam() == "void") {
+                       if (it != 0)
+                               it->latexOptionals(buf, os, false, false);
+               }
+               else
+                       if (style->latexparam() != "none")
+                               os << style->latexparam();
                break;
        case LATEX_ITEM_ENVIRONMENT:
                if (bibkey) {
Index: paragraph.h
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/paragraph.h,v
retrieving revision 1.43
diff -u -p -r1.43 paragraph.h
--- paragraph.h 2002/08/11 20:34:20     1.43
+++ paragraph.h 2002/08/16 12:39:10
@@ -27,6 +27,7 @@ class BufferParams;
 class BufferView;
 class Counters;
 class InsetBibKey;
+class InsetShortTitle;
 class Language;
 class LaTeXFeatures;
 class ParagraphParameters;
@@ -310,6 +311,9 @@ public:
        /// returns -1 if inset not found
        int getPositionOfInset(Inset const * inset) const;
 
+       /// MV
+       InsetShortTitle * shortTitleInset() const;
+       
        /// some good comment here John?
        Paragraph * getParFromID(int id) const;
 
Index: text2.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/text2.C,v
retrieving revision 1.246
diff -u -p -r1.246 text2.C
--- text2.C     2002/08/12 00:15:17     1.246
+++ text2.C     2002/08/16 12:39:17
@@ -39,6 +39,7 @@
 #include "insets/insetspecialchar.h"
 #include "insets/insettext.h"
 #include "insets/insetfloat.h"
+#include "insets/insetshorttitle.h"
 
 #include "support/LAssert.h"
 #include "support/textutils.h"
Index: insets/Makefile.am
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/insets/Makefile.am,v
retrieving revision 1.47
diff -u -p -r1.47 Makefile.am
--- insets/Makefile.am  2002/07/04 13:54:28     1.47
+++ insets/Makefile.am  2002/08/16 12:39:24
@@ -69,6 +69,8 @@ libinsets_la_SOURCES = \
        insetquotes.h \
        insetref.C \
        insetref.h \
+       insetshorttitle.C \
+       insetshorttitle.h \
        insetspecialchar.C \
        insetspecialchar.h \
        insettabular.C \
Index: insets/inset.h
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/insets/inset.h,v
retrieving revision 1.53
diff -u -p -r1.53 inset.h
--- insets/inset.h      2002/08/07 08:11:38     1.53
+++ insets/inset.h      2002/08/16 12:39:24
@@ -115,7 +115,9 @@ public:
                ///
                FLOAT_LIST_CODE,
                ///
-               INDEX_PRINT_CODE
+               INDEX_PRINT_CODE,
+               ///
+               SHORTTITLE_CODE
        };
 
        ///

? agu.layout
? C.diff
? short.diff
Index: stdlayouts.inc
===================================================================
RCS file: /cvs/lyx/lyx-devel/lib/layouts/stdlayouts.inc,v
retrieving revision 1.3
diff -u -p -r1.3 stdlayouts.inc
--- stdlayouts.inc      2001/07/08 12:52:14     1.3
+++ stdlayouts.inc      2002/08/16 12:42:00
@@ -92,10 +92,13 @@ Style Caption
   Align                        Center
   AlignPossible                Center
   LabelType            Sensitive
-  LabelString          Caption
+  LabelString  Caption
+  LatexParam   void
 
   # label font definition
   LabelFont 
     Series             Bold
   EndFont
 End
+
+
Index: stdsections.inc
===================================================================
RCS file: /cvs/lyx/lyx-devel/lib/layouts/stdsections.inc,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 stdsections.inc
--- stdsections.inc     1999/09/27 18:44:34     1.1.1.1
+++ stdsections.inc     2002/08/16 12:42:00
@@ -49,6 +49,7 @@ Style Chapter
   LabelType             Counter_Chapter
   LabelString          "Chapter "
   LabelStringAppendix   "Appendix "
+  LatexParam   void
 
   # standard font definition
   Font 
@@ -73,6 +74,7 @@ Style Section
   Align                        Block
   AlignPossible                Block, Left
   LabelType            Counter_Section
+  LatexParam   void
 
   # standard font definition
   Font 
@@ -97,6 +99,7 @@ Style Subsection
   Align                        Block
   AlignPossible                Block, Left
   LabelType            Counter_Subsection
+  LatexParam   void
 
   # standard font definition
   Font 
@@ -121,6 +124,7 @@ Style Subsubsection
   Align                        Block
   AlignPossible                Block, Left
   LabelType            Counter_SubSubSection
+  LatexParam   void
 
   # standard font definition
   Font 
@@ -145,6 +149,7 @@ Style Paragraph
   Align                        Block
   AlignPossible                Block, Left
   LabelType            Counter_Paragraph
+  LatexParam   void
 
   # standard font definition
   Font 
@@ -170,6 +175,7 @@ Style Subparagraph
   Align                        Block
   AlignPossible                Block, Left
   LabelType            Counter_SubParagraph
+  LatexParam   void
 
   # standard font definition
   Font 
Index: stdstarsections.inc
===================================================================
RCS file: /cvs/lyx/lyx-devel/lib/layouts/stdstarsections.inc,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 stdstarsections.inc
--- stdstarsections.inc 1999/09/27 18:44:34     1.1.1.1
+++ stdstarsections.inc 2002/08/16 12:42:00
@@ -22,6 +22,7 @@ Style Chapter*
   Margin               Static
   LatexName            chapter*
   LabelType            No_Label
+  LatexParam   none
 End
 
 # Section* style definition
@@ -30,6 +31,7 @@ Style Section*
   Margin               Static
   LatexName            section*
   LabelType            No_Label
+  LatexParam   none
 End
 
 # Subsection* style definition
@@ -38,6 +40,7 @@ Style Subsection*
   Margin               Static
   LatexName            subsection*
   LabelType            No_Label
+  LatexParam   none
 End
 
 # Subsubsection* style definition
@@ -46,6 +49,7 @@ Style Subsubsection*
   Margin               Static
   LatexName            subsubsection*
   LabelType            No_Label
+  LatexParam   none
 End
 
 # Paragraph* style definition
@@ -54,6 +58,7 @@ Style Paragraph*
   Margin               Static
   LatexName            paragraph*
   LabelType            No_Label
+  LatexParam   none
 End
 
 # Subparagraph* style definition
@@ -62,5 +67,6 @@ Style Subparagraph*
   Margin               Static
   LatexName            subparagraph*
   LabelType            No_Label
+  LatexParam   none
 End
 
/* This file is part of
 * ======================================================
 *
 *           LyX, The Document Processor
 *
 *          Copyright 1995 Matthias Ettrich
 *          Copyright 1995-2001 The LyX Team.
 *
 * ====================================================== */

#include <config.h>

#ifdef __GNUG__
#pragma implementation
#endif

#include "debug.h"

#include "insetshorttitle.h"
#include "support/LOstream.h"
#include "frontends/Alert.h"
#include "support/lstrings.h" //frontStrip, strip
#include "lyxtext.h"
#include "buffer.h"
#include "gettext.h"
#include "BufferView.h"
#include "support/lstrings.h"

using std::ostream;
using std::vector;
using std::pair;

/* Shorttitle. Used to insert a short version of sectioning header etc.
 *  automatically */


InsetShortTitle::InsetShortTitle(BufferParams const & ins)
        : InsetCollapsable(ins, true)
{
    LyXFont font(LyXFont::ALL_SANE);
        font.setColor(LColor::collapsable);
        setLabelFont(font);
        setLabel(_("short"));
}

InsetShortTitle::InsetShortTitle(InsetShortTitle const & in, bool same_id)
                    : InsetCollapsable(in, same_id)
{
    LyXFont font(LyXFont::ALL_SANE);
        font.setColor(LColor::collapsable);
        setLabelFont(font);
        setLabel(_("short"));
}

Inset * InsetShortTitle::clone(Buffer const &, bool same_id) const
{
                    return new InsetShortTitle(*this, same_id);
}

#if 0
void InsetShortTitle::draw(BufferView * bv, LyXFont const & f,
                                             int baseline, float & x, bool cleared)
{
        //InsetText::setDrawFrame(bv, ALWAYS);
        InsetCollapsable::draw(bv, f, baseline, x, cleared);

        x += width_collapsed();
}
#endif

string const InsetShortTitle::editMessage() const
{
        return _("Opened Short Title Inset");
}

void InsetShortTitle::write(Buffer const * buf, ostream & os) const
{
        os << "ShortTitle" << "\n";
        InsetCollapsable::write(buf, os);
}

int InsetShortTitle::latex(Buffer const * buf, ostream & os,
                                bool fragile, bool fp) const
{
        return 0;
}

int InsetShortTitle::latexOptionals(Buffer const * buf, ostream & os,
                                bool fragile, bool fp) const
{
        os << '[';
        int const i = inset.latex(buf, os, false, false);
        os << ']';
        return i + 2;
}

// -*- C++ -*-
/* This file is part of*
 * ======================================================
 *
 *           LyX, The Document Processor
 *
 *           Copyright 1995 Matthias Ettrich
 *           Copyright 1995-2001 The LyX Team
 *
 * ====================================================== */

#ifndef INSETSHORTTITLE_H
#define INSETSHORTTITLE_H

#ifdef __GNUG__
#pragma interface
#endif

#include "insettext.h"
#include "insetcollapsable.h"

class InsetShortTitle : public InsetCollapsable {
public:
        InsetShortTitle(BufferParams const &);
        ///
        InsetShortTitle(InsetShortTitle const &, bool same_id = false);

        Inset * clone(Buffer const &, bool same_id = false) const;
        ///
        //void draw(BufferView *, LyXFont const &, int, float &, bool) ;
        ///
        EDITABLE editable() const { return IS_EDITABLE; }
        ///
        Inset::Code lyxCode() const { return Inset::SHORTTITLE_CODE; }
        ///
        string const editMessage() const;
        /// Standard LaTeX output -- short-circuited
        int latex(Buffer const *, std::ostream &, 
                                        bool fragile, bool fp) const;
        /// Outputting the optional parameters of a LaTeX command
        int latexOptionals(Buffer const *, std::ostream &, 
                                        bool fragile, bool fp) const;
        ///
        void write(Buffer const * buf, ostream & os) const;
};

#endif

Attachment: msg42988/pgp00000.pgp
Description: PGP signature

Reply via email to