X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsettheorem.C;h=4273ffecf65e073fa74eccfabdf872efcd66b21f;hb=e28331ed63062dea10d0a21b9ec12034b4b17b9a;hp=e6cf3016aa86fd1e7cc87de7dfdf5263d866ba54;hpb=a654de29ea80901be5321f603008f0e6a82a0ec9;p=lyx.git diff --git a/src/insets/insettheorem.C b/src/insets/insettheorem.C index e6cf3016aa..4273ffecf6 100644 --- a/src/insets/insettheorem.C +++ b/src/insets/insettheorem.C @@ -1,30 +1,32 @@ -/* This file is part of - * ====================================================== +/** + * \file insettheorem.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * LyX, The Document Processor + * \author Lars Gullik Bjønnes * - * Copyright 1998 The LyX Team. - * - * ====================================================== + * Full author contact details are available in file CREDITS. */ #include -#ifdef __GNUG__ -#pragma implementation -#endif - #include "insettheorem.h" +#include "insets/insettext.h" + +#include "debug.h" #include "gettext.h" #include "lyxfont.h" -#include "BufferView.h" #include "lyxtext.h" -#include "support/LOstream.h" -#include "debug.h" -#include "insets/insettext.h" +#include "metricsinfo.h" + +#include "support/std_ostream.h" + + +namespace lyx { -using std::ostream; using std::endl; +using std::ostream; + /* The intention is to be able to create arbitrary theorem like environments @@ -56,17 +58,33 @@ void InsetTheorem::write(Buffer const * buf, ostream & os) const } -Inset * InsetTheorem::clone(Buffer const &, bool) const +auto_ptr InsetTheorem::doClone() const { #ifdef WITH_WARNINGS #warning Is this inset used? If YES this is WRONG!!! (Jug) #endif - InsetTheorem * result = new InsetTheorem; + auto_ptr result(new InsetTheorem); + result->setCollapsed(!isOpen()); - result->collapsed_ = collapsed_; return result; } +bool InsetTheorem::metrics(MetricsInfo & mi, Dimension & dim) const +{ + InsetCollapsable::metrics(mi, dim); + center_indent_ = (mi.base.textwidth - dim.wid) / 2; + dim.wid = mi.base.textwidth; + bool const changed = dim_ != dim; + dim_ = dim; + return changed; +} + + +void InsetTOC::draw(PainterInfo & pi, int x, int y) const +{ + InsetCollapsable::draw(pi, x + center_indent_, y); +} + string const InsetTheorem::editMessage() const { @@ -74,13 +92,16 @@ string const InsetTheorem::editMessage() const } -int InsetTheorem::latex(Buffer const * buf, - ostream & os, bool fragile, bool fp) const +int InsetTheorem::latex(Buffer const * buf, odocstream & os, + OutputParams const & runparams) const { os << "\\begin{theorem}%\n"; - int i = inset.latex(buf, os, fragile, fp); + int i = inset.latex(buf, os, runparams); os << "\\end{theorem}%\n"; return i + 2; } + + +} // namespace lyx