]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetgraphics.h
Don't remove cell selections after fontchange.
[lyx.git] / src / insets / insetgraphics.h
index d0c9925b4703a7dcc866f8852444548efaab0c87..ac380bffc46564d9f8b3fb5dd26c4139161a7f67 100644 (file)
@@ -5,8 +5,10 @@
  *           LyX, The Document Processor
  *      
  *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2000 the LyX Team.
+ *           Copyright 1995-2001 the LyX Team.
  *
+ * \author Baruch Even
+ * \author Herbert Voss <voss@lyx.org>
  * ====================================================== */
 
 #ifndef INSET_GRAPHICS_H
 #pragma interface
 #endif 
 
-#include "insets/lyxinset.h"
+#include "insets/inset.h"
 #include "insets/insetgraphicsParams.h"
 #include "graphics/GraphicsCacheItem.h"
+#include <boost/smart_ptr.hpp>
 
 #include "LaTeXFeatures.h"
 
 // We need a signal here to hide an active dialog when we are deleted.
 #include "sigc++/signal_system.h"
-#ifdef SIGC_CXX_NAMESPACES
-using SigC::Signal0;
-using SigC::slot;
-using SigC::Object;
-#endif 
 
 class Dialogs;
 class LyXImage;
 
 ///
-#ifdef SIGC_CXX_NAMESPACES
-class InsetGraphics : public Inset, public SigC::Object
-#else
-class InsetGraphics : public Inset, public Object
-#endif
-{
+class InsetGraphics : public Inset, public SigC::Object {
 public:
        ///
        InsetGraphics();
        ///
+       InsetGraphics(InsetGraphics const &, bool same_id = false);
+       ///
        ~InsetGraphics();
        ///
        int ascent(BufferView *, LyXFont const &) const;
@@ -57,37 +52,39 @@ public:
        ///
        void draw(BufferView *, LyXFont const &, int, float &, bool) const;
        ///
-       void Edit(BufferView *, int, int, unsigned int);
+       void edit(BufferView *, int, int, unsigned int);
+       ///
+       void edit(BufferView * bv, bool front = true);
        ///
-       EDITABLE Editable() const;
+       EDITABLE editable() const;
        ///
-       void Write(Buffer const *, std::ostream &) const;
+       void write(Buffer const *, std::ostream &) const;
        ///
-       void Read(Buffer const *, LyXLex & lex);
+       void read(Buffer const *, LyXLex & lex);
 
        /** returns the number of rows (\n's) of generated tex code.
         #fragile == true# means, that the inset should take care about
         fragile commands by adding a #\protect# before.
         */
-       int Latex(Buffer const *, std::ostream &,
+       int latex(Buffer const *, std::ostream &,
                  bool fragile, bool free_spc) const;
        ///
-       int Ascii(Buffer const *, std::ostream &, int linelen) const;
+       int ascii(Buffer const *, std::ostream &, int linelen) const;
        ///
-       int Linuxdoc(Buffer const *, std::ostream &) const;
+       int linuxdoc(Buffer const *, std::ostream &) const;
        ///
-       int DocBook(Buffer const *, std::ostream &) const;
+       int docbook(Buffer const *, std::ostream &) const;
 
        /** Tell LyX what the latex features you need i.e. what latex packages
            you need to be included.
         */
-       void Validate(LaTeXFeatures & features) const;
+       void validate(LaTeXFeatures & features) const;
 
        /// returns LyX code associated with the inset. Used for TOC, ...)
-       Inset::Code LyxCode() const { return Inset::GRAPHICS_CODE; }
+       Inset::Code lyxCode() const { return Inset::GRAPHICS_CODE; }
 
        ///
-       Inset * Clone(Buffer const &) const;
+       virtual Inset * clone(Buffer const &, bool same_id = false) const;
 
        /** Set the inset parameters, used by the GUIndependent dialog.
            Return true of new params are different from what was so far.
@@ -100,27 +97,30 @@ public:
        /** This signal is connected by our dialog and called when the inset
            is deleted.
        */
-       Signal0 <void> hideDialog;
+       SigC::Signal0<void> hideDialog;
 
 private:
+       /// Read the inset native format
+       void readInsetGraphics(Buffer const * buf, LyXLex & lex);
+       /// Read the FigInset file format
+       void readFigInset(Buffer const * buf, LyXLex & lex);
+       
        /// Update the inset after parameter change.
        void updateInset() const;
        /// Get the status message, depends on the image loading status.
-       char const * statusMessage() const;
+       string const statusMessage() const;
        /// Create the options for the latex command.
        string const createLatexOptions() const;
        /// Convert the file if needed, and return the location of the file.
        string const prepareFile(Buffer const * buf) const;
-
        /// The graphics cache handle.
-       mutable GraphicsCacheItem * cacheHandle;
-
-       /// The pixmap
-       mutable LyXImage * pixmap;
+       mutable boost::shared_ptr<GraphicsCacheItem> cacheHandle;
        /// is the pixmap initialized?
-       mutable bool updateImage;
-
+       mutable bool imageLoaded;
+       /// the parameters
        InsetGraphicsParams params;
+       /// holds the entity name that defines the graphics location (SGML).
+       string const graphic_label;
 };
 
 #endif