Scroom 0.14-48-ga0fee447
Loading...
Searching...
No Matches
loader.hh File Reference
#include <gtk/gtk.h>
#include <scroom/scroominterface.hh>
Include dependency graph for loader.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void create (NewPresentationInterface *interface)
 
void load (const GtkFileFilterInfo &info)
 
void load (const std::string &filename)
 
PresentationInterface::Ptr loadPresentation (const GtkFileFilterInfo &info)
 
PresentationInterface::Ptr loadPresentation (const std::string &filename)
 
void destroyGtkFileFilterList (std::list< GtkFileFilter * > &l)
 

Function Documentation

◆ create()

void create ( NewPresentationInterface interface)
173{
174 PresentationInterface::Ptr const presentation = interface->createNew();
175 if(presentation)
176 {
177 on_presentation_created(presentation);
178 find_or_create_scroom(presentation);
179 }
180 else
181 {
182 throw std::invalid_argument("Unable to create requested presentation");
183 }
184}
void on_presentation_created(const PresentationInterface::Ptr &presentation)
Definition callbacks.cc:634
void find_or_create_scroom(const PresentationInterface::Ptr &presentation)
Definition callbacks.cc:487
virtual PresentationInterface::Ptr createNew()=0
std::shared_ptr< PresentationInterface > Ptr
Definition presentationinterface.hh:73

Referenced by on_new_activate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ destroyGtkFileFilterList()

void destroyGtkFileFilterList ( std::list< GtkFileFilter * > &  l)
43{
44 while(!l.empty())
45 {
46 GtkFileFilter* f = l.front();
47 g_object_ref_sink(f);
48 g_object_unref(f);
49 l.pop_front();
50 }
51}
PageList const l
Definition compression-tests.cc:33
f
Definition gtkhelper-tests.cc:43

◆ load() [1/2]

void load ( const GtkFileFilterInfo &  info)
236{
237 const auto pm = PluginManager::getInstance();
238 const auto& openPresentationInterfaces = pm->getOpenPresentationInterfaces();
239 const auto& openInterfaces = pm->getOpenInterfaces();
240
241 for(auto const& cur: openPresentationInterfaces)
242 {
243 std::list<GtkFileFilter*> filters = cur.first->getFilters();
244 GtkFileFilterListDestroyer const destroyer(filters);
245 if(filterMatchesInfo(info, filters))
246 {
247 PresentationInterface::Ptr const presentation = cur.first->open(info.filename);
248 if(presentation)
249 {
250 on_presentation_created(presentation);
251 find_or_create_scroom(presentation);
252 return;
253 }
254 }
255 }
256 for(auto const& cur: openInterfaces)
257 {
258 std::list<GtkFileFilter*> filters = cur.first->getFilters();
259 GtkFileFilterListDestroyer const destroyer(filters);
260 if(filterMatchesInfo(info, filters))
261 {
262 cur.first->open(info.filename, ScroomInterfaceImpl::instance());
263 return;
264 }
265 }
266
267 throw std::invalid_argument("Don't know how to open file " + std::string(info.filename));
268}
Definition loader.cc:54
static PluginManager::Ptr getInstance()
Definition pluginmanager.cc:334
static Ptr instance()
Definition loader.cc:276
bool filterMatchesInfo(GtkFileFilterInfo const &info, std::list< GtkFileFilter * > const &filters)
Definition loader.cc:137

Referenced by load(), load(), on_done_loading_plugins(), on_open_activate(), onDragDataReceived(), anonymous_namespace{tiledbitmappresentation.cc}::OpenTiledBitmapAsPresentation::open(), Pnm::open(), and Tiff::open().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load() [2/2]

void load ( const std::string &  filename)
272{ load(filterInfoFromPath(filename)); }
GtkFileFilterInfoPtr filterInfoFromPath(const std::string &filename)
Definition loader.cc:105
void load(GtkFileFilterInfo const &info)
Definition loader.cc:235
Here is the call graph for this function:

◆ loadPresentation() [1/2]

PresentationInterface::Ptr loadPresentation ( const GtkFileFilterInfo &  info)
192{
193 static std::map<boost::filesystem::path, PresentationInterface::WeakPtr> loadedPresentations;
194 // Create canonical path from filename
195 const std::map<OpenPresentationInterface::Ptr, std::string>& openPresentationInterfaces =
196 PluginManager::getInstance()->getOpenPresentationInterfaces();
197
198#ifdef HAVE_BOOST_FILESYSTEM_CANONICAL
199 boost::filesystem::path key(canonical(boost::filesystem::path(info.filename)));
200#else
201 boost::filesystem::path const key(absolute(boost::filesystem::path(info.filename)));
202#endif
203
204 PresentationInterface::Ptr presentation = loadedPresentations[key].lock();
205
206 if(!presentation)
207 {
208 for(auto const& cur: openPresentationInterfaces)
209 {
210 std::list<GtkFileFilter*> const filters = cur.first->getFilters();
211 if(filterMatchesInfo(info, filters))
212 {
213 presentation = cur.first->open(info.filename);
214
215 if(presentation)
216 {
217 loadedPresentations[key] = presentation;
218 on_presentation_created(presentation);
219 break;
220 }
221 }
222 }
223 }
224
225 if(presentation)
226 {
227 return presentation;
228 }
229
230 throw std::invalid_argument("Don't know how to load presentation " + std::string(info.filename));
231}
Here is the call graph for this function:

◆ loadPresentation() [2/2]

PresentationInterface::Ptr loadPresentation ( const std::string &  filename)
187{
188 return loadPresentation(*filterInfoFromPath(filename));
189}
PresentationInterface::Ptr loadPresentation(const std::string &filename)
Definition loader.cc:186

Referenced by loadPresentation(), loadPresentation(), and on_done_loading_plugins().

Here is the call graph for this function:
Here is the caller graph for this function: