1 /* === S Y N F I G ========================================================= */ 2 /*! \file workarearenderer.cpp 3 ** \brief Template File 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 /* === H E A D E R S ======================================================= */ 24 25 #ifdef USING_PCH 26 # include "pch.h" 27 #else 28 #ifdef HAVE_CONFIG_H 29 # include <config.h> 30 #endif 31 32 #include <synfig/general.h> 33 34 #include "workarearenderer.h" 35 #include "workarea.h" 36 37 #include <gui/localization.h> 38 39 #endif 40 41 /* === U S I N G =========================================================== */ 42 43 using namespace std; 44 using namespace etl; 45 using namespace synfig; 46 using namespace studio; 47 48 /* === M A C R O S ========================================================= */ 49 50 /* === G L O B A L S ======================================================= */ 51 52 /* === P R O C E D U R E S ================================================= */ 53 54 /* === M E T H O D S ======================================================= */ 55 WorkAreaRenderer()56WorkAreaRenderer::WorkAreaRenderer(): 57 enabled_(true), 58 priority_(0), 59 work_area_(NULL) 60 { } 61 ~WorkAreaRenderer()62WorkAreaRenderer::~WorkAreaRenderer() 63 { } 64 65 bool get_enabled_vfunc() const66WorkAreaRenderer::get_enabled_vfunc()const 67 { 68 return enabled_; 69 } 70 71 void set_enabled(bool x)72WorkAreaRenderer::set_enabled(bool x) 73 { 74 if(x==enabled_) 75 return; 76 enabled_=x; 77 signal_changed()(); 78 } 79 80 void set_priority(int x)81WorkAreaRenderer::set_priority(int x) 82 { 83 if(x==priority_) 84 return; 85 priority_=x; 86 signal_changed()(); 87 } 88 89 void set_work_area(WorkArea * x)90WorkAreaRenderer::set_work_area(WorkArea* x) 91 { 92 work_area_=x; 93 } 94 95 void render_vfunc(const Glib::RefPtr<Gdk::Window> &,const Gdk::Rectangle &)96WorkAreaRenderer::render_vfunc( 97 const Glib::RefPtr<Gdk::Window>& /*window*/, 98 const Gdk::Rectangle& /*expose_area*/ 99 ) 100 { 101 } 102 103 bool event_vfunc(GdkEvent *)104WorkAreaRenderer::event_vfunc( 105 GdkEvent* /*event*/ 106 ) 107 { 108 return false; 109 } 110 111 int get_w() const112WorkAreaRenderer::get_w()const 113 { return get_work_area()->get_w(); } 114 int get_h() const115WorkAreaRenderer::get_h()const 116 { return get_work_area()->get_h(); } 117 118 float get_pw() const119WorkAreaRenderer::get_pw()const 120 { return get_work_area()->get_pw(); } 121 float get_ph() const122WorkAreaRenderer::get_ph()const 123 { return get_work_area()->get_ph(); } 124 125 synfig::Point screen_to_comp_coords(synfig::Point pos) const126WorkAreaRenderer::screen_to_comp_coords(synfig::Point pos)const 127 { 128 return get_work_area()->screen_to_comp_coords(pos); 129 } 130 131 synfig::Point comp_to_screen_coords(synfig::Point pos) const132WorkAreaRenderer::comp_to_screen_coords(synfig::Point pos)const 133 { 134 return get_work_area()->comp_to_screen_coords(pos); 135 } 136