]> git.lyx.org Git - lyx.git/commitdiff
Added a copy c-tor by request from Lars and handled the same_id case.
authorBaruch Even <baruch@lyx.org>
Sat, 14 Jul 2001 20:11:35 +0000 (20:11 +0000)
committerBaruch Even <baruch@lyx.org>
Sat, 14 Jul 2001 20:11:35 +0000 (20:11 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2243 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insetgraphics.C
src/insets/insetgraphics.h

index 6182cce4e3e5365acdc10aa20f12b0e7879063c1..81d7b0e33af1e74368f3423adad51f31074c9f45 100644 (file)
@@ -1,3 +1,8 @@
+2001-07-14  Baruch Even  <baruch@lyx.org>
+
+       * insetgraphics.h:
+       * insetgraphics.C: Added a copy c-tor and handled the same_id case. 
+
 2001-07-13  Angus Leeming  <a.leeming@ic.ac.uk>
 
        Consistent use of Lsstream.h:
index 6b66c8a0363f9ef9b79b6b1b509680008cbec4bc..26a03fde9f82fe78b11447a3559746ca7592c979 100644 (file)
@@ -165,6 +165,17 @@ InsetGraphics::InsetGraphics()
 {}
 
 
+InsetGraphics::InsetGraphics(InsetGraphics const & ig, bool same_id)
+       : Inset(), SigC::Object()
+       , cacheHandle(ig.cacheHandle)
+       , imageLoaded(ig.imageLoaded)
+{
+       setParams(ig.getParams());
+       if (same_id)
+               id_ = ig.id_;
+}
+
+
 InsetGraphics::~InsetGraphics()
 {
        // Emits the hide signal to the dialog connected (if any)
@@ -555,7 +566,8 @@ int InsetGraphics::docBook(Buffer const * buf, ostream & os) const
 {
        // Change the path to be relative to the main file.
        string const buffer_dir = OnlyPath(buf->fileName());
-       string const filename = RemoveExtension(MakeRelPath(params.filename, buffer_dir));
+       string const filename = RemoveExtension(
+                                  MakeRelPath(params.filename, buffer_dir));
 
        // In DocBook v5.0, the graphic tag will be eliminated from DocBook, will 
        // need to switch to MediaObject. However, for now this is sufficient and 
@@ -621,18 +633,7 @@ InsetGraphicsParams InsetGraphics::getParams() const
 }
 
 
-Inset * InsetGraphics::clone(Buffer const &, bool) const
+Inset * InsetGraphics::clone(Buffer const &, bool same_id) const
 {
-#ifdef WITH_WARNINGS
-#warning use the copy constructor instead. (Lgb)
-#warning and then please honor the same_id flag (Jug)
-#endif
-       InsetGraphics * newInset = new InsetGraphics;
-
-       newInset->cacheHandle = cacheHandle;
-       newInset->imageLoaded = imageLoaded;
-
-       newInset->setParams(getParams());
-
-       return newInset;
+       return new InsetGraphics(*this, same_id);
 }
index aa9dc9d6cf19fd46101fbe3ea3a0f11e6e8b765a..9db4f94b78041952e6fe4d6791fff4023cc2548b 100644 (file)
@@ -36,6 +36,8 @@ public:
        ///
        InsetGraphics();
        ///
+       InsetGraphics(InsetGraphics const &, bool same_id = false);
+       ///
        ~InsetGraphics();
        ///
        int ascent(BufferView *, LyXFont const &) const;