~ubuntu-branches/ubuntu/oneiric/inkscape/oneiric-updates

« back to all changes in this revision

Viewing changes to src/ui/dialog/color-item.h

  • Committer: Bazaar Package Importer
  • Author(s): Alex Valavanis
  • Date: 2010-09-12 19:44:58 UTC
  • mfrom: (1.1.12 upstream) (45.1.3 maverick)
  • Revision ID: james.westby@ubuntu.com-20100912194458-4sjwmbl7dlsrk5dc
Tags: 0.48.0-1ubuntu1
* Merge with Debian unstable (LP: #628048, LP: #401567, LP: #456248, 
  LP: #463602, LP: #591986)
* debian/control: 
  - Ubuntu maintainers
  - Promote python-lxml, python-numpy, python-uniconvertor to Recommends.
  - Demote pstoedit to Suggests (universe package).
  - Suggests ttf-dejavu instead of ttf-bitstream-vera (LP: #513319)
* debian/rules:
  - Run intltool-update on build (Ubuntu-specific).
  - Add translation domain to .desktop files (Ubuntu-specific).
* debian/dirs:
  - Add usr/share/pixmaps.  Allow inkscape.xpm installation
* drop 50-poppler-API.dpatch (now upstream)
* drop 51-paste-in-unwritable-directory.dpatch (now upstream) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** @file
 
2
 * @brief Inkscape color swatch UI item.
 
3
 */
 
4
/* Authors:
 
5
 *   Jon A. Cruz
 
6
 *
 
7
 * Copyright (C) 2010 Jon A. Cruz
 
8
 *
 
9
 * Released under GNU GPL, read the file 'COPYING' for more information
 
10
 */
 
11
 
 
12
#ifndef SEEN_DIALOGS_COLOR_ITEM_H
 
13
#define SEEN_DIALOGS_COLOR_ITEM_H
 
14
 
 
15
#include <gtkmm/tooltips.h>
 
16
 
 
17
#include "widgets/ege-paint-def.h"
 
18
#include "ui/previewable.h"
 
19
 
 
20
class SPGradient;
 
21
 
 
22
namespace Inkscape {
 
23
namespace UI {
 
24
namespace Dialogs {
 
25
 
 
26
class ColorItem;
 
27
 
 
28
class SwatchPage
 
29
{
 
30
public:
 
31
    SwatchPage();
 
32
    ~SwatchPage();
 
33
 
 
34
    Glib::ustring _name;
 
35
    int _prefWidth;
 
36
    std::vector<ColorItem*> _colors;
 
37
};
 
38
 
 
39
 
 
40
/**
 
41
 * The color swatch you see on screen as a clickable box.
 
42
 */
 
43
class ColorItem : public Inkscape::UI::Previewable
 
44
{
 
45
    friend void _loadPaletteFile( gchar const *filename );
 
46
public:
 
47
    ColorItem( ege::PaintDef::ColorType type );
 
48
    ColorItem( unsigned int r, unsigned int g, unsigned int b,
 
49
               Glib::ustring& name );
 
50
    virtual ~ColorItem();
 
51
    ColorItem(ColorItem const &other);
 
52
    virtual ColorItem &operator=(ColorItem const &other);
 
53
    virtual Gtk::Widget* getPreview(PreviewStyle style,
 
54
                                    ViewType view,
 
55
                                    ::PreviewSize size,
 
56
                                    guint ratio);
 
57
    void buttonClicked(bool secondary = false);
 
58
 
 
59
    void setGradient(SPGradient *grad);
 
60
    SPGradient * getGradient() const { return _grad; }
 
61
 
 
62
    void setPixData(guchar* px, int width, int height);
 
63
 
 
64
    void setState( bool fill, bool stroke );
 
65
    bool isFill() { return _isFill; }
 
66
    bool isStroke() { return _isStroke; }
 
67
 
 
68
    ege::PaintDef def;
 
69
 
 
70
private:
 
71
 
 
72
    static void _dropDataIn( GtkWidget *widget,
 
73
                             GdkDragContext *drag_context,
 
74
                             gint x, gint y,
 
75
                             GtkSelectionData *data,
 
76
                             guint info,
 
77
                             guint event_time,
 
78
                             gpointer user_data);
 
79
 
 
80
    static void _dragGetColorData( GtkWidget *widget,
 
81
                                   GdkDragContext *drag_context,
 
82
                                   GtkSelectionData *data,
 
83
                                   guint info,
 
84
                                   guint time,
 
85
                                   gpointer user_data);
 
86
 
 
87
    static void _wireMagicColors( SwatchPage *colorSet );
 
88
    static void _colorDefChanged(void* data);
 
89
 
 
90
    void _updatePreviews();
 
91
    void _regenPreview(EekPreview * preview);
 
92
 
 
93
    void _linkTint( ColorItem& other, int percent );
 
94
    void _linkTone( ColorItem& other, int percent, int grayLevel );
 
95
 
 
96
    Gtk::Tooltips tips;
 
97
    std::vector<Gtk::Widget*> _previews;
 
98
 
 
99
    bool _isFill;
 
100
    bool _isStroke;
 
101
    bool _isLive;
 
102
    bool _linkIsTone;
 
103
    int _linkPercent;
 
104
    int _linkGray;
 
105
    ColorItem* _linkSrc;
 
106
    SPGradient* _grad;
 
107
    guchar *_pixData;
 
108
    int _pixWidth;
 
109
    int _pixHeight;
 
110
    std::vector<ColorItem*> _listeners;
 
111
};
 
112
 
 
113
} // namespace Dialogs
 
114
} // namespace UI
 
115
} // namespace Inkscape
 
116
 
 
117
#endif // SEEN_DIALOGS_COLOR_ITEM_H
 
118
 
 
119
/*
 
120
  Local Variables:
 
121
  mode:c++
 
122
  c-file-style:"stroustrup"
 
123
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
124
  indent-tabs-mode:nil
 
125
  fill-column:99
 
126
  End:
 
127
*/
 
128
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :