Added a copy c-tor by request from Lars and handled the same_id case.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2243 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Baruch Even 2001-07-14 20:11:35 +00:00
parent 87f0ddf453
commit 85570cb7d6
3 changed files with 22 additions and 14 deletions

View 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> 2001-07-13 Angus Leeming <a.leeming@ic.ac.uk>
Consistent use of Lsstream.h: Consistent use of Lsstream.h:

View 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() InsetGraphics::~InsetGraphics()
{ {
// Emits the hide signal to the dialog connected (if any) // 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. // Change the path to be relative to the main file.
string const buffer_dir = OnlyPath(buf->fileName()); 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 // 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 // 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 return new InsetGraphics(*this, same_id);
#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;
} }

View File

@ -36,6 +36,8 @@ public:
/// ///
InsetGraphics(); InsetGraphics();
/// ///
InsetGraphics(InsetGraphics const &, bool same_id = false);
///
~InsetGraphics(); ~InsetGraphics();
/// ///
int ascent(BufferView *, LyXFont const &) const; int ascent(BufferView *, LyXFont const &) const;