diff options
| author | Alex Valavanis <valavanisalex@gmail.com> | 2012-05-31 22:12:43 +0000 |
|---|---|---|
| committer | Alex Valavanis <valavanisalex@gmail.com> | 2012-05-31 22:12:43 +0000 |
| commit | 9348dadeac26de57c9e7653ebb72a5ba6359b976 (patch) | |
| tree | 18cc5f68f8221b924e6c45d8b44e60c10d76cebd /src | |
| parent | Fix missing Glibmm headers needed for GTK+3 build (diff) | |
| download | inkscape-9348dadeac26de57c9e7653ebb72a5ba6359b976.tar.gz inkscape-9348dadeac26de57c9e7653ebb72a5ba6359b976.zip | |
Remove unused icon-widget code
(bzr r11446)
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/ui/widget/Makefile_insert | 2 | ||||
| -rw-r--r-- | src/ui/widget/icon-widget.cpp | 161 | ||||
| -rw-r--r-- | src/ui/widget/icon-widget.h | 64 |
4 files changed, 0 insertions, 229 deletions
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 2903a97fa..d46efc374 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -83,7 +83,6 @@ set(ui_SRC widget/frame.cpp widget/filter-effect-chooser.cpp widget/handlebox.cpp - widget/icon-widget.cpp widget/imageicon.cpp widget/imagetoggler.cpp widget/labelled.cpp @@ -215,7 +214,6 @@ set(ui_SRC widget/frame.h widget/filter-effect-chooser.h widget/handlebox.h - widget/icon-widget.h widget/imageicon.h widget/imagetoggler.h widget/labelled.h diff --git a/src/ui/widget/Makefile_insert b/src/ui/widget/Makefile_insert index cea869300..89a532ad1 100644 --- a/src/ui/widget/Makefile_insert +++ b/src/ui/widget/Makefile_insert @@ -23,8 +23,6 @@ ink_common_sources += \ ui/widget/frame.h \ ui/widget/handlebox.cpp \ ui/widget/handlebox.h \ - ui/widget/icon-widget.cpp \ - ui/widget/icon-widget.h \ ui/widget/imageicon.cpp \ ui/widget/imageicon.h \ ui/widget/imagetoggler.cpp \ diff --git a/src/ui/widget/icon-widget.cpp b/src/ui/widget/icon-widget.cpp deleted file mode 100644 index 0e0736371..000000000 --- a/src/ui/widget/icon-widget.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Author: - * Bryce Harrington <bryce@bryceharrington.org> - * - * Copyright (C) 2004 Bryce Harrington - * based on work by Lauris Kaplinski in 2002 released under GPL - * - * Released under GNU GPL. Read the file 'COPYING' for more information - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <glib.h> -#include "icon-widget.h" - -namespace Inkscape { -namespace UI { -namespace Widget { - -IconWidget::IconWidget() : - _size(0), - _pb(0), - _do_bitmap_icons(false) -{ -} - -IconWidget::IconWidget(int unsigned size, int unsigned scale, gchar const *name) : - _pb(0), - _do_bitmap_icons(false) -{ - _size = std::max((int unsigned)128, std::min(size, (int unsigned)1)); - - char c[256]; - g_snprintf (c, 256, "%d:%d:%s", _size, scale, name); - guchar *pixels = image_load_gtk(name, _size, scale); - - if (pixels == NULL) { - g_warning("Couldn't find matching icon for %s - has this application been installed?", name); - //_pb = NULL; - } else { - /* TODO - _pb = gdk_pixbuf_new_from_data(pixels, GDK_COLORSPACE_RGB, - TRUE, 8, _size, _size, _size * 4, - (GdkPixbufDestroyNotify)g_free, NULL); - */ - } -} - -IconWidget::IconWidget(int unsigned size, guchar const */*px*/) : - _pb(0), - _do_bitmap_icons(false) -{ - _size = std::max((int unsigned)128, std::min(size, (int unsigned)1)); - - /* - _pb = gdk_pixbuf_new_from_data((guchar *)px, GDK_COLORSPACE_RGB, - TRUE, 8, _size, _size, _size * 4, NULL, NULL); - */ -} - -IconWidget::~IconWidget() { -} - -void IconWidget::size_request(Gtk::Requisition &requisition) -{ - requisition.width = _size; - requisition.height = _size; -} - -void IconWidget::size_allocate(Gtk::Allocation const &allocation) -{ - Gtk::Widget::size_allocate(allocation); - - if (this->get_is_drawable()) { - this->queue_draw(); - } -} - -int IconWidget::expose(GdkEventExpose *event) -{ - if (this->get_is_drawable()) { - paint(&(event->area)); - } - return true; -} - -void IconWidget::paint(GdkRectangle const *area) -{ - Gtk::Allocation allocation = get_allocation(); - int const x_pad = std::max(0, (allocation.get_width() - _size)/2); - int const y_pad = std::max(0, (allocation.get_height() - _size)/2); - - int const x_max = std::max(area->x, allocation.get_x() + x_pad); - int const y_max = std::max(area->y, allocation.get_y() + y_pad); - int const x_min = std::min(area->x + area->width, - allocation.get_x() + x_pad + _size); - int const y_min = std::min(area->y + area->height, - allocation.get_y() + y_pad + _size); - - if (_pb) { - gdk_draw_pixbuf(this->get_window()->gobj(), NULL, _pb, - x_max - allocation.get_x() - x_pad, - y_max - allocation.get_y() - y_pad, - x_max, y_max, - x_min - x_max, y_min - y_max, - GDK_RGB_DITHER_NORMAL, x_max, y_max); - } -} - -guchar* IconWidget::image_load(gchar const *name, int unsigned size, int unsigned scale) -{ - guchar *px; - - if (_do_bitmap_icons) { - px = image_load_pixmap(name, size, scale); - if (!px) { - px = image_load_svg(name, size, scale); - } - } else { - px = image_load_svg(name, size, scale); - if (!px) { - px = image_load_pixmap(name, size, scale); - } - } - return px; -} - -guchar* IconWidget::image_load_pixmap(gchar const */*name*/, int unsigned /*size*/, int unsigned /*scale*/) -{ - // TODO - return NULL; -} - -guchar* IconWidget::image_load_svg(gchar const */*name*/, int unsigned /*size*/, int unsigned /*scale*/) -{ - // TODO - return NULL; -} - -guchar* IconWidget::image_load_gtk(gchar const */*name*/, int unsigned /*size*/, int unsigned /*scale*/) -{ - // TODO - return NULL; -} - -} // namespace Widget -} // namespace UI -} // namespace Inkscape - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : diff --git a/src/ui/widget/icon-widget.h b/src/ui/widget/icon-widget.h deleted file mode 100644 index 329702f2e..000000000 --- a/src/ui/widget/icon-widget.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Author: - * Bryce Harrington <bryce@bryceharrington.org> - * - * Copyright (C) 2004 Bryce Harrington - * - * Released under GNU GPL. Read the file 'COPYING' for more information - */ - -#ifndef INKSCAPE_UI_WIDGET_ICON_H -#define INKSCAPE_UI_WIDGET_ICON_H - -#include <gtkmm/image.h> -#include <gdkmm/rectangle.h> - -namespace Inkscape { -namespace UI { -namespace Widget { - -/** - * Icon Widget - General image widget (including SVG icons). - */ -class IconWidget : public Gtk::Widget -{ -public: - IconWidget(); - IconWidget(int unsigned size, int unsigned scale, gchar const *name); - IconWidget(int unsigned size, guchar const *px); - virtual ~IconWidget(); - - // Overrides of Gtk::Widget functions - void size_request(Gtk::Requisition &requisition); - void size_allocate(Gtk::Allocation const &allocation); - - int expose(GdkEventExpose *event); - void paint(GdkRectangle const *area); - guchar* image_load(gchar const *name, int unsigned size, int unsigned scale); - guchar* image_load_pixmap(gchar const *name, int unsigned size, int unsigned scale); - guchar* image_load_svg(gchar const *name, int unsigned size, int unsigned scale); - guchar* image_load_gtk(gchar const *name, int unsigned size, int unsigned scale); - -protected: - int _size; - GdkPixbuf *_pb; - bool _do_bitmap_icons; -}; - - -} // namespace Widget -} // namespace UI -} // namespace Inkscape - -#endif // INKSCAPE_UI_WIDGET_ICON_H - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=c++:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : |
