Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / stable / src / gtkmm / dock_navigator.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file dock_navigator.h
3 **      \brief Navigator Dock Header
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **
10 **      This package is free software; you can redistribute it and/or
11 **      modify it under the terms of the GNU General Public License as
12 **      published by the Free Software Foundation; either version 2 of
13 **      the License, or (at your option) any later version.
14 **
15 **      This package is distributed in the hope that it will be useful,
16 **      but WITHOUT ANY WARRANTY; without even the implied warranty of
17 **      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 **      General Public License for more details.
19 **      \endlegal
20 */
21 /* ========================================================================= */
22
23 /* === S T A R T =========================================================== */
24
25 #ifndef __SYNFIG_DOCK_NAVIGATOR_H
26 #define __SYNFIG_DOCK_NAVIGATOR_H
27
28 /* === H E A D E R S ======================================================= */
29 #include "sigc++/signal.h"
30
31 #include <gtkmm/drawingarea.h>
32 #include <gdkmm/pixbuf.h>
33 #include <gtkmm/adjustment.h>
34 #include <gtkmm/label.h>
35
36 #include <synfig/renddesc.h>
37
38 #include "canvasview.h"
39 #include "dock_canvasspecific.h"
40 #include "widget_distance.h"
41
42 #include <ETL/smart_ptr>
43
44 /* === M A C R O S ========================================================= */
45
46 /* === T Y P E D E F S ===================================================== */
47
48 /* === C L A S S E S & S T R U C T S ======================================= */
49
50 namespace studio {
51 class AsyncRenderer;
52
53 class Widget_NavView : public Gtk::Table
54 {
55         //handle to out parent canvas
56         CanvasView::LooseHandle         canvview;
57
58         Glib::RefPtr<Gdk::Pixbuf>       prev;
59         bool dirty;
60
61         //The drawing stuff
62         Gtk::DrawingArea        drawto;
63
64         //The input stuff
65         Gtk::Adjustment         adj_zoom;
66         Gtk::Label                      zoom_print;
67
68         //zoom window stuff
69         bool                            scrolling;
70
71         //asynchronous rendering stuff
72         etl::handle<AsyncRenderer>      renderer;
73         etl::smart_ptr<synfig::Surface> surface;
74         bool                                            rendering;
75
76         //drawing functionality
77         void on_start_render(); //breaks out into asynchronous rendering
78         void on_finish_render();
79         void on_draw(); //renders the small thing we have
80         void on_dirty_preview(); //dirties the preview for rerender
81
82         //for the zoom buttons
83         void on_zoom_in();
84         void on_zoom_out();
85
86         //handles the zoom scroller
87         bool on_scroll_event(GdkEvent *event);
88         void on_number_modify();
89
90         //
91         bool on_mouse_event(GdkEvent * e);
92
93         //draws the gotten bitmap on the draw area
94         bool on_expose_draw(GdkEventExpose *exp=0);
95
96         //for when the canvasview view changes (boolean value scrolling solves cyclic problems)
97         void on_workarea_view_change();
98
99 public:
100         Widget_NavView(CanvasView::LooseHandle cv = CanvasView::LooseHandle());
101         ~Widget_NavView();
102
103         etl::loose_handle<studio::CanvasView> get_canvas_view() {return canvview;}
104 };
105
106 class Dock_Navigator : public Dock_CanvasSpecific
107 {
108         Widget_NavView  dummy;
109
110 public:
111         Dock_Navigator();
112         ~Dock_Navigator();
113
114         virtual void changed_canvas_view_vfunc(etl::loose_handle<CanvasView> canvas_view);
115 };
116
117 }; // END of namespace studio
118
119 /* === E N D =============================================================== */
120
121 #endif