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 __IMAGEAREA_H__
20 #define __IMAGEAREA_H__
23 #include <cropguilistener.h>
24 #include <imageareapanel.h>
25 #include <editenums.h>
27 #include <previewhandler.h>
28 #include <imageareatoollistener.h>
29 #include <cropwindow.h>
30 #include <zoompanel.h>
31 #include <indclippedpanel.h>
34 class ImageArea
: public Gtk::DrawingArea
, public CropWindowListener
{
36 friend class ZoomPanel
;
41 Glib::ustring infotext
;
42 Glib::RefPtr
<Pango::Layout
> ilayout
;
43 Glib::RefPtr
<Pango::Layout
> deglayout
;
44 Glib::RefPtr
<Gdk::Pixbuf
> ipixbuf
;
45 bool showClippedH
, showClippedS
;
47 ImageAreaPanel
* parent
;
48 CropWindow
* mainCropWindow
;
49 std::list
<CropWindow
*> cropWins
;
50 PreviewHandler
* previewHandler
;
51 rtengine::StagedImageProcessor
* ipc
;
53 int lastClosedX
, lastClosedY
, lastClosedW
, lastClosedH
;
56 CropWindow
* focusGrabber
;
57 CropGUIListener
* cropgl
;
58 PointerMotionListener
* pmlistener
;
59 ImageAreaToolListener
* listener
;
61 CropWindow
* getCropWindow (int x
, int y
);
66 IndicateClippedPanel
* indClippedPanel
;
68 ImageArea (ImageAreaPanel
* p
);
71 void setImProcCoordinator (rtengine::StagedImageProcessor
* ipc_
);
73 void getScrollImageSize (int& w
, int& h
);
74 void getScrollPosition (int& x
, int& y
);
75 void setScrollPosition (int x
, int y
); // called by the imageareapanel when the scrollbars have been changed
77 // enabling and setting text of info area
78 void setInfoText (Glib::ustring text
);
79 void infoEnabled (bool e
);
83 bool on_expose_event (GdkEventExpose
* event
);
84 bool on_motion_notify_event (GdkEventMotion
* event
);
85 bool on_button_press_event (GdkEventButton
* event
);
86 bool on_button_release_event (GdkEventButton
* event
);
87 bool on_scroll_event (GdkEventScroll
* event
);
88 void on_resized (Gtk::Allocation
& req
);
89 void styleChanged (const Glib::RefPtr
<Gtk::Style
>& style
);
90 void updateScrollbars ();
92 void setCropGUIListener (CropGUIListener
* l
);
93 void setPointerMotionListener (PointerMotionListener
* pml
);
94 void setImageAreaToolListener (ImageAreaToolListener
* l
) { listener
= l
; }
95 void setPreviewHandler (PreviewHandler
* ph
);
96 PreviewHandler
* getPreviewHandler () { return previewHandler
; }
98 void grabFocus (CropWindow
* cw
);
100 void addCropWindow ();
101 void cropWindowSelected (CropWindow
* cw
);
102 void cropWindowClosed (CropWindow
* cw
);
103 ToolMode
getToolMode ();
105 void straightenReady (double rotDeg
);
106 void spotWBSelected (int x
, int y
);
107 int getSpotWBRectSize ();
112 void setZoom (double zoom
);
114 // cropwindowlistener interface
115 void cropPositionChanged (CropWindow
* cw
);
116 void cropWindowSizeChanged (CropWindow
* cw
);
117 void cropZoomChanged (CropWindow
* cw
);
118 void initialImageArrived (CropWindow
* cw
) ;
120 CropWindow
* getMainCropWindow () { return mainCropWindow
; }