~ubuntu-branches/ubuntu/natty/plee-the-bear/natty

« back to all changes in this revision

Viewing changes to bear-factory/bear-editor/src/bf/image_pool.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Julien Jorge, Julien Jorge
  • Date: 2010-11-17 20:13:34 UTC
  • mfrom: (6.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20101117201334-o4dp7uq437to7oxb
Tags: 0.5.1-1
[ Julien Jorge ]
* New upstream release (Closes: #565062, #546514).
* Add armhf architecture (Closes: #604689).
* Remove patches integrated upstream: rpath-editors.diff, rpath-game.diff,
  editors-menu-section.diff.
* Bump the Standard-Version, no changes.
* Update my email address.
* Set build dependency of libclaw to 1.6.0.
* Add the missing ${misc:Depends} in debian/control.
* List gettext translations in bear-factory.install and plee-the-bear.install.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
    Bear Engine - Editor library
3
3
 
4
 
    Copyright (C) 2005-2009 Julien Jorge, Sebastien Angibaud
 
4
    Copyright (C) 2005-2010 Julien Jorge, Sebastien Angibaud
5
5
 
6
6
    This program is free software; you can redistribute it and/or modify it
7
7
    under the terms of the GNU General Public License as published by the
31
31
 
32
32
#include "bf/libeditor_export.hpp"
33
33
 
34
 
#include <boost/filesystem/convenience.hpp>
35
34
#include <claw/basic_singleton.hpp>
36
35
#include <claw/iterator.hpp>
37
36
#include <claw/functional.hpp>
38
37
#include <map>
39
38
 
40
39
#include <wx/bitmap.h>
41
 
#include <wx/image.h>
42
40
 
43
41
namespace bf
44
42
{
47
45
   * \author Julien Jorge
48
46
   */
49
47
  class BEAR_EDITOR_EXPORT image_pool
50
 
    : public claw::concept::basic_singleton<image_pool>
 
48
    : public claw::pattern::basic_singleton<image_pool>
51
49
  {
52
50
  private:
53
51
    typedef std::map<wxString, wxBitmap> image_map;
54
52
 
 
53
    /** \brief Function object passed to bf::scan_dir to load the thumbnails. */
 
54
    struct load_thumb_func
 
55
    {
 
56
    public:
 
57
      load_thumb_func( image_map& t, const std::string& r );
 
58
 
 
59
      void operator()( const std::string& path );
 
60
 
 
61
      static wxBitmap load( const std::string& path );
 
62
 
 
63
    public:
 
64
      /** \brief The thumbnails of the images. */
 
65
      image_map& thumb;
 
66
 
 
67
    private:
 
68
      /** \brief The directory from which the search started. */
 
69
      std::string m_root;
 
70
 
 
71
    }; // struct load_thumb_func
 
72
 
55
73
  public:
56
74
    typedef claw::wrapped_iterator
57
75
    < const wxString,
62
80
  public:
63
81
    image_pool();
64
82
 
 
83
    void clear();
65
84
    void scan_directory( const std::string& dir_path );
66
85
 
67
86
    wxBitmap get_image( const wxString& image_name ) const;
73
92
  private:
74
93
    void add_image( const std::string& root, const std::string& file_path );
75
94
 
76
 
    wxBitmap load_thumb( const std::string& path ) const;
77
95
    void load_image_data( const wxString& name ) const;
78
 
    wxImage load_image( const std::string& path ) const;
79
 
 
80
 
    void scan_sub_directory
81
 
    ( const std::string& root, const boost::filesystem::path& dir );
82
 
    bool supported_extension( const std::string& path ) const;
83
96
 
84
97
  public:
85
98
    /** \brief The maximum size of the thumbnails. */
86
99
    static const wxSize s_thumb_size;
87
100
 
88
101
  private:
89
 
    /** \brief The item classes. */
 
102
    /** \brief The images used in the application. */
90
103
    mutable image_map m_image;
91
104
 
92
105
    /** \brief The thumbnails of the images. */