On Fri, Jun 14, 2002 at 12:49:38PM +0100, John Levon wrote: ... > > Yes, I saw InsetSection. Shouldn't we rather develop this further? > > /me looks > > lol. Your work is done ! :)) > > > Hmmm, that would require making the paragraphs following the section > > header (up to the next header at same level, i.e. containing 'subber' > > section headers) into one collapsible textinset. Elegant, yes, like > > outline mode in emacs or MS Word. I know outlining would be extremely > > useful, but -- you may do it. > > Yeah, it's probably more non-trivial. > > > Great! Must be something with my eyesight. Honestly I see why this > > makes sense, but I just don't have what it takes. > > > Course you do ... > > regards > john >
Okay John, here is a sample of my ignorance [sentence conformant to Friday cultural context assumptions]. Attached. It does nothing yet -- it just compiles. Except in one place which I don't get (behind // for now). People over 40 shouldn't have to learn C++. Attached one patch and two new files. If this goes in the right direction you could even check it in... Martin
Index: inset.h =================================================================== RCS file: /cvs/lyx/lyx-devel/src/insets/inset.h,v retrieving revision 1.45 diff -u -p -r1.45 inset.h --- inset.h 2002/05/26 17:33:12 1.45 +++ inset.h 2002/06/14 12:07:27 @@ -111,7 +111,11 @@ public: /// FLOAT_LIST_CODE, /// - INDEX_PRINT_CODE + INDEX_PRINT_CODE, + /// + SECTION_CODE, + /// + SHORTTITLE_CODE }; /// Index: insetsection.h =================================================================== RCS file: /cvs/lyx/lyx-devel/src/insets/insetsection.h,v retrieving revision 1.3 diff -u -p -r1.3 insetsection.h --- insetsection.h 2002/03/21 17:09:50 1.3 +++ insetsection.h 2002/06/14 12:07:27 @@ -20,11 +20,22 @@ #include "LString.h" #include "insettext.h" +#include "insetshorttitle.h" -/** A colapsable text inset +/** A collapsable text inset */ class InsetSection : public InsetText { public: + /// + InsetSection(BufferParams const & bp):InsetText::InsetText(bp) {} + /// + Inset::Code lyxCode() const { return Inset::SECTION_CODE; } + /// + void insetShortTitle(InsetText const & ins) { + // Why not work? -- MV + //InsetShortTitle(ins); + } + protected: private: string type_; Index: Makefile.am =================================================================== RCS file: /cvs/lyx/lyx-devel/src/insets/Makefile.am,v retrieving revision 1.46 diff -u -p -r1.46 Makefile.am --- Makefile.am 2002/03/25 11:15:27 1.46 +++ Makefile.am 2002/06/14 12:07:27 @@ -67,6 +67,10 @@ libinsets_la_SOURCES = \ insetquotes.h \ insetref.C \ insetref.h \ + insetsection.C \ + insetsection.h \ + insetshorttitle.C \ + insetshorttitle.h \ insetspecialchar.C \ insetspecialchar.h \ insettabular.C \
/* 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 "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(InsetText const & ins) : InsetText(ins) {} Paragraph * InsetShortTitle::getShortTitle(InsetText const & ins) const { /* Hand the contents to the parent paragraph */ return ins.firstParagraph(); } void InsetShortTitle::edit(BufferView * bv, int x, int y, mouse_button::state button) { edit(bv, x, y, button); } void InsetShortTitle::edit(BufferView * bv, bool) { edit(bv, 0, 0, mouse_button::none); } int InsetShortTitle::latex(Buffer const * buf, ostream & os) const { if (!buf) { os << "["; writeParagraphData(buf, os); os << ']'; } return 0; } /* Dunno what to do with these, if anything -- MV * int InsetShortTitle::ascii(Buffer const *, ostream & os, int) const { os << "<" << getContents() << ">"; return 0; } int InsetShortTitle::linuxdoc(Buffer const *, ostream & os) const { os << "<label id=\"" << getContents() << "\" >"; return 0; } int InsetShortTitle::docbook(Buffer const *, ostream & os) const { os << "<anchor id=\"" << getContents() << "\">"; return 0; } */
// -*- C++ -*- /* This file is part of* * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team * * ====================================================== */ #ifndef INSET_LABEL_H #define INSET_LABEL_H #ifdef __GNUG__ #pragma interface #endif #include "insettext.h" class InsetShortTitle : public InsetText { public: /// InsetShortTitle(InsetText const &); /// EDITABLE editable() const { return IS_EDITABLE; } /// Inset::Code lyxCode() const { return Inset::SHORTTITLE_CODE; } /// void edit(BufferView *, int, int, mouse_button::state); /// void edit(BufferView * bv, bool front = true); // Get the single title out? Paragraph * getShortTitle(InsetText const &) const; /// int latex(Buffer const *, std::ostream &) const; /// //int ascii(Buffer const *, std::ostream &, int linelen) const; /// //int linuxdoc(Buffer const *, std::ostream &) const; /// //int docbook(Buffer const *, std::ostream &) const; }; #endif
msg39530/pgp00000.pgp
Description: PGP signature