1 /* === S Y N F I G ========================================================= */ 2 /*! \file docks/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 "docks/dock_canvasspecific.h" 40 #include "widgets/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 Glib::RefPtr<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 cairo_surface_t* cairo_surface; 75 bool rendering; 76 77 //drawing functionality 78 void on_start_render(); //breaks out into asynchronous rendering 79 void on_finish_render(); 80 void on_draw(); //renders the small thing we have 81 void on_dirty_preview(); //dirties the preview for rerender 82 83 //for the zoom buttons 84 void on_zoom_in(); 85 void on_zoom_out(); 86 87 //handles the zoom scroller 88 using Gtk::Widget::on_scroll_event; 89 bool on_scroll_event(GdkEvent *event); 90 void on_number_modify(); 91 92 // 93 bool on_mouse_event(GdkEvent * e); 94 95 //draws the gotten bitmap on the draw area 96 bool on_drawto_draw(const Cairo::RefPtr<Cairo::Context> &cr); 97 98 //for when the canvasview view changes (boolean value scrolling solves cyclic problems) 99 void on_workarea_view_change(); 100 101 public: 102 Widget_NavView(CanvasView::LooseHandle cv = CanvasView::LooseHandle()); 103 ~Widget_NavView(); 104 get_canvas_view()105 etl::loose_handle<studio::CanvasView> get_canvas_view() {return canvview;} 106 }; 107 108 class Dock_Navigator : public Dock_CanvasSpecific 109 { 110 Widget_NavView dummy; 111 112 public: 113 Dock_Navigator(); 114 ~Dock_Navigator(); 115 116 virtual void changed_canvas_view_vfunc(etl::loose_handle<CanvasView> canvas_view); 117 }; 118 119 }; // END of namespace studio 120 121 /* === E N D =============================================================== */ 122 123 #endif 124