On Monday 12 August 2002 3:34 pm, Martin Vermeer wrote:
> Here it is. Tested as well as I could, but give it hell.
> If still alive after that, commit it.
>
> ChangeLog:
>
> 2002-08-12  Martin Vermeer <[EMAIL PROTECTED]>
>
>       * buffer.C:
>       buffer.h:
>       lyxtext.h:
>       paragraph.C:
>       paragraph_pimpl.h:
>       text.C:
>       text2.C:
>       undo_funcs.C: replaced per-paragraph counter logic by per-buffer, as
>       suggested by Angus.
>       Made updateCounter always count from start of buffer, and removed
>       second argument (par).
>       Reverted floats number display to '#'. Perhaps I'll try again when the
>       code base is sanitized a bit.
>
> Martin

Ugggg. Would anyone mind terribly if I changed buffer.[Ch]:

buffer.h
======
-#include "counters.h"
+class Counters;

class Buffer {
public:
        /// Buffer-wide counter array
-       Counters & counters() const;
+       Counters & counters() const { return *ctrs.get(); }
+private:
-       ///
-       mutable Counters ctrs;
+       /// The pointer is const although its contents may not be
+       boost::scoped_ptr<Counters> const ctrs;
};

buffer.C
======
+#include "counters.h"

Buffer::Buffer(string const & file, bool ronly)
        : niceFile(true), lyx_clean(true), bak_clean(true),
          unnamed(false), dep_clean(0), read_only(ronly),
-         filename_(file), users(0)
+         filename_(file), users(0), ctrs(new Counters)
{

-Counters & Buffer::counters() const
-{
-                   return ctrs;
-}

Mindless #inclusion of header files is a PITA.

Angus

Reply via email to