initial version
[synfig.git] / synfig-studio / trunk / src / gtkmm / dock_navigator.h
1 /* === S I N F G =========================================================== */
2 /*!     \file dock_navigator.h
3 **      \brief Navigator Dock Header
4 **
5 **      $Id: dock_navigator.h,v 1.3 2005/01/12 00:31:11 darco Exp $
6 **
7 **      \legal
8 **      Copyright (c) 2002 Robert B. Quattlebaum Jr.
9 **
10 **      This software and associated documentation
11 **      are CONFIDENTIAL and PROPRIETARY property of
12 **      the above-mentioned copyright holder.
13 **
14 **      You may not copy, print, publish, or in any
15 **      other way distribute this software without
16 **      a prior written agreement with
17 **      the copyright holder.
18 **      \endlegal
19 */
20 /* ========================================================================= */
21
22 /* === S T A R T =========================================================== */
23
24 #ifndef __SINFG_DOCK_NAVIGATOR_H
25 #define __SINFG_DOCK_NAVIGATOR_H
26
27 /* === H E A D E R S ======================================================= */
28 #include "sigc++/signal.h"
29
30 #include <gtkmm/drawingarea.h>
31 #include <gdkmm/pixbuf.h>
32 #include <gtkmm/adjustment.h>
33 #include <gtkmm/label.h>
34
35 #include <sinfg/renddesc.h>
36
37 #include "canvasview.h"
38 #include "dock_canvasspecific.h"
39 #include "widget_distance.h"
40
41 #include <ETL/smart_ptr>
42
43 /* === M A C R O S ========================================================= */
44
45 /* === T Y P E D E F S ===================================================== */
46
47 /* === C L A S S E S & S T R U C T S ======================================= */
48
49 namespace studio {
50 class AsyncRenderer;
51         
52 class Widget_NavView : public Gtk::Table
53 {
54         //handle to out parent canvas
55         CanvasView::LooseHandle         canvview;
56         
57         Glib::RefPtr<Gdk::Pixbuf>       prev;
58         bool dirty;
59         
60         //The drawing stuff     
61         Gtk::DrawingArea        drawto;
62         
63         //The input stuff
64         Gtk::Adjustment         adj_zoom;
65         Gtk::Label                      zoom_print;
66         
67         //zoom window stuff
68         bool                            scrolling;
69         
70         //asyncronous rendering stuff
71         etl::handle<AsyncRenderer>      renderer;
72         etl::smart_ptr<sinfg::Surface> surface;
73         bool                                            rendering;
74         
75         //drawing functionality
76         void on_start_render(); //breaks out into asynchronous rendering
77         void on_finish_render();
78         void on_draw(); //renders the small thing we have
79         void on_dirty_preview(); //dirties the preview for rerender
80         
81         //for the zoom buttons
82         void on_zoom_in();
83         void on_zoom_out();
84         
85         //handles the zoom scroller
86         bool on_scroll_event(GdkEvent *event);
87         void on_number_modify();
88         
89         //
90         bool on_mouse_event(GdkEvent * e);
91         
92         //draws the gotten bitmap on the draw area
93         bool on_expose_draw(GdkEventExpose *exp=0);
94         
95         //for when the canvasview view changes (boolean value scrolling solves cyclic problems)
96         void on_workarea_view_change();
97
98 public:
99         Widget_NavView(CanvasView::LooseHandle cv = CanvasView::LooseHandle());
100         ~Widget_NavView();
101
102         etl::loose_handle<studio::CanvasView> get_canvas_view() {return canvview;}
103 };
104         
105 class Dock_Navigator : public Dock_CanvasSpecific
106 {
107         Widget_NavView  dummy;
108                 
109 public:
110         Dock_Navigator();
111         ~Dock_Navigator();
112
113         virtual void changed_canvas_view_vfunc(etl::loose_handle<CanvasView> canvas_view);
114 };
115         
116 }; // END of namespace studio
117
118 /* === E N D =============================================================== */
119
120 #endif