remove the pitiful Pix class
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 15 Mar 2006 02:16:22 +0000 (02:16 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 15 Mar 2006 02:16:22 +0000 (02:16 +0000)
git-svn-id: svn://localhost/trunk/ardour2@396 d708f5d6-7413-0410-9779-e7cbd77b26cf

SConstruct
libs/gtkmm2ext/gtkmm2ext/pix.h [deleted file]
libs/gtkmm2ext/pix.cc [deleted file]

index e0e4042d22ab31cd23724e55d7b3c2f5fc8f9c8d..cf585f5973983aff79ed4cf90d4e4cfeb1c9473f 100644 (file)
@@ -14,7 +14,7 @@ import SCons.Node.FS
 SConsignFile()
 EnsureSConsVersion(0, 96)
 
-version = '2.0alpha1'
+version = '2.0alpha2'
 
 subst_dict = { }
 
diff --git a/libs/gtkmm2ext/gtkmm2ext/pix.h b/libs/gtkmm2ext/gtkmm2ext/pix.h
deleted file mode 100644 (file)
index 6552615..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifndef __pbd_gtkmm_pix_h__
-#define __pbd_gtkmm_pix_h__
-
-#include <string>
-#include <map>
-#include <vector>
-#include <gtkmm.h>
-
-namespace Gtkmm2ext {
-
-class Pix
-{
-       typedef std::map<std::string, Pix *> PixCache;
-       static PixCache *cache;
-
-       PixCache::iterator cache_position;
-       int refcnt;
-        bool generated;
-       std::vector<std::string *> *files;
-       std::vector<const char* const*>   data;
-       bool from_files;
-       int pixmap_count;
-       int last_pixmap;
-       Glib::RefPtr<Gdk::Pixmap> *pixmaps;
-       Glib::RefPtr<Gdk::Bitmap> *bitmaps;
-       int max_pixwidth;
-       int max_pixheight;
-       bool _homegenous;
-
-        Pix (const std::string &dirpath, const std::string &regexp, 
-            bool homogenous = true);
-       Pix (std::vector<const char* const*> xpm_data, bool homogenous = true);
-        virtual ~Pix();
-
-       friend  Pix *get_pix (const std::string &dirpath, 
-                             const std::string &regexp,
-                             bool homogenous);
-       friend  Pix *get_pix (std::string name, 
-                             std::vector<const char* const*> xpm_data,
-                             bool homogenous);
-       friend  void finish_pix (Pix *);
-
-  public:      
-       Pix (bool homogenous = true);
-
-        void generate (Glib::RefPtr<Gdk::Drawable>&);
-       int n_pixmaps() { return pixmap_count; }
-       int max_pixmap() { return last_pixmap; }
-       bool homogenous () { return _homegenous; }
-
-       /* ref/unref should really be protected, but we don't know the
-          name of the class that should have access to them.  
-       */
-
-       void ref () { refcnt++; }
-       void unref () { if (refcnt) refcnt--; }
-
-        Glib::RefPtr<Gdk::Bitmap>* shape_mask (int n) {
-               if (n < pixmap_count) {
-                       return &bitmaps[n];
-               } 
-               return 0;
-       }
-
-       Glib::RefPtr<Gdk::Pixmap>* pixmap(int n) {
-               if (n < pixmap_count) {
-                       return &pixmaps[n];
-               } 
-               return 0;
-       }
-
-       int max_width() { return max_pixwidth; }
-       int max_height() { return max_pixheight; }
-};
-
-extern Pix *get_pix (const std::string &dirpath, 
-                    const std::string &regexp, 
-                    bool homog = false);
-
-extern Pix *get_pix (std::string, 
-                    std::vector<const char **>,
-                    bool homog = false);
-extern void finish_pix (Pix *);
-
-} /* namespace */
-
-#endif  // __pbd_gtkmm_pix_h__
diff --git a/libs/gtkmm2ext/pix.cc b/libs/gtkmm2ext/pix.cc
deleted file mode 100644 (file)
index 1d3696f..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
-    Copyright (C) 1998-99 Paul Barton-Davis
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-    $Id$
-*/
-
-#include <algorithm>
-
-#include <gdkmm.h>
-#include <gdkmm/pixmap.h>
-
-#include <pbd/pathscanner.h>
-#include <pbd/stl_delete.h>
-#include <pbd/failed_constructor.h>
-
-/* as of gcc 2.95.2, some of the stl_functors in this header are not
-   handled correctly. it sucks, but we put them inline here instead.
-
-   #include <pbd/stl_functors.h>
-*/
-
-#include <gtkmm2ext/pix.h>
-#include <gtkmm2ext/utils.h>
-
-namespace std
-{
-       template<> struct less<string *> {
-           bool operator()(string *s1, string *s2) const {
-                   return *s1 < *s2;
-           }
-       };
-}
-
-using namespace std;
-using namespace Gtkmm2ext;
-
-Pix::PixCache *Pix::cache;
-
-Pix::Pix (bool homog)
-
-{
-       pixmap_count = 0;
-       _homegenous = homog;
-}
-
-Pix::Pix (vector<const char* const*> xpm_data, bool homog)
-{
-       if (xpm_data.size() == 0) {
-               throw failed_constructor();
-       }
-
-       pixmap_count = xpm_data.size();
-       last_pixmap = pixmap_count - 1;
-       refcnt = 0;
-       generated = false;
-       max_pixwidth = 0;
-       max_pixheight = 0;
-       _homegenous = homog;
-
-       data = xpm_data;
-       from_files = false;
-
-       pixmaps = new Glib::RefPtr<Gdk::Pixmap> [pixmap_count];
-       bitmaps = new Glib::RefPtr<Gdk::Bitmap> [pixmap_count];
-       memset (pixmaps, 0, sizeof (Glib::RefPtr<Gdk::Pixmap>) * pixmap_count);
-       memset (bitmaps, 0, sizeof (Glib::RefPtr<Gdk::Bitmap>) * pixmap_count);
-}
-
-Pix::Pix (const string &dirpath, const string &regexp, bool homog)
-
-{
-       PathScanner scanner;
-       less<string *> cmp;
-
-       pixmap_count = 0;
-       last_pixmap = 0;
-       refcnt = 0;
-       generated = false;
-       max_pixwidth = 0;
-       max_pixheight = 0;
-       _homegenous = homog;
-
-       pixmaps = 0;
-       bitmaps = 0;
-       
-       files = scanner (dirpath, regexp, false, true);
-
-       sort (files->begin(), files->end(), cmp);
-
-       if (files == 0) {
-               return;
-       }
-       
-       /* create handy reference */
-
-       if ((pixmap_count = files->size()) == 0) {
-               return;
-       }
-
-       from_files = true;
-       pixmaps = new Glib::RefPtr<Gdk::Pixmap> [pixmap_count];
-       bitmaps = new Glib::RefPtr<Gdk::Bitmap> [pixmap_count];
-       memset (pixmaps, 0, sizeof (Glib::RefPtr<Gdk::Pixmap>) * pixmap_count);
-       memset (bitmaps, 0, sizeof (Glib::RefPtr<Gdk::Bitmap>) * pixmap_count);
-
-       last_pixmap = pixmap_count - 1;
-}
-
-Pix::~Pix ()
-
-{
-       if (from_files) {
-               vector_delete (files);
-       }
-
-       if (pixmap_count) delete [] pixmaps;
-       if (pixmap_count) delete [] bitmaps;
-}
-
-void
-Pix::generate (Glib::RefPtr<Gdk::Drawable>& drawable)
-{
-       if (generated) {
-               return;
-       }
-
-       for (int i = 0; i < pixmap_count; i++) {
-
-               Gdk::Color transparent;
-
-               if (from_files) {
-                       pixmaps[i] = Gdk::Pixmap::create_from_xpm(drawable, bitmaps[i], transparent, *(*files)[i]);
-               } else {
-                       pixmaps[i] = Gdk::Pixmap::create_from_xpm(drawable, Gdk::Colormap::get_system(), bitmaps[i], Gdk::Color(), data[i]);
-               }
-
-                       
-               int w, h;
-               pixmaps[i]->get_size(w, h);
-               if (w > max_pixwidth) max_pixwidth = w;
-               if (h > max_pixheight) max_pixheight = h;
-       }
-
-       generated = true;
-}
-
-Pix *
-Gtkmm2ext::get_pix (string name, vector<const char* const*> xpm_data, bool homog)
-{
-       Pix *ret = 0;
-       Pix::PixCache::iterator iter;
-       pair<string, Pix *> newpair;
-
-       if (Pix::cache == 0) {
-               Pix::cache = new Pix::PixCache;
-       }
-
-       if ((iter = Pix::cache->find (name)) == Pix::cache->end()) {
-               ret = new Pix (xpm_data, homog);
-               if (ret->pixmap_count == 0) {
-                       delete ret;
-                       return 0;
-               }
-               newpair.first = name;
-               newpair.second = ret;
-               ret->cache_position = (Pix::cache->insert (newpair)).first;
-               ret->refcnt++;
-               return ret;
-       } else {
-               (*iter).second->refcnt++;
-               return (*iter).second;
-       }
-}
-
-Pix *
-Gtkmm2ext::get_pix (const string &dirpath, const string &regexp, bool homog)
-{
-       Pix *ret = 0;
-       Pix::PixCache::iterator iter;
-       pair<string, Pix *> newpair;
-
-       if (Pix::cache == 0) {
-               Pix::cache = new Pix::PixCache;
-       }
-
-       if ((iter = Pix::cache->find (regexp)) == Pix::cache->end()) {
-               ret = new Pix (dirpath, regexp, homog);
-               if (ret->pixmap_count == 0) {
-                       delete ret;
-                       return 0;
-               }
-               newpair.first = regexp;
-               newpair.second = ret;
-               ret->cache_position = (Pix::cache->insert (newpair)).first;
-               ret->refcnt++;
-               return ret;
-       } else {
-               (*iter).second->refcnt++;
-               return (*iter).second;
-       }
-}
-
-void 
-Gtkmm2ext::finish_pix (Pix *pix)
-
-{
-       pix->refcnt--;
-       if (pix->refcnt == 0) {
-               Pix::cache->erase (pix->cache_position);
-               delete pix;
-       }
-}