Make the new grfx::Loader copy c-tor work "in expected fashion". Sheesh that took some tracking down.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7106 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-06-04 15:14:42 +00:00
parent a89f41c028
commit c2933d528f
4 changed files with 21 additions and 8 deletions

View File

@ -1,3 +1,7 @@
2003-06-04 Angus Leeming <leeming@lyx.org>
* GraphicsLoader.C (Loader copy c-tor): make it work as expected. ;-)
2003-06-03 Angus Leeming <leeming@lyx.org> 2003-06-03 Angus Leeming <leeming@lyx.org>
* GraphicsLoader.[Ch] (Loader): add copy constructor. * GraphicsLoader.[Ch] (Loader): add copy constructor.

View File

@ -79,15 +79,18 @@ Loader::Loader(string const & file, DisplayType type)
Loader::Loader(string const & file, Params const & params) Loader::Loader(string const & file, Params const & params)
: pimpl_(new Impl(params)) : pimpl_(new Impl(Params()))
{ {
reset(file, params); reset(file, params);
} }
Loader::Loader(Loader const & other) Loader::Loader(Loader const & other)
: pimpl_(new Impl(other.pimpl_->params())) : pimpl_(new Impl(Params()))
{} {
Params const & params = other.pimpl_->params();
reset(params.filename, params);
}
Loader::~Loader() Loader::~Loader()
@ -274,7 +277,6 @@ void Loader::Impl::createPixmap()
} }
} }
void Loader::Impl::startLoading() void Loader::Impl::startLoading()
{ {
if (status_ != WaitingToLoad) if (status_ != WaitingToLoad)

View File

@ -1,3 +1,7 @@
2003-06-04 Angus Leeming <leeming@lyx.org>
* graphicinset.C (draw): add a comment for the #if 0 block.
2003-06-04 André Pönitz <poenitz@gmx.net> 2003-06-04 André Pönitz <poenitz@gmx.net>
* inset.[Ch]: change owner_ from Inset * to UpdatableInset * * inset.[Ch]: change owner_ from Inset * to UpdatableInset *

View File

@ -43,9 +43,9 @@ void GraphicInset::update(grfx::Params const & params)
{ {
params_ = params; params_ = params;
if (!params.filename.empty()) { if (!params_.filename.empty()) {
lyx::Assert(AbsolutePath(params.filename)); lyx::Assert(AbsolutePath(params_.filename));
loader_.reset(params.filename, params); loader_.reset(params_.filename, params_);
} }
} }
@ -194,6 +194,9 @@ void GraphicInset::draw(PainterInfo & pi, int x, int y) const
view(pi.base.bv); view(pi.base.bv);
#if 0 #if 0
// Comment this out and see if anything goes wrong.
// The explanation for why it _was_ needed once upon a time is below.
// MakeAbsPath returns filename_ unchanged if it is absolute // MakeAbsPath returns filename_ unchanged if it is absolute
// already. // already.
string const file_with_path = string const file_with_path =
@ -219,7 +222,7 @@ void GraphicInset::draw(PainterInfo & pi, int x, int y) const
loader_.status() == grfx::WaitingToLoad) loader_.status() == grfx::WaitingToLoad)
loader_.startLoading(); loader_.startLoading();
if (!loader_.monitoring()) if (params_.display != grfx::NoDisplay && !loader_.monitoring())
loader_.startMonitoring(); loader_.startMonitoring();
// This will draw the graphics. If the graphics has not been loaded yet, // This will draw the graphics. If the graphics has not been loaded yet,