Proper check for rawzor libraries.
[rawtherapee-fixes.git] / rtgui / histogrampanel.h
blob04296ebf1f6505d962a9891bd58f3bb9750e3d4a
1 /*
2 * This file is part of RawTherapee.
4 * Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
6 * RawTherapee is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * RawTherapee is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef _HISTOGRAMPANEL_
20 #define _HISTOGRAMPANEL_
22 #include <gtkmm.h>
23 #include <glibmm.h>
24 #include <rtengine.h>
26 class HistogramArea;
27 struct HistogramAreaIdleHelper {
28 HistogramArea* harea;
29 bool destroyed;
30 int pending;
33 class HistogramArea : public Gtk::DrawingArea {
35 protected:
37 Glib::RefPtr<Gdk::GC> gc_;
38 Glib::RefPtr<Gdk::Pixmap> backBuffer;
40 Gdk::Color black;
41 Gdk::Color white;
42 Gdk::Color red;
43 Gdk::Color green;
44 Gdk::Color blue;
45 Gdk::Color lgray;
46 Gdk::Color mgray;
47 Gdk::Color dgray;
48 unsigned int lhist[256];
49 unsigned int rhist[256];
50 unsigned int ghist[256];
51 unsigned int bhist[256];
52 bool valid;
53 bool showFull;
54 int oldwidth, oldheight;
56 bool needVal;
57 bool needRed;
58 bool needGreen;
59 bool needBlue;
61 HistogramAreaIdleHelper* haih;
63 public:
65 HistogramArea();
66 ~HistogramArea();
68 void renderHistogram ();
69 void update (unsigned int* rh, unsigned int* gh, unsigned int* bh, unsigned int* lh);
70 void updateOptions (bool r, bool g, bool b, bool v);
71 void on_realize();
72 bool on_expose_event(GdkEventExpose* event);
73 bool on_button_press_event (GdkEventButton* event);
74 void styleChanged (const Glib::RefPtr<Gtk::Style>& style);
77 class HistogramPanel : public Gtk::HBox, public rtengine::HistogramListener {
79 protected:
81 HistogramArea* histogramArea;
82 Gtk::ToggleButton* showRed;
83 Gtk::ToggleButton* showGreen;
84 Gtk::ToggleButton* showBlue;
85 Gtk::ToggleButton* showValue;
87 sigc::connection rconn;
89 public:
91 HistogramPanel ();
93 void histogramChanged (unsigned int* rh, unsigned int* gh, unsigned int* bh, unsigned int* lh) { histogramArea->update (rh, gh, bh, lh); }
94 void rgbv_toggled ();
95 void resized (Gtk::Allocation& req);
98 #endif