27 #ifndef __SYNFIG_GTKMM_WORKAREA_H
28 #define __SYNFIG_GTKMM_WORKAREA_H
36 #include <ETL/smart_ptr>
39 #include <gtkmm/drawingarea.h>
40 #include <gtkmm/table.h>
41 #include <gtkmm/adjustment.h>
42 #include <gtkmm/image.h>
43 #include <gdkmm/pixbuf.h>
44 #include <gdkmm/cursor.h>
45 #include <gdkmm/device.h>
47 #include <synfig/time.h>
48 #include <synfig/vector.h>
49 #include <synfig/general.h>
50 #include <synfig/renddesc.h>
51 #include <synfig/canvas.h>
80 namespace synfigapp {
class CanvasInterface; };
82 namespace synfig {
class Layer; };
83 namespace Gtk {
class Frame; };
88 class WorkAreaTarget_Full;
89 class WorkAreaTarget_Cairo;
90 class WorkAreaTarget_Cairo_Tile;
95 class WorkAreaRenderer;
127 void insert_renderer(
const etl::handle<WorkAreaRenderer> &x,
int priority);
158 cairo_surface_destroy(
surface);
170 std::set<etl::handle<WorkAreaRenderer> > renderer_set_;
172 etl::handle<studio::AsyncRenderer> async_renderer;
175 etl::loose_handle<synfigapp::CanvasInterface> canvas_interface;
176 etl::handle<synfig::Canvas> canvas;
177 etl::loose_handle<studio::Instance> instance;
178 etl::loose_handle<studio::CanvasView> canvas_view;
181 Gtk::DrawingArea *drawing_area;
182 Glib::RefPtr<Gtk::Adjustment> scrollx_adjustment;
183 Glib::RefPtr<Gtk::Adjustment> scrolly_adjustment;
187 Gtk::Button *menubutton;
188 Gtk::Frame *drawing_frame;
190 GdkDevice* curr_input_device;
195 synfig::Real canvaswidth;
196 synfig::Real canvasheight;
200 synfig::Point window_tl;
201 synfig::Point window_br;
203 guint32 last_event_time;
209 synfig::ProgressCallback *progresscallback;
212 synfig::RendDesc desc;
218 etl::handle<Duckmatic::Duck> clicked_duck;
219 etl::handle<Duckmatic::Duck> hover_duck;
222 synfig::Point drag_point;
224 synfig::Point curr_point;
227 synfig::Point previous_focus;
236 synfig::Vector background_size;
238 synfig::Color background_first_color;
240 synfig::Color background_second_color;
242 synfig::Time jack_offset;
254 std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,
int> > tile_book;
266 gint render_idle_func_id;
269 synfig::Point last_focus_point;
274 int low_res_pixel_size;
276 bool dirty_trap_enabled;
278 int dirty_trap_queued;
285 etl::loose_handle<synfig::ValueNode> selected_value_node_;
287 bool allow_duck_clicks;
288 bool allow_bezier_clicks;
289 bool allow_layer_clicks;
291 bool curr_guide_is_x;
296 #ifdef SINGLE_THREADED
298 int old_window_width;
299 int old_window_height;
310 std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,
int> >&
get_tile_book(){
return tile_book; }
316 #ifdef SINGLE_THREADED
317 bool get_updating()
const;
318 void stop_updating(
bool cancel =
false);
355 bool set_wh(
int w,
int h,
int chan=3);
357 int next_unrendered_tile(
int refreshes)
const;
358 int next_unrendered_tile()
const {
return next_unrendered_tile(refreshes); }
366 sigc::signal<void,GdkDevice* > signal_input_device_changed_;
369 sigc::signal<void,synfig::Point> signal_user_click_[5];
371 sigc::signal<void> signal_popup_menu_;
373 sigc::signal<void> signal_cursor_moved_;
374 sigc::signal<void> signal_rendering_;
377 sigc::signal<void, etl::handle<synfig::Layer> > signal_layer_selected_;
379 sigc::signal<void> signal_view_window_changed_;
381 sigc::signal<void> signal_meta_data_changed_;
400 sigc::signal<void,synfig::Point> &
signal_user_click(
int button=0){
return signal_user_click_[button]; }
421 WorkArea(etl::loose_handle<synfigapp::CanvasInterface> canvas_interface);
424 void set_cursor(
const Glib::RefPtr<Gdk::Cursor> &x);
434 void set_instance(etl::loose_handle<studio::Instance> x) { instance=x; }
437 etl::handle<synfig::Canvas>
get_canvas()
const {
return canvas; }
562 #ifdef SINGLE_THREADED
564 void refresh_second_check();
566 bool refresh(
const Cairo::RefPtr<Cairo::Context> &cr);
581 bool on_key_press_event(GdkEventKey* event);
582 bool on_key_release_event(GdkEventKey* event);
583 bool on_drawing_area_event(GdkEvent* event);
584 bool on_hruler_event(GdkEvent* event);
585 bool on_vruler_event(GdkEvent* event);
599 static gboolean __render_preview(gpointer data);
600 #ifdef SINGLE_THREADED
602 static gboolean __refresh_second_check(gpointer data);
614 bool allow_duck_clicks;
615 bool allow_bezier_clicks;
616 bool allow_layer_clicks;