// -*- C++ -*- /* This file is part of * ================================================= * * LyX, The Document Processor * Copyright 1995 Matthias Ettrich. * Copyright 1995-2000 The LyX Team. * * This file Copyright 2000 Baruch Even * ================================================= */ #include #ifdef __GNUG__ #pragma implementation #endif #include "GraphicsCacheItem.h" #include "GraphicsCacheItem_pimpl.h" #include "graphics/XPM_Renderer.h" #include "graphics/EPS_Renderer.h" #include "support/filetools.h" #include "debug.h" #include "support/LAssert.h" #include // unlink #include #include FORMS_H_LOCATION using std::endl; using std::map; GraphicsCacheItem_pimpl::GraphicsCacheItem_pimpl() : height_(-1), width_(-1), imageStatus_(GraphicsCacheItem::Loading), pixmap_(0), renderer(0), refCount(0) {} GraphicsCacheItem_pimpl::~GraphicsCacheItem_pimpl() { if (imageStatus_ == GraphicsCacheItem::Loaded) { XFreePixmap(fl_display, pixmap_); } delete renderer; } bool GraphicsCacheItem_pimpl::setFilename(string const & filename) { imageStatus_ = GraphicsCacheItem::Loading; renderer = new XPM_Renderer(); if (renderXPM(filename)) return true; return false; } /*** Callback method ***/ typedef map CallbackMap; static CallbackMap callbackMap; void callback(string cmd, int retval) { lyxerr << "callback, cmd="<