Move workarea renderers into subfolder
authorNikita Kitaev <nikitakit@gmail.com>
Sat, 17 Apr 2010 06:33:16 +0000 (23:33 -0700)
committerNikita Kitaev <nikitakit@gmail.com>
Sat, 17 Apr 2010 06:33:16 +0000 (23:33 -0700)
34 files changed:
synfig-studio/src/gui/Makefile.am
synfig-studio/src/gui/renderer_bbox.cpp [deleted file]
synfig-studio/src/gui/renderer_bbox.h [deleted file]
synfig-studio/src/gui/renderer_canvas.cpp [deleted file]
synfig-studio/src/gui/renderer_canvas.h [deleted file]
synfig-studio/src/gui/renderer_dragbox.cpp [deleted file]
synfig-studio/src/gui/renderer_dragbox.h [deleted file]
synfig-studio/src/gui/renderer_ducks.cpp [deleted file]
synfig-studio/src/gui/renderer_ducks.h [deleted file]
synfig-studio/src/gui/renderer_grid.cpp [deleted file]
synfig-studio/src/gui/renderer_grid.h [deleted file]
synfig-studio/src/gui/renderer_guides.cpp [deleted file]
synfig-studio/src/gui/renderer_guides.h [deleted file]
synfig-studio/src/gui/renderer_timecode.cpp [deleted file]
synfig-studio/src/gui/renderer_timecode.h [deleted file]
synfig-studio/src/gui/workarea.cpp
synfig-studio/src/gui/workarearenderer.cpp [deleted file]
synfig-studio/src/gui/workarearenderer.h [deleted file]
synfig-studio/src/gui/workarearenderer/renderer_bbox.cpp [new file with mode: 0644]
synfig-studio/src/gui/workarearenderer/renderer_bbox.h [new file with mode: 0644]
synfig-studio/src/gui/workarearenderer/renderer_canvas.cpp [new file with mode: 0644]
synfig-studio/src/gui/workarearenderer/renderer_canvas.h [new file with mode: 0644]
synfig-studio/src/gui/workarearenderer/renderer_dragbox.cpp [new file with mode: 0644]
synfig-studio/src/gui/workarearenderer/renderer_dragbox.h [new file with mode: 0644]
synfig-studio/src/gui/workarearenderer/renderer_ducks.cpp [new file with mode: 0644]
synfig-studio/src/gui/workarearenderer/renderer_ducks.h [new file with mode: 0644]
synfig-studio/src/gui/workarearenderer/renderer_grid.cpp [new file with mode: 0644]
synfig-studio/src/gui/workarearenderer/renderer_grid.h [new file with mode: 0644]
synfig-studio/src/gui/workarearenderer/renderer_guides.cpp [new file with mode: 0644]
synfig-studio/src/gui/workarearenderer/renderer_guides.h [new file with mode: 0644]
synfig-studio/src/gui/workarearenderer/renderer_timecode.cpp [new file with mode: 0644]
synfig-studio/src/gui/workarearenderer/renderer_timecode.h [new file with mode: 0644]
synfig-studio/src/gui/workarearenderer/workarearenderer.cpp [new file with mode: 0644]
synfig-studio/src/gui/workarearenderer/workarearenderer.h [new file with mode: 0644]

index 85e3570..b97c6a8 100644 (file)
@@ -21,24 +21,24 @@ CELLRENDERER_CC = \
 
 
 WORKAREARENDERER_HH = \
-       renderer_bbox.h \
-       renderer_canvas.h \
-       renderer_dragbox.h \
-       renderer_ducks.h \
-       renderer_grid.h \
-       renderer_guides.h \
-       renderer_timecode.h \
-       workarearenderer.h
+       workarearenderer/renderer_bbox.h \
+       workarearenderer/renderer_canvas.h \
+       workarearenderer/renderer_dragbox.h \
+       workarearenderer/renderer_ducks.h \
+       workarearenderer/renderer_grid.h \
+       workarearenderer/renderer_guides.h \
+       workarearenderer/renderer_timecode.h \
+       workarearenderer/workarearenderer.h
 
 WORKAREARENDERER_CC = \
-       renderer_bbox.cpp \
-       renderer_canvas.cpp \
-       renderer_dragbox.cpp \
-       renderer_ducks.cpp \
-       renderer_grid.cpp \
-       renderer_guides.cpp \
-       renderer_timecode.cpp \
-       workarearenderer.cpp
+       workarearenderer/renderer_bbox.cpp \
+       workarearenderer/renderer_canvas.cpp \
+       workarearenderer/renderer_dragbox.cpp \
+       workarearenderer/renderer_ducks.cpp \
+       workarearenderer/renderer_grid.cpp \
+       workarearenderer/renderer_guides.cpp \
+       workarearenderer/renderer_timecode.cpp \
+       workarearenderer/workarearenderer.cpp
 
 
 PALETTE_HH = \
diff --git a/synfig-studio/src/gui/renderer_bbox.cpp b/synfig-studio/src/gui/renderer_bbox.cpp
deleted file mode 100644 (file)
index 727ad02..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/* === S Y N F I G ========================================================= */
-/*!    \file renderer_bbox.cpp
-**     \brief Template File
-**
-**     $Id$
-**
-**     \legal
-**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**
-**     This package is free software; you can redistribute it and/or
-**     modify it under the terms of the GNU General Public License as
-**     published by the Free Software Foundation; either version 2 of
-**     the License, or (at your option) any later version.
-**
-**     This package is distributed in the hope that it will be useful,
-**     but WITHOUT ANY WARRANTY; without even the implied warranty of
-**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-**     General Public License for more details.
-**     \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-#      include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-#      include <config.h>
-#endif
-
-#include "renderer_bbox.h"
-#include "workarea.h"
-#include "canvasview.h"
-#include "general.h"
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace synfig;
-using namespace studio;
-
-/* === M A C R O S ========================================================= */
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Renderer_BBox::Renderer_BBox()
-{
-}
-
-Renderer_BBox::~Renderer_BBox()
-{
-}
-
-const synfig::Rect&
-Renderer_BBox::get_bbox()
-{
-       return get_work_area()->get_canvas_view()->get_bbox();
-}
-
-void
-Renderer_BBox::render_vfunc(
-       const Glib::RefPtr<Gdk::Drawable>& drawable,
-       const Gdk::Rectangle& /*expose_area*/
-)
-{
-       assert(get_work_area());
-       if(!get_work_area())
-               return;
-
-//     const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
-
-       const synfig::Vector focus_point(get_work_area()->get_focus_point());
-
-//     std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
-
-       int drawable_w,drawable_h;
-       drawable->get_size(drawable_w,drawable_h);
-
-       // Calculate the window coordinates of the top-left
-       // corner of the canvas.
-//     const synfig::Vector::value_type
-//             x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
-//             y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
-
-       /*const synfig::Vector::value_type window_startx(window_tl[0]);
-       const synfig::Vector::value_type window_endx(window_br[0]);
-       const synfig::Vector::value_type window_starty(window_tl[1]);
-       const synfig::Vector::value_type window_endy(window_br[1]);
-       */
-//     const int
-//             tile_w(get_work_area()->get_tile_w()),
-//             tile_h(get_work_area()->get_tile_h());
-
-//     const int
-//             w(get_w()),
-//             h(get_h());
-
-       Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
-
-       //const synfig::Vector grid_size(get_grid_size());
-
-       const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
-//     const synfig::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
-       const synfig::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
-//     const synfig::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
-       const float pw(get_pw()),ph(get_ph());
-
-       const synfig::Point curr_point(get_bbox().get_min());
-       const synfig::Point drag_point(get_bbox().get_max());
-       if(get_bbox().area()<10000000000000000.0)
-       {
-               gc->set_function(Gdk::INVERT);
-               gc->set_rgb_fg_color(Gdk::Color("#FFFFFF"));
-               //gc->set_line_attributes(1,Gdk::LINE_ON_OFF_DASH,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-               gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-
-               Point tl(std::min(drag_point[0],curr_point[0]),std::min(drag_point[1],curr_point[1]));
-               Point br(std::max(drag_point[0],curr_point[0]),std::max(drag_point[1],curr_point[1]));
-
-               tl[0]=(tl[0]-window_startx)/pw;
-               tl[1]=(tl[1]-window_starty)/ph;
-               br[0]=(br[0]-window_startx)/pw;
-               br[1]=(br[1]-window_starty)/ph;
-               if(tl[0]>br[0])
-                       swap(tl[0],br[0]);
-               if(tl[1]>br[1])
-                       swap(tl[1],br[1]);
-
-               drawable->draw_rectangle(gc,false,
-                       round_to_int(tl[0]),
-                       round_to_int(tl[1]),
-                       round_to_int(br[0]-tl[0]),
-                       round_to_int(br[1]-tl[1])
-               );
-       }
-}
diff --git a/synfig-studio/src/gui/renderer_bbox.h b/synfig-studio/src/gui/renderer_bbox.h
deleted file mode 100644 (file)
index d3d5952..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/* === S Y N F I G ========================================================= */
-/*!    \file renderer_bbox.h
-**     \brief Template Header
-**
-**     $Id$
-**
-**     \legal
-**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**
-**     This package is free software; you can redistribute it and/or
-**     modify it under the terms of the GNU General Public License as
-**     published by the Free Software Foundation; either version 2 of
-**     the License, or (at your option) any later version.
-**
-**     This package is distributed in the hope that it will be useful,
-**     but WITHOUT ANY WARRANTY; without even the implied warranty of
-**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-**     General Public License for more details.
-**     \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SYNFIG_RENDERER_BBOX_H
-#define __SYNFIG_RENDERER_BBOX_H
-
-/* === H E A D E R S ======================================================= */
-
-#include "workarearenderer.h"
-#include <vector>
-#include <synfig/vector.h>
-#include <synfig/rect.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace studio {
-
-class Renderer_BBox : public studio::WorkAreaRenderer
-{
-       synfig::Rect bbox;
-
-public:
-       Renderer_BBox();
-       ~Renderer_BBox();
-
-       const synfig::Rect& get_bbox();
-
-       void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable,const Gdk::Rectangle& expose_area );
-
-protected:
-       //bool get_enabled_vfunc()const;
-};
-
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
diff --git a/synfig-studio/src/gui/renderer_canvas.cpp b/synfig-studio/src/gui/renderer_canvas.cpp
deleted file mode 100644 (file)
index 9608079..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-/* === S Y N F I G ========================================================= */
-/*!    \file renderer_canvas.cpp
-**     \brief Template File
-**
-**     $Id$
-**
-**     \legal
-**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**     Copyright (c) 2007, 2008 Chris Moore
-**
-**     This package is free software; you can redistribute it and/or
-**     modify it under the terms of the GNU General Public License as
-**     published by the Free Software Foundation; either version 2 of
-**     the License, or (at your option) any later version.
-**
-**     This package is distributed in the hope that it will be useful,
-**     but WITHOUT ANY WARRANTY; without even the implied warranty of
-**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-**     General Public License for more details.
-**     \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-#      include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-#      include <config.h>
-#endif
-
-#include "renderer_canvas.h"
-#include "workarea.h"
-#include <ETL/misc>
-
-#include "general.h"
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace synfig;
-using namespace studio;
-
-/* === M A C R O S ========================================================= */
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Renderer_Canvas::~Renderer_Canvas()
-{
-}
-std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >&
-Renderer_Canvas::get_tile_book()
-{
-       return get_work_area()->get_tile_book();
-}
-
-bool
-Renderer_Canvas::get_full_frame()const
-{
-       return get_work_area()->get_full_frame();
-}
-
-int Renderer_Canvas::get_refreshes()const
-{
-       return get_work_area()->get_refreshes();
-}
-
-bool
-Renderer_Canvas::get_canceled()const
-{
-       return get_work_area()->get_canceled();
-}
-
-bool
-Renderer_Canvas::get_queued()const
-{
-       return get_work_area()->get_queued();
-}
-
-bool
-Renderer_Canvas::get_rendering()const
-{
-       return get_work_area()->get_rendering();
-}
-
-void
-Renderer_Canvas::render_vfunc(
-       const Glib::RefPtr<Gdk::Drawable>& drawable,
-       const Gdk::Rectangle& /*expose_area*/
-)
-{
-       assert(get_work_area());
-       if(!get_work_area())
-               return;
-
-//     const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
-
-       const synfig::Vector focus_point(get_work_area()->get_focus_point());
-
-       std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
-
-       int drawable_w,drawable_h;
-       drawable->get_size(drawable_w,drawable_h);
-
-       // Calculate the window coordinates of the top-left
-       // corner of the canvas.
-       const synfig::Vector::value_type
-               x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
-               y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
-
-       /*const synfig::Vector::value_type window_startx(window_tl[0]);
-       const synfig::Vector::value_type window_endx(window_br[0]);
-       const synfig::Vector::value_type window_starty(window_tl[1]);
-       const synfig::Vector::value_type window_endy(window_br[1]);
-       */
-       const int
-               tile_w(get_work_area()->get_tile_w()),
-               tile_h(get_work_area()->get_tile_h());
-
-       const int
-               w(get_w()),
-               h(get_h());
-
-       Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
-
-       if(!tile_book.empty())
-       {
-               if(get_full_frame())
-               {
-                       if(tile_book[0].first)
-                       {
-                               drawable->draw_pixbuf(
-                                       gc, //GC
-                                       tile_book[0].first, //pixbuf
-                                       0, 0,   // Source X and Y
-                                       round_to_int(x),round_to_int(y),        // Dest X and Y
-                                       -1,-1,  // Width and Height
-                                       Gdk::RGB_DITHER_MAX,            // RgbDither
-                                       2, 2 // Dither offset X and Y
-                                       );
-                       }
-                       if(tile_book[0].second!=get_refreshes() && get_canceled()==false && get_rendering()==false && get_queued()==false)
-                               get_work_area()->async_update_preview();
-               }
-               else
-               {
-                       int div = get_work_area()->get_low_res_pixel_size();
-                       const int width_in_tiles(w/tile_w+(((get_work_area()->get_low_resolution_flag())?((w/div)%(tile_w/div)):(w%tile_w))?1:0));
-                       const int height_in_tiles(h/tile_h+(h%tile_h?1:0));
-
-                       int u(0),v(0),tx,ty;
-                       int u1(0),v1(0),u2(width_in_tiles), v2(height_in_tiles);
-
-                       bool needs_refresh(false);
-
-                       u1=int(-x/tile_w);
-                       v1=int(-y/tile_h);
-                       u2=int((-x+drawable_w)/tile_w+1);
-                       v2=int((-y+drawable_h)/tile_h+1);
-                       if(u2>width_in_tiles)u2=width_in_tiles;
-                       if(v2>height_in_tiles)v2=height_in_tiles;
-                       if(u1<0)u1=0;
-                       if(v1<0)v1=0;
-
-                       for(v=v1;v<v2;v++)
-                       {
-                               for(u=u1;u<u2;u++)
-                               {
-                                       int index=v*width_in_tiles+u;
-                                       if(int(tile_book.size())>index && tile_book[index].first)
-                                       {
-                                               tx=u*tile_w;
-                                               ty=v*tile_w;
-
-                                               drawable->draw_pixbuf(
-                                                       gc, //GC
-                                                       tile_book[index].first, //pixbuf
-                                                       0, 0,   // Source X and Y
-                                                       round_to_int(x)+tx,round_to_int(y)+ty,  // Dest X and Y
-                                                       -1,-1,  // Width and Height
-                                                       Gdk::RGB_DITHER_MAX,            // RgbDither
-                                                       2, 2 // Dither offset X and Y
-                                                       );
-                                       }
-                                       if(tile_book[index].second!=get_refreshes())
-                                               needs_refresh=true;
-                               }
-                       }
-                       if(needs_refresh==true && get_canceled()==false && get_rendering()==false && get_queued()==false)
-                       {
-                               //queue_render_preview();
-                               get_work_area()->async_update_preview();
-                               //update_preview();
-                               //return true;
-                       }
-
-               }
-       }
-
-       // Draw the border around the rendered region
-       {
-               gc->set_rgb_fg_color(Gdk::Color("#000000"));
-               gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-               drawable->draw_rectangle(
-                       gc,
-                       false,  // Fill?
-                       round_to_int(x),round_to_int(y),        // x,y
-                       w,h     //w,h
-               );
-       }
-}
diff --git a/synfig-studio/src/gui/renderer_canvas.h b/synfig-studio/src/gui/renderer_canvas.h
deleted file mode 100644 (file)
index ad2509e..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/* === S Y N F I G ========================================================= */
-/*!    \file renderer_canvas.h
-**     \brief Template Header
-**
-**     $Id$
-**
-**     \legal
-**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**
-**     This package is free software; you can redistribute it and/or
-**     modify it under the terms of the GNU General Public License as
-**     published by the Free Software Foundation; either version 2 of
-**     the License, or (at your option) any later version.
-**
-**     This package is distributed in the hope that it will be useful,
-**     but WITHOUT ANY WARRANTY; without even the implied warranty of
-**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-**     General Public License for more details.
-**     \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SYNFIG_RENDERER_CANVAS_H
-#define __SYNFIG_RENDERER_CANVAS_H
-
-/* === H E A D E R S ======================================================= */
-
-#include "workarearenderer.h"
-#include <vector>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace studio {
-
-class Renderer_Canvas : public studio::WorkAreaRenderer
-{
-
-public:
-       ~Renderer_Canvas();
-
-       std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& get_tile_book();
-
-       bool get_full_frame()const;
-
-       int get_refreshes()const;
-       bool get_canceled()const;
-       bool get_queued()const;
-       bool get_rendering()const;
-
-       void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable,const Gdk::Rectangle& expose_area );
-};
-
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
diff --git a/synfig-studio/src/gui/renderer_dragbox.cpp b/synfig-studio/src/gui/renderer_dragbox.cpp
deleted file mode 100644 (file)
index a177154..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/* === S Y N F I G ========================================================= */
-/*!    \file renderer_dragbox.cpp
-**     \brief Template File
-**
-**     $Id$
-**
-**     \legal
-**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**
-**     This package is free software; you can redistribute it and/or
-**     modify it under the terms of the GNU General Public License as
-**     published by the Free Software Foundation; either version 2 of
-**     the License, or (at your option) any later version.
-**
-**     This package is distributed in the hope that it will be useful,
-**     but WITHOUT ANY WARRANTY; without even the implied warranty of
-**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-**     General Public License for more details.
-**     \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-#      include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-#      include <config.h>
-#endif
-
-#include "renderer_dragbox.h"
-#include "workarea.h"
-#include <ETL/misc>
-
-#include "general.h"
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace synfig;
-using namespace studio;
-
-/* === M A C R O S ========================================================= */
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Renderer_Dragbox::~Renderer_Dragbox()
-{
-}
-
-const synfig::Point&
-Renderer_Dragbox::get_drag_point()const
-{
-       return get_work_area()->get_drag_point();
-}
-
-const synfig::Point&
-Renderer_Dragbox::get_curr_point()const
-{
-       return get_work_area()->get_cursor_pos();
-}
-
-bool
-Renderer_Dragbox::get_enabled_vfunc()const
-{
-       return get_work_area()->get_dragging_mode()==WorkArea::DRAG_BOX;
-}
-
-
-void
-Renderer_Dragbox::render_vfunc(
-       const Glib::RefPtr<Gdk::Drawable>& drawable,
-       const Gdk::Rectangle& /*expose_area*/
-)
-{
-       assert(get_work_area());
-       if(!get_work_area())
-               return;
-
-       // const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
-
-       const synfig::Vector focus_point(get_work_area()->get_focus_point());
-
-//     std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
-
-       int drawable_w,drawable_h;
-       drawable->get_size(drawable_w,drawable_h);
-
-       // Calculate the window coordinates of the top-left
-       // corner of the canvas.
-       // const synfig::Vector::value_type
-       //      x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
-       //      y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
-
-       /*const synfig::Vector::value_type window_startx(window_tl[0]);
-       const synfig::Vector::value_type window_endx(window_br[0]);
-       const synfig::Vector::value_type window_starty(window_tl[1]);
-       const synfig::Vector::value_type window_endy(window_br[1]);
-       */
-       // const int
-       //      tile_w(get_work_area()->get_tile_w()),
-       //      tile_h(get_work_area()->get_tile_h());
-
-       // const int
-       //      w(get_w()),
-       //      h(get_h());
-
-       Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
-
-       //const synfig::Vector grid_size(get_grid_size());
-
-       const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
-       // const synfig::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
-       const synfig::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
-       // const synfig::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
-       const float pw(get_pw()),ph(get_ph());
-
-       const synfig::Point& curr_point(get_curr_point());
-       const synfig::Point& drag_point(get_drag_point());
-
-       {
-               gc->set_function(Gdk::COPY);
-               gc->set_rgb_fg_color(Gdk::Color("#000000"));
-               gc->set_line_attributes(1,Gdk::LINE_ON_OFF_DASH,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-               //gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-
-               Point tl(std::min(drag_point[0],curr_point[0]),std::min(drag_point[1],curr_point[1]));
-               Point br(std::max(drag_point[0],curr_point[0]),std::max(drag_point[1],curr_point[1]));
-
-               tl[0]=(tl[0]-window_startx)/pw;
-               tl[1]=(tl[1]-window_starty)/ph;
-               br[0]=(br[0]-window_startx)/pw;
-               br[1]=(br[1]-window_starty)/ph;
-               if(tl[0]>br[0])
-                       swap(tl[0],br[0]);
-               if(tl[1]>br[1])
-                       swap(tl[1],br[1]);
-
-               drawable->draw_rectangle(gc,false,
-                       round_to_int(tl[0]),
-                       round_to_int(tl[1]),
-                       round_to_int(br[0]-tl[0]),
-                       round_to_int(br[1]-tl[1])
-               );
-       }
-}
diff --git a/synfig-studio/src/gui/renderer_dragbox.h b/synfig-studio/src/gui/renderer_dragbox.h
deleted file mode 100644 (file)
index 497b903..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* === S Y N F I G ========================================================= */
-/*!    \file renderer_dragbox.h
-**     \brief Template Header
-**
-**     $Id$
-**
-**     \legal
-**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**
-**     This package is free software; you can redistribute it and/or
-**     modify it under the terms of the GNU General Public License as
-**     published by the Free Software Foundation; either version 2 of
-**     the License, or (at your option) any later version.
-**
-**     This package is distributed in the hope that it will be useful,
-**     but WITHOUT ANY WARRANTY; without even the implied warranty of
-**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-**     General Public License for more details.
-**     \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SYNFIG_RENDERER_DRAGBOX_H
-#define __SYNFIG_RENDERER_DRAGBOX_H
-
-/* === H E A D E R S ======================================================= */
-
-#include "workarearenderer.h"
-#include <vector>
-#include <synfig/vector.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace studio {
-
-class Renderer_Dragbox : public studio::WorkAreaRenderer
-{
-
-public:
-       ~Renderer_Dragbox();
-
-       void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable,const Gdk::Rectangle& expose_area );
-
-       const synfig::Point& get_drag_point()const;
-       const synfig::Point& get_curr_point()const;
-
-protected:
-       bool get_enabled_vfunc()const;
-};
-
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
diff --git a/synfig-studio/src/gui/renderer_ducks.cpp b/synfig-studio/src/gui/renderer_ducks.cpp
deleted file mode 100644 (file)
index 5ad88cb..0000000
+++ /dev/null
@@ -1,489 +0,0 @@
-/* === S Y N F I G ========================================================= */
-/*!    \file renderer_ducks.cpp
-**     \brief Template File
-**
-**     $Id$
-**
-**     \legal
-**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**     Copyright (c) 2007, 2008 Chris Moore
-**  Copyright (c) 2008 Gerald Young
-**
-**     This package is free software; you can redistribute it and/or
-**     modify it under the terms of the GNU General Public License as
-**     published by the Free Software Foundation; either version 2 of
-**     the License, or (at your option) any later version.
-**
-**     This package is distributed in the hope that it will be useful,
-**     but WITHOUT ANY WARRANTY; without even the implied warranty of
-**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-**     General Public License for more details.
-**     \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-#      include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-#      include <config.h>
-#endif
-
-#include "renderer_ducks.h"
-#include "workarea.h"
-#include "duckmatic.h"
-#include <ETL/bezier>
-#include <ETL/misc>
-#include "widgets/widget_color.h"
-#include <synfig/distance.h>
-#include "app.h"
-
-#include "general.h"
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace synfig;
-using namespace studio;
-
-/* === M A C R O S ========================================================= */
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Renderer_Ducks::~Renderer_Ducks()
-{
-}
-
-/*
-bool
-Renderer_Ducks::get_enabled_vfunc()const
-{
-       return get_work_area()->grid_status();
-}
-*/
-
-struct ScreenDuck
-{
-       synfig::Point pos;
-       Gdk::Color color;
-       bool selected;
-       bool hover;
-       Real width;
-
-       ScreenDuck():width(0) { }
-};
-
-void
-Renderer_Ducks::render_vfunc(
-       const Glib::RefPtr<Gdk::Drawable>& drawable,
-       const Gdk::Rectangle& /*expose_area*/
-)
-{
-       assert(get_work_area());
-       if(!get_work_area())
-               return;
-
-       const synfig::Vector focus_point(get_work_area()->get_focus_point());
-
-
-       int drawable_w,drawable_h;
-       drawable->get_size(drawable_w,drawable_h);
-
-       Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
-
-
-       const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
-       const synfig::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
-
-       const float pw(get_pw()),ph(get_ph());
-
-       const std::list<etl::handle<Duckmatic::Bezier> >& bezier_list(get_work_area()->bezier_list());
-       const bool solid_lines(get_work_area()->solid_lines);
-
-       const std::list<handle<Duckmatic::Stroke> >& stroke_list(get_work_area()->stroke_list());
-
-       Glib::RefPtr<Pango::Layout> layout(Pango::Layout::create(get_work_area()->get_pango_context()));
-
-       // Render the strokes
-       for(std::list<handle<Duckmatic::Stroke> >::const_iterator iter=stroke_list.begin();iter!=stroke_list.end();++iter)
-       {
-               Point window_start(window_startx,window_starty);
-               vector<Gdk::Point> points;
-               std::list<synfig::Point>::iterator iter2;
-               Point holder;
-
-               for(iter2=(*iter)->stroke_data->begin();iter2!=(*iter)->stroke_data->end();++iter2)
-               {
-                       holder=*iter2-window_start;
-                       holder[0]/=pw;holder[1]/=ph;
-                       points.push_back(Gdk::Point(round_to_int(holder[0]),round_to_int(holder[1])));
-               }
-
-               gc->set_rgb_fg_color(colorconv_synfig2gdk((*iter)->color));
-               gc->set_function(Gdk::COPY);
-               gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-
-               // Draw the stroke
-               drawable->draw_lines(gc, Glib::ArrayHandle<Gdk::Point>(points));
-       }
-
-
-
-       // Render the beziers
-       for(std::list<handle<Duckmatic::Bezier> >::const_iterator iter=bezier_list.begin();iter!=bezier_list.end();++iter)
-       {
-               Point window_start(window_startx,window_starty);
-               Point p1((*iter)->p1->get_trans_point()-window_start);
-               Point p2((*iter)->p2->get_trans_point()-window_start);
-               Point c1((*iter)->c1->get_trans_point()-window_start);
-               Point c2((*iter)->c2->get_trans_point()-window_start);
-               p1[0]/=pw;p1[1]/=ph;
-               p2[0]/=pw;p2[1]/=ph;
-               c1[0]/=pw;c1[1]/=ph;
-               c2[0]/=pw;c2[1]/=ph;
-               bezier<Point> curve(p1,c1,c2,p2);
-               vector<Gdk::Point> points;
-
-               float f;
-               Point pt;
-               for(f=0;f<1.0;f+=1.0/17.0)
-               {
-                       pt=curve(f);
-                       points.push_back(Gdk::Point(round_to_int(pt[0]),round_to_int(pt[1])));
-               }
-               points.push_back(Gdk::Point(round_to_int(p2[0]),round_to_int(p2[1])));
-
-               // Draw the curve
-/*             if(solid_lines)
-               {
-                       gc->set_rgb_fg_color(DUCK_COLOR_BEZIER_1);
-                       gc->set_function(Gdk::COPY);
-                       gc->set_line_attributes(3,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-                       drawable->draw_lines(gc, Glib::ArrayHandle<Gdk::Point>(points));
-                       gc->set_rgb_fg_color(DUCK_COLOR_BEZIER_2);
-                       gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-                       drawable->draw_lines(gc, Glib::ArrayHandle<Gdk::Point>(points));
-               }
-               else
-*/
-               {
-//                     gc->set_rgb_fg_color(Gdk::Color("#ffffff"));
-//                     gc->set_function(Gdk::INVERT);
-//                     gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-//                     drawable->draw_lines(gc, Glib::ArrayHandle<Gdk::Point>(points));
-                       gc->set_rgb_fg_color(DUCK_COLOR_BEZIER_1);
-                       gc->set_function(Gdk::COPY);
-                       gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-                       drawable->draw_lines(gc, Glib::ArrayHandle<Gdk::Point>(points));
-                       gc->set_rgb_fg_color(DUCK_COLOR_BEZIER_2);
-                       gc->set_line_attributes(1,Gdk::LINE_ON_OFF_DASH,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-                       drawable->draw_lines(gc, Glib::ArrayHandle<Gdk::Point>(points));
-
-               }
-       }
-
-
-       const DuckList duck_list(get_work_area()->get_duck_list());
-       //Gtk::StateType state = Gtk::STATE_ACTIVE;
-       Gtk::ShadowType shadow=Gtk::SHADOW_OUT;
-       std::list<ScreenDuck> screen_duck_list;
-       const float radius((abs(pw)+abs(ph))*4);
-
-       etl::handle<Duck> hover_duck(get_work_area()->find_duck(get_work_area()->get_cursor_pos(),radius, get_work_area()->get_type_mask()));
-
-       // Render the ducks
-       for(std::list<handle<Duck> >::const_iterator iter=duck_list.begin();iter!=duck_list.end();++iter)
-       {
-
-               // If this type of duck has been masked, then skip it
-               if((*iter)->get_type() && (!(get_work_area()->get_type_mask() & (*iter)->get_type())))
-                       continue;
-
-//             Real x,y;
-       //      Gdk::Rectangle area;
-               Point sub_trans_point((*iter)->get_sub_trans_point());
-               Point sub_trans_origin((*iter)->get_sub_trans_origin());
-
-               if (App::restrict_radius_ducks &&
-                       (*iter)->is_radius())
-               {
-                       if (sub_trans_point[0] < sub_trans_origin[0])
-                               sub_trans_point[0] = sub_trans_origin[0];
-                       if (sub_trans_point[1] < sub_trans_origin[1])
-                               sub_trans_point[1] = sub_trans_origin[1];
-               }
-
-               Point point((*iter)->get_transform_stack().perform(sub_trans_point));
-               Point origin((*iter)->get_transform_stack().perform(sub_trans_origin));
-
-               point[0]=(point[0]-window_startx)/pw;
-               point[1]=(point[1]-window_starty)/ph;
-
-               bool has_connect(false);
-               if((*iter)->get_tangent() || (*iter)->get_type()&Duck::TYPE_ANGLE)
-               {
-                       has_connect=true;
-               }
-               if((*iter)->get_connect_duck())
-               {
-                       has_connect=true;
-                       origin=(*iter)->get_connect_duck()->get_trans_point();
-               }
-
-               origin[0]=(origin[0]-window_startx)/pw;
-               origin[1]=(origin[1]-window_starty)/ph;
-
-               bool selected(get_work_area()->duck_is_selected(*iter));
-               bool hover(*iter==hover_duck || (*iter)->get_hover());
-
-               shadow = selected?Gtk::SHADOW_IN:Gtk::SHADOW_OUT;
-
-               if(get_work_area()->get_selected_value_node())
-               {
-                       synfigapp::ValueDesc value_desc((*iter)->get_value_desc());
-                       if (value_desc.is_valid() &&
-                               ((value_desc.is_value_node()            && get_work_area()->get_selected_value_node() == value_desc.get_value_node()) ||
-                                (value_desc.parent_is_value_node()     && get_work_area()->get_selected_value_node() == value_desc.get_parent_value_node())))
-                       {
-                               gc->set_function(Gdk::COPY);
-                               gc->set_rgb_fg_color(DUCK_COLOR_SELECTED);
-                               //gc->set_line_attributes(1,Gdk::LINE_ON_OFF_DASH,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-                               gc->set_line_attributes(2,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-
-                               drawable->draw_rectangle(gc,false,
-                                       round_to_int(point[0]-5),
-                                       round_to_int(point[1]-5),
-                                       10,
-                                       10
-                               );
-                       }
-
-               }
-
-               if((*iter)->get_box_duck())
-               {
-                       Point boxpoint((*iter)->get_box_duck()->get_trans_point());
-                       boxpoint[0]=(boxpoint[0]-window_startx)/pw;
-                       boxpoint[1]=(boxpoint[1]-window_starty)/ph;
-                       Point tl(min(point[0],boxpoint[0]),min(point[1],boxpoint[1]));
-
-                       gc->set_function(Gdk::COPY);
-                       gc->set_rgb_fg_color(DUCK_COLOR_BOX_1);
-                       gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-                       drawable->draw_rectangle(gc,false,
-                               round_to_int(tl[0]),
-                               round_to_int(tl[1]),
-                               round_to_int(abs(boxpoint[0]-point[0])),
-                               round_to_int(abs(boxpoint[1]-point[1]))
-                       );
-                       gc->set_function(Gdk::COPY);
-                       gc->set_rgb_fg_color(DUCK_COLOR_BOX_2);
-                       gc->set_line_attributes(1,Gdk::LINE_ON_OFF_DASH,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-                       drawable->draw_rectangle(gc,false,
-                               round_to_int(tl[0]),
-                               round_to_int(tl[1]),
-                               round_to_int(abs(boxpoint[0]-point[0])),
-                               round_to_int(abs(boxpoint[1]-point[1]))
-                       );
-               }
-
-               ScreenDuck screen_duck;
-               screen_duck.pos=point;
-               screen_duck.selected=selected;
-               screen_duck.hover=hover;
-
-               if(!(*iter)->get_editable())
-                       screen_duck.color=(DUCK_COLOR_NOT_EDITABLE);
-               else if((*iter)->get_tangent())
-                       screen_duck.color=((*iter)->get_scalar()<0 ? DUCK_COLOR_TANGENT_1 : DUCK_COLOR_TANGENT_2);
-               else if((*iter)->get_type()&Duck::TYPE_VERTEX)
-                       screen_duck.color=DUCK_COLOR_VERTEX;
-               else if((*iter)->get_type()&Duck::TYPE_RADIUS)
-                       screen_duck.color=DUCK_COLOR_RADIUS;
-               else if((*iter)->get_type()&Duck::TYPE_WIDTH)
-                       screen_duck.color=DUCK_COLOR_WIDTH;
-               else if((*iter)->get_type()&Duck::TYPE_ANGLE)
-                       screen_duck.color=(DUCK_COLOR_ANGLE);
-               else
-                       screen_duck.color=DUCK_COLOR_OTHER;
-
-               screen_duck_list.push_front(screen_duck);
-
-               if(has_connect)
-               {
-                       if(solid_lines)
-                       {
-                               gc->set_line_attributes(3,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-                               gc->set_rgb_fg_color(DUCK_COLOR_CONNECT_OUTSIDE);
-                               gc->set_function(Gdk::COPY);
-                               drawable->draw_line(gc, (int)origin[0],(int)origin[1],(int)(point[0]),(int)(point[1]));
-                               gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-                               gc->set_rgb_fg_color(DUCK_COLOR_CONNECT_INSIDE);
-                               drawable->draw_line(gc, (int)origin[0],(int)origin[1],(int)(point[0]),(int)(point[1]));
-                       }
-                       else
-                       {
-//                             gc->set_rgb_fg_color(Gdk::Color("#ffffff"));
-//                             gc->set_function(Gdk::INVERT);
-//                             drawable->draw_line(gc, (int)origin[0],(int)origin[1],(int)(point[0]),(int)(point[1]));
-                               gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-                               gc->set_rgb_fg_color(DUCK_COLOR_CONNECT_OUTSIDE);
-                               gc->set_function(Gdk::COPY);
-                               drawable->draw_line(gc, (int)origin[0],(int)origin[1],(int)(point[0]),(int)(point[1]));
-                               gc->set_line_attributes(1,Gdk::LINE_ON_OFF_DASH,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-                               gc->set_rgb_fg_color(DUCK_COLOR_CONNECT_INSIDE);
-                               drawable->draw_line(gc, (int)origin[0],(int)origin[1],(int)(point[0]),(int)(point[1]));
-                       }
-               }
-
-               if((*iter)->is_radius())
-               {
-                       const Real mag((point-origin).mag());
-                       const int d(round_to_int(mag*2));
-                       const int x(round_to_int(origin[0]-mag));
-                       const int y(round_to_int(origin[1]-mag));
-
-                       if(solid_lines)
-                       {
-                               gc->set_rgb_fg_color(Gdk::Color("#000000"));
-                               gc->set_function(Gdk::COPY);
-                               gc->set_line_attributes(3,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-                               drawable->draw_arc(
-                                       gc,
-                                       false,
-                                       x,
-                                       y,
-                                       d,
-                                       d,
-                                       0,
-                                       360*64
-                               );
-                               gc->set_rgb_fg_color(Gdk::Color("#afafaf"));
-                       }
-                       else
-                       {
-                               gc->set_rgb_fg_color(Gdk::Color("#ffffff"));
-                               gc->set_function(Gdk::INVERT);
-                       }
-                       gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-
-                       drawable->draw_arc(
-                               gc,
-                               false,
-                               x,
-                               y,
-                               d,
-                               d,
-                               0,
-                               360*64
-                       );
-
-                       if(hover)
-                       {
-                               Real mag;
-                               if (App::restrict_radius_ducks)
-                               {
-                                       Point sub_trans_point((*iter)->get_sub_trans_point());
-                                       Point sub_trans_origin((*iter)->get_sub_trans_origin());
-
-                                       if (sub_trans_point[0] < sub_trans_origin[0])
-                                               sub_trans_point[0] = sub_trans_origin[0];
-                                       if (sub_trans_point[1] < sub_trans_origin[1])
-                                               sub_trans_point[1] = sub_trans_origin[1];
-
-                                       Point point((*iter)->get_transform_stack().perform(sub_trans_point));
-                                       Point origin((*iter)->get_transform_stack().perform(sub_trans_origin));
-
-                                       mag = (point-origin).mag();
-                               }
-                               else
-                                       mag = ((*iter)->get_trans_point()-(*iter)->get_trans_origin()).mag();
-
-                               Distance real_mag(mag, Distance::SYSTEM_UNITS);
-                               real_mag.convert(App::distance_system,get_work_area()->get_rend_desc());
-                               layout->set_text(real_mag.get_string());
-
-                               gc->set_rgb_fg_color(DUCK_COLOR_WIDTH_TEXT_1);
-                               drawable->draw_layout(
-                                       gc,
-                                       round_to_int(point[0])+1+6,
-                                       round_to_int(point[1])+1-8,
-                                       layout
-                               );
-                               gc->set_rgb_fg_color(DUCK_COLOR_WIDTH_TEXT_2);
-                               drawable->draw_layout(
-                                       gc,
-                                       round_to_int(point[0])+6,
-                                       round_to_int(point[1])-8,
-                                       layout
-                               );
-                       }
-
-               }
-
-       }
-
-
-       for(;screen_duck_list.size();screen_duck_list.pop_front())
-       {
-               int radius=4;
-               int outline=1;
-               Gdk::Color color(screen_duck_list.front().color);
-
-               if(!screen_duck_list.front().selected)
-               {
-                       color.set_red(color.get_red()*2/3);
-                       color.set_green(color.get_green()*2/3);
-                       color.set_blue(color.get_blue()*2/3);
-               }
-
-               if(screen_duck_list.front().hover && !screen_duck_list.back().hover && screen_duck_list.size()>1)
-               {
-                       screen_duck_list.push_back(screen_duck_list.front());
-                       continue;
-               }
-
-               if(screen_duck_list.front().hover)
-               {
-                       radius+=2;
-                       outline++;
-               }
-
-               gc->set_function(Gdk::COPY);
-               gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-               gc->set_rgb_fg_color(DUCK_COLOR_OUTLINE);
-               drawable->draw_arc(
-                       gc,
-                       true,
-                       round_to_int(screen_duck_list.front().pos[0]-radius),
-                       round_to_int(screen_duck_list.front().pos[1]-radius),
-                       radius*2,
-                       radius*2,
-                       0,
-                       360*64
-               );
-
-
-               gc->set_rgb_fg_color(color);
-
-               drawable->draw_arc(
-                       gc,
-                       true,
-                       round_to_int(screen_duck_list.front().pos[0]-radius+outline),
-                       round_to_int(screen_duck_list.front().pos[1]-radius+outline),
-                       radius*2-outline*2,
-                       radius*2-outline*2,
-                       0,
-                       360*64
-               );
-       }
-}
diff --git a/synfig-studio/src/gui/renderer_ducks.h b/synfig-studio/src/gui/renderer_ducks.h
deleted file mode 100644 (file)
index 32a6efd..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/* === S Y N F I G ========================================================= */
-/*!    \file renderer_ducks.h
-**     \brief Template Header
-**
-**     $Id$
-**
-**     \legal
-**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**     Copyright (c) 2007 Chris Moore
-**
-**     This package is free software; you can redistribute it and/or
-**     modify it under the terms of the GNU General Public License as
-**     published by the Free Software Foundation; either version 2 of
-**     the License, or (at your option) any later version.
-**
-**     This package is distributed in the hope that it will be useful,
-**     but WITHOUT ANY WARRANTY; without even the implied warranty of
-**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-**     General Public License for more details.
-**     \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SYNFIG_RENDERER_DUCKS_H
-#define __SYNFIG_RENDERER_DUCKS_H
-
-/* === H E A D E R S ======================================================= */
-
-#include "workarearenderer.h"
-#include <vector>
-
-/* === M A C R O S ========================================================= */
-
-#define DUCK_COLOR_NOT_EDITABLE        Gdk::Color("#cfcfcf")
-
-#define DUCK_COLOR_ANGLE               Gdk::Color("#0000ff")
-#define DUCK_COLOR_RADIUS              Gdk::Color("#00ffff")
-#define DUCK_COLOR_TANGENT_1   Gdk::Color("#ffff00")
-#define DUCK_COLOR_TANGENT_2   Gdk::Color("#ff0000")
-#define DUCK_COLOR_VERTEX              Gdk::Color("#ff7f00")
-#define DUCK_COLOR_WIDTH               Gdk::Color("#ff00ff")
-#define DUCK_COLOR_OTHER               Gdk::Color("#00ff00")
-
-#define DUCK_COLOR_OUTLINE             Gdk::Color("#000000") // the outline around each duck
-
-#define DUCK_COLOR_BEZIER_1            Gdk::Color("#000000") // the 2 colors used to draw bezier curves
-#define DUCK_COLOR_BEZIER_2            Gdk::Color("#afafaf")
-
-#define DUCK_COLOR_BOX_1               Gdk::Color("#ffffff") // the 2 colors used to draw boxes
-#define DUCK_COLOR_BOX_2               Gdk::Color("#000000")
-
-#define DUCK_COLOR_SELECTED            Gdk::Color("#ff0000") // the color of the box drawn when a valuenode is selected
-
-#define DUCK_COLOR_CONNECT_INSIDE      Gdk::Color("#9fefef") // the color of the inside of the line connecting a vertex duck to the tangent ducks
-#define DUCK_COLOR_CONNECT_OUTSIDE     Gdk::Color("#000000") // the color of the outside of the line connecting a vertex duck to the tangent ducks
-
-#define DUCK_COLOR_WIDTH_TEXT_1        Gdk::Color("#000000") // the color of the text's shadow when hovering over a width duck
-#define DUCK_COLOR_WIDTH_TEXT_2        Gdk::Color("#ff00ff") // the color of the text when hovering over a width duck
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace studio {
-
-class Renderer_Ducks : public studio::WorkAreaRenderer
-{
-
-public:
-       ~Renderer_Ducks();
-
-       void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable,const Gdk::Rectangle& expose_area );
-
-protected:
-//     bool get_enabled_vfunc()const;
-};
-
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
diff --git a/synfig-studio/src/gui/renderer_grid.cpp b/synfig-studio/src/gui/renderer_grid.cpp
deleted file mode 100644 (file)
index b00a593..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/* === S Y N F I G ========================================================= */
-/*!    \file renderer_grid.cpp
-**     \brief Template File
-**
-**     $Id$
-**
-**     \legal
-**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**
-**     This package is free software; you can redistribute it and/or
-**     modify it under the terms of the GNU General Public License as
-**     published by the Free Software Foundation; either version 2 of
-**     the License, or (at your option) any later version.
-**
-**     This package is distributed in the hope that it will be useful,
-**     but WITHOUT ANY WARRANTY; without even the implied warranty of
-**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-**     General Public License for more details.
-**     \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-#      include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-#      include <config.h>
-#endif
-
-#include "renderer_grid.h"
-#include "workarea.h"
-#include <ETL/misc>
-
-#include "general.h"
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace synfig;
-using namespace studio;
-
-/* === M A C R O S ========================================================= */
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Renderer_Grid::~Renderer_Grid()
-{
-}
-
-bool
-Renderer_Grid::get_enabled_vfunc()const
-{
-       return get_work_area()->grid_status();
-}
-
-synfig::Vector
-Renderer_Grid::get_grid_size()const
-{
-       return get_work_area()->get_grid_size();
-}
-
-void
-Renderer_Grid::render_vfunc(
-       const Glib::RefPtr<Gdk::Drawable>& drawable,
-       const Gdk::Rectangle& /*expose_area*/
-)
-{
-       assert(get_work_area());
-       if(!get_work_area())
-               return;
-
-//     const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
-
-       const synfig::Vector focus_point(get_work_area()->get_focus_point());
-
-//     std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
-
-       int drawable_w,drawable_h;
-       drawable->get_size(drawable_w,drawable_h);
-
-       // Calculate the window coordinates of the top-left
-       // corner of the canvas.
-//     const synfig::Vector::value_type
-//             x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
-//             y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
-
-       /*const synfig::Vector::value_type window_startx(window_tl[0]);
-       const synfig::Vector::value_type window_endx(window_br[0]);
-       const synfig::Vector::value_type window_starty(window_tl[1]);
-       const synfig::Vector::value_type window_endy(window_br[1]);
-       */
-//     const int
-//             tile_w(get_work_area()->get_tile_w()),
-//             tile_h(get_work_area()->get_tile_h());
-
-//     const int
-//             w(get_w()),
-//             h(get_h());
-
-       Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
-
-       const synfig::Vector grid_size(get_grid_size());
-
-       const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
-       const synfig::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
-       const synfig::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
-       const synfig::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
-       const float pw(get_pw()),ph(get_ph());
-
-       // Draw out the grid
-       if(grid_size[0]>pw*3.5 && grid_size[1]>ph*3.5)
-       {
-               synfig::Vector::value_type x,y;
-
-               x=floor(window_startx/grid_size[0])*grid_size[0];
-               y=floor(window_starty/grid_size[1])*grid_size[1];
-
-               gc->set_function(Gdk::COPY);
-               gc->set_rgb_fg_color(Gdk::Color("#9f9f9f"));
-               gc->set_line_attributes(1,Gdk::LINE_ON_OFF_DASH,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-
-               if(x<window_endx)
-                       for(;x<window_endx;x+=grid_size[0])
-                       {
-                               drawable->draw_line(gc,
-                                       round_to_int((x-window_startx)/pw),
-                                       0,
-                                       round_to_int((x-window_startx)/pw),
-                                       drawable_h
-                               );
-                       }
-               else
-                       for(;x>window_endx;x-=grid_size[0])
-                       {
-                               drawable->draw_line(gc,
-                                       round_to_int((x-window_startx)/pw),
-                                       0,
-                                       round_to_int((x-window_startx)/pw),
-                                       drawable_h
-                               );
-                       }
-
-               if(y<window_endy)
-                       for(;y<window_endy;y+=grid_size[1])
-                       {
-                               drawable->draw_line(gc,
-                                       0,
-                                       round_to_int((y-window_starty)/ph),
-                                       drawable_w,
-                                       round_to_int((y-window_starty)/ph)
-                               );
-                       }
-               else
-                       for(;y>window_endy;y-=grid_size[1])
-                       {
-                               drawable->draw_line(gc,
-                                       0,
-                                       round_to_int((y-window_starty)/ph),
-                                       drawable_w,
-                                       round_to_int((y-window_starty)/ph)
-                               );
-                       }
-       }
-}
diff --git a/synfig-studio/src/gui/renderer_grid.h b/synfig-studio/src/gui/renderer_grid.h
deleted file mode 100644 (file)
index 9cb96c4..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/* === S Y N F I G ========================================================= */
-/*!    \file renderer_grid.h
-**     \brief Template Header
-**
-**     $Id$
-**
-**     \legal
-**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**
-**     This package is free software; you can redistribute it and/or
-**     modify it under the terms of the GNU General Public License as
-**     published by the Free Software Foundation; either version 2 of
-**     the License, or (at your option) any later version.
-**
-**     This package is distributed in the hope that it will be useful,
-**     but WITHOUT ANY WARRANTY; without even the implied warranty of
-**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-**     General Public License for more details.
-**     \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SYNFIG_RENDERER_GRID_H
-#define __SYNFIG_RENDERER_GRID_H
-
-/* === H E A D E R S ======================================================= */
-
-#include "workarearenderer.h"
-#include <vector>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace studio {
-
-class Renderer_Grid : public studio::WorkAreaRenderer
-{
-
-public:
-       ~Renderer_Grid();
-
-       synfig::Vector get_grid_size()const;
-
-       void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable,const Gdk::Rectangle& expose_area );
-
-protected:
-       bool get_enabled_vfunc()const;
-};
-
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
diff --git a/synfig-studio/src/gui/renderer_guides.cpp b/synfig-studio/src/gui/renderer_guides.cpp
deleted file mode 100644 (file)
index c1f5d9f..0000000
+++ /dev/null
@@ -1,284 +0,0 @@
-/* === S Y N F I G ========================================================= */
-/*!    \file renderer_guides.cpp
-**     \brief Template File
-**
-**     $Id$
-**
-**     \legal
-**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**
-**     This package is free software; you can redistribute it and/or
-**     modify it under the terms of the GNU General Public License as
-**     published by the Free Software Foundation; either version 2 of
-**     the License, or (at your option) any later version.
-**
-**     This package is distributed in the hope that it will be useful,
-**     but WITHOUT ANY WARRANTY; without even the implied warranty of
-**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-**     General Public License for more details.
-**     \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-#      include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-#      include <config.h>
-#endif
-
-#include "renderer_guides.h"
-#include "workarea.h"
-#include <ETL/misc>
-
-#include "general.h"
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace synfig;
-using namespace studio;
-
-/* === M A C R O S ========================================================= */
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Renderer_Guides::Renderer_Guides():
-       dragging(false)
-{
-
-}
-
-Renderer_Guides::~Renderer_Guides()
-{
-}
-
-bool
-Renderer_Guides::get_enabled_vfunc()const
-{
-       return get_work_area()->get_show_guides();
-}
-
-std::list<float>&
-Renderer_Guides::get_guide_list_x()
-{
-       return get_work_area()->get_guide_list_x();
-}
-
-std::list<float>&
-Renderer_Guides::get_guide_list_y()
-{
-       return get_work_area()->get_guide_list_y();
-}
-
-bool
-Renderer_Guides::event_vfunc(GdkEvent* event)
-{
-       synfig::Point mouse_pos;
-       // float bezier_click_pos;
-       // const float radius((abs(get_pw())+abs(get_ph()))*4);
-       int button_pressed(0);
-       float pressure(0);
-       bool is_mouse(false);
-       Gdk::ModifierType modifier(Gdk::ModifierType(0));
-
-       // Handle input stuff
-       if(
-               event->any.type==GDK_MOTION_NOTIFY ||
-               event->any.type==GDK_BUTTON_PRESS ||
-               event->any.type==GDK_2BUTTON_PRESS ||
-               event->any.type==GDK_3BUTTON_PRESS ||
-               event->any.type==GDK_BUTTON_RELEASE
-       )
-       {
-               GdkDevice *device;
-               if(event->any.type==GDK_MOTION_NOTIFY)
-               {
-                       device=event->motion.device;
-                       modifier=Gdk::ModifierType(event->motion.state);
-               }
-               else
-               {
-                       device=event->button.device;
-                       modifier=Gdk::ModifierType(event->button.state);
-               }
-
-               // Make sure we recognize the device
-               /*if(curr_input_device)
-               {
-                       if(curr_input_device!=device)
-                       {
-                               assert(device);
-                               curr_input_device=device;
-                               signal_input_device_changed()(curr_input_device);
-                       }
-               }
-               else*/ if(device)
-               {
-                       //curr_input_device=device;
-                       //signal_input_device_changed()(curr_input_device);
-               }
-
-               //assert(curr_input_device);
-
-               // Calculate the position of the
-               // input device in canvas coordinates
-               // and the buttons
-               if(!event->button.axes)
-               {
-                       mouse_pos=synfig::Point(screen_to_comp_coords(synfig::Point(event->button.x,event->button.y)));
-                       button_pressed=event->button.button;
-                       pressure=1.0f;
-                       is_mouse=true;
-                       if(isnan(event->button.x) || isnan(event->button.y))
-                               return false;
-               }
-               else
-               {
-                       double x(event->button.axes[0]);
-                       double y(event->button.axes[1]);
-                       if(isnan(x) || isnan(y))
-                               return false;
-
-                       pressure=event->button.axes[2];
-                       //synfig::info("pressure=%f",pressure);
-                       pressure-=0.04f;
-                       pressure/=1.0f-0.04f;
-
-
-                       assert(!isnan(pressure));
-
-                       mouse_pos=synfig::Point(screen_to_comp_coords(synfig::Point(x,y)));
-
-                       button_pressed=event->button.button;
-
-                       if(button_pressed==1 && pressure<0 && (event->any.type!=GDK_BUTTON_RELEASE && event->any.type!=GDK_BUTTON_PRESS))
-                               button_pressed=0;
-                       if(pressure<0)
-                               pressure=0;
-
-                       //if(event->any.type==GDK_BUTTON_PRESS && button_pressed)
-                       //      synfig::info("Button pressed on input device = %d",event->button.button);
-
-                       //if(event->button.axes[2]>0.1)
-                       //      button_pressed=1;
-                       //else
-                       //      button_pressed=0;
-               }
-       }
-       switch(event->type)
-    {
-       case GDK_BUTTON_PRESS:
-               break;
-       case GDK_MOTION_NOTIFY:
-               break;
-       case GDK_BUTTON_RELEASE:
-               break;
-       default:
-               break;
-       }
-
-       return false;
-}
-
-void
-Renderer_Guides::render_vfunc(
-       const Glib::RefPtr<Gdk::Drawable>& drawable,
-       const Gdk::Rectangle& /*expose_area*/
-)
-{
-       assert(get_work_area());
-       if(!get_work_area())
-               return;
-
-       // const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
-
-       const synfig::Vector focus_point(get_work_area()->get_focus_point());
-
-       //std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
-
-       int drawable_w,drawable_h;
-       drawable->get_size(drawable_w,drawable_h);
-
-       // Calculate the window coordinates of the top-left
-       // corner of the canvas.
-       // const synfig::Vector::value_type
-       //      x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
-       //      y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
-
-       /*const synfig::Vector::value_type window_startx(window_tl[0]);
-       const synfig::Vector::value_type window_endx(window_br[0]);
-       const synfig::Vector::value_type window_starty(window_tl[1]);
-       const synfig::Vector::value_type window_endy(window_br[1]);
-       */
-       // const int
-       //      tile_w(get_work_area()->get_tile_w()),
-       //      tile_h(get_work_area()->get_tile_h());
-
-       // const int
-       //      w(get_w()),
-       //      h(get_h());
-
-       Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
-
-       //const synfig::Vector grid_size(get_grid_size());
-
-       const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
-       // const synfig::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
-       const synfig::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
-       // const synfig::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
-       const float pw(get_pw()),ph(get_ph());
-
-       // Draw out the guides
-       {
-               gc->set_function(Gdk::COPY);
-               gc->set_rgb_fg_color(Gdk::Color("#9f9fff"));
-               gc->set_line_attributes(1,Gdk::LINE_ON_OFF_DASH,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-
-               Duckmatic::GuideList::const_iterator iter;
-
-               // vertical
-               for(iter=get_guide_list_x().begin();iter!=get_guide_list_x().end();++iter)
-               {
-                       const float x((*iter-window_startx)/pw);
-
-                       if(iter==get_work_area()->curr_guide)
-                               gc->set_rgb_fg_color(Gdk::Color("#ff6f6f"));
-                       else
-                               gc->set_rgb_fg_color(Gdk::Color("#6f6fff"));
-
-                       drawable->draw_line(gc,
-                               round_to_int(x),
-                               0,
-                               round_to_int(x),
-                               drawable_h
-                       );
-               }
-               // horizontal
-               for(iter=get_guide_list_y().begin();iter!=get_guide_list_y().end();++iter)
-               {
-                       const float y((*iter-window_starty)/ph);
-
-                       if(iter==get_work_area()->curr_guide)
-                               gc->set_rgb_fg_color(Gdk::Color("#ff6f6f"));
-                       else
-                               gc->set_rgb_fg_color(Gdk::Color("#6f6fff"));
-
-                       drawable->draw_line(gc,
-                               0,
-                               round_to_int(y),
-                               drawable_w,
-                               round_to_int(y)
-                       );
-               }
-       }
-}
diff --git a/synfig-studio/src/gui/renderer_guides.h b/synfig-studio/src/gui/renderer_guides.h
deleted file mode 100644 (file)
index d7c7ce0..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/* === S Y N F I G ========================================================= */
-/*!    \file renderer_guides.h
-**     \brief Template Header
-**
-**     $Id$
-**
-**     \legal
-**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**
-**     This package is free software; you can redistribute it and/or
-**     modify it under the terms of the GNU General Public License as
-**     published by the Free Software Foundation; either version 2 of
-**     the License, or (at your option) any later version.
-**
-**     This package is distributed in the hope that it will be useful,
-**     but WITHOUT ANY WARRANTY; without even the implied warranty of
-**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-**     General Public License for more details.
-**     \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SYNFIG_RENDERER_GUIDES_H
-#define __SYNFIG_RENDERER_GUIDES_H
-
-/* === H E A D E R S ======================================================= */
-
-#include "workarearenderer.h"
-#include <vector>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace studio {
-
-class Renderer_Guides : public studio::WorkAreaRenderer
-{
-       bool dragging;
-public:
-       Renderer_Guides();
-       ~Renderer_Guides();
-
-       std::list<float>& get_guide_list_x();
-       std::list<float>& get_guide_list_y();
-
-       void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable,const Gdk::Rectangle& expose_area );
-       bool event_vfunc(GdkEvent* event);
-
-protected:
-       bool get_enabled_vfunc()const;
-};
-
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
diff --git a/synfig-studio/src/gui/renderer_timecode.cpp b/synfig-studio/src/gui/renderer_timecode.cpp
deleted file mode 100644 (file)
index 48cc42b..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/* === S Y N F I G ========================================================= */
-/*!    \file renderer_timecode.cpp
-**     \brief Template File
-**
-**     $Id$
-**
-**     \legal
-**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**     Copyright (c) 2007 Chris Moore
-**
-**     This package is free software; you can redistribute it and/or
-**     modify it under the terms of the GNU General Public License as
-**     published by the Free Software Foundation; either version 2 of
-**     the License, or (at your option) any later version.
-**
-**     This package is distributed in the hope that it will be useful,
-**     but WITHOUT ANY WARRANTY; without even the implied warranty of
-**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-**     General Public License for more details.
-**     \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-#      include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-#      include <config.h>
-#endif
-
-#include "renderer_timecode.h"
-#include "workarea.h"
-#include <pangomm/layout.h>
-#include <pangomm/context.h>
-#include <pango/pango.h>
-#include "app.h"
-#include <cassert>
-
-#include "general.h"
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace synfig;
-using namespace studio;
-
-/* === M A C R O S ========================================================= */
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-Renderer_Timecode::~Renderer_Timecode()
-{
-}
-
-bool
-Renderer_Timecode::get_enabled_vfunc()const
-{
-       Canvas::Handle canvas(get_work_area()->get_canvas());
-       return (canvas->rend_desc().get_time_start()!=canvas->rend_desc().get_time_end() ||
-               canvas->get_time()!=canvas->rend_desc().get_time_start());
-}
-
-synfig::Vector
-Renderer_Timecode::get_grid_size()const
-{
-       return get_work_area()->get_grid_size();
-}
-
-void
-Renderer_Timecode::render_vfunc(
-       const Glib::RefPtr<Gdk::Drawable>& drawable,
-       const Gdk::Rectangle& /*expose_area*/
-)
-{
-       assert(get_work_area());
-       if(!get_work_area())
-               return;
-
-       //const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
-
-       const synfig::Vector focus_point(get_work_area()->get_focus_point());
-
-       //std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
-
-       int drawable_w,drawable_h;
-       drawable->get_size(drawable_w,drawable_h);
-
-       // Calculate the window coordinates of the top-left
-       // corner of the canvas.
-//     const synfig::Vector::value_type
-//             x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
-//             y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
-
-       /*const synfig::Vector::value_type window_startx(window_tl[0]);
-       const synfig::Vector::value_type window_endx(window_br[0]);
-       const synfig::Vector::value_type window_starty(window_tl[1]);
-       const synfig::Vector::value_type window_endy(window_br[1]);
-       */
-//     const int
-//             tile_w(get_work_area()->get_tile_w()),
-//             tile_h(get_work_area()->get_tile_h());
-
-//     const int
-//             w(get_w()),
-//             h(get_h());
-
-       Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
-
-       //const synfig::Vector grid_size(get_grid_size());
-
-//     const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
-//     const synfig::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
-//     const synfig::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
-//     const synfig::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
-//     const float pw(get_pw()),ph(get_ph());
-
-       Canvas::Handle canvas(get_work_area()->get_canvas());
-       synfig::Time cur_time(canvas->get_time());
-
-       // Print out the timecode
-       {
-               Glib::RefPtr<Pango::Layout> layout(Pango::Layout::create(get_work_area()->get_pango_context()));
-
-/*             Glib::ustring timecode(cur_time.get_string(rend_desc.get_frame_rate(),App::get_time_format()));
-
-               try
-               {
-                       timecode+="\n"+canvas->keyframe_list().find(cur_time)->get_description();
-                       gc->set_rgb_fg_color(Gdk::Color("#FF0000"));
-               }
-               catch(synfig::Exception::NotFound)
-               {
-                       return;
-                       gc->set_rgb_fg_color(Gdk::Color("#000000"));
-               }
-
-               layout->set_text(timecode);
-*/
-
-               gc->set_rgb_fg_color(Gdk::Color("#5f0000"));
-               try
-               {
-                       int w, h;
-                       layout->set_text(canvas->keyframe_list().find(cur_time)->get_description());
-                       layout->get_size(w, h);
-                       get_work_area()->timecode_width = int(w*1.0/Pango::SCALE);
-                       get_work_area()->timecode_height = int(h*1.0/Pango::SCALE);
-               }
-               catch(synfig::Exception::NotFound)
-               {
-                       get_work_area()->timecode_width = get_work_area()->timecode_height = 0;
-                       return;
-               }
-               catch(...) {
-                       assert(0);
-               }
-
-               drawable->draw_layout(gc, 4, 4, layout);
-       }
-}
diff --git a/synfig-studio/src/gui/renderer_timecode.h b/synfig-studio/src/gui/renderer_timecode.h
deleted file mode 100644 (file)
index cfd9a0b..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/* === S Y N F I G ========================================================= */
-/*!    \file renderer_timecode.h
-**     \brief Template Header
-**
-**     $Id$
-**
-**     \legal
-**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**
-**     This package is free software; you can redistribute it and/or
-**     modify it under the terms of the GNU General Public License as
-**     published by the Free Software Foundation; either version 2 of
-**     the License, or (at your option) any later version.
-**
-**     This package is distributed in the hope that it will be useful,
-**     but WITHOUT ANY WARRANTY; without even the implied warranty of
-**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-**     General Public License for more details.
-**     \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SYNFIG_RENDERER_TIMECODE_H
-#define __SYNFIG_RENDERER_TIMECODE_H
-
-/* === H E A D E R S ======================================================= */
-
-#include "workarearenderer.h"
-#include <vector>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace studio {
-
-class Renderer_Timecode : public studio::WorkAreaRenderer
-{
-
-public:
-       ~Renderer_Timecode();
-
-       synfig::Vector get_grid_size()const;
-
-       void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable,const Gdk::Rectangle& expose_area );
-
-protected:
-       bool get_enabled_vfunc()const;
-};
-
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
index 2ab1e13..7529452 100644 (file)
 #include "event_layerclick.h"
 #include "widgets/widget_color.h"
 #include <synfig/distance.h>
-#include "workarearenderer.h"
-
-#include "renderer_canvas.h"
-#include "renderer_grid.h"
-#include "renderer_guides.h"
-#include "renderer_timecode.h"
-#include "renderer_ducks.h"
-#include "renderer_dragbox.h"
-#include "renderer_bbox.h"
+
+#include "workarearenderer/workarearenderer.h"
+#include "workarearenderer/renderer_canvas.h"
+#include "workarearenderer/renderer_grid.h"
+#include "workarearenderer/renderer_guides.h"
+#include "workarearenderer/renderer_timecode.h"
+#include "workarearenderer/renderer_ducks.h"
+#include "workarearenderer/renderer_dragbox.h"
+#include "workarearenderer/renderer_bbox.h"
 #include "asyncrenderer.h"
 #include <gtkmm/frame.h>
 
diff --git a/synfig-studio/src/gui/workarearenderer.cpp b/synfig-studio/src/gui/workarearenderer.cpp
deleted file mode 100644 (file)
index 303bc03..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/* === S Y N F I G ========================================================= */
-/*!    \file workarearenderer.cpp
-**     \brief Template File
-**
-**     $Id$
-**
-**     \legal
-**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**
-**     This package is free software; you can redistribute it and/or
-**     modify it under the terms of the GNU General Public License as
-**     published by the Free Software Foundation; either version 2 of
-**     the License, or (at your option) any later version.
-**
-**     This package is distributed in the hope that it will be useful,
-**     but WITHOUT ANY WARRANTY; without even the implied warranty of
-**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-**     General Public License for more details.
-**     \endlegal
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-#      include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-#      include <config.h>
-#endif
-
-#include "workarearenderer.h"
-#include "workarea.h"
-
-#include "general.h"
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace synfig;
-using namespace studio;
-
-/* === M A C R O S ========================================================= */
-
-/* === G L O B A L S ======================================================= */
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-WorkAreaRenderer::WorkAreaRenderer():
-       enabled_(true),
-       priority_(0)
-{
-}
-
-WorkAreaRenderer::~WorkAreaRenderer()
-{
-}
-
-bool
-WorkAreaRenderer::get_enabled_vfunc()const
-{
-       return enabled_;
-}
-
-void
-WorkAreaRenderer::set_enabled(bool x)
-{
-       if(x==enabled_)
-               return;
-       enabled_=x;
-       signal_changed()();
-}
-
-void
-WorkAreaRenderer::set_priority(int x)
-{
-       if(x==priority_)
-               return;
-       priority_=x;
-       signal_changed()();
-}
-
-void
-WorkAreaRenderer::set_work_area(WorkArea* x)
-{
-       work_area_=x;
-}
-
-void
-WorkAreaRenderer::render_vfunc(
-       const Glib::RefPtr<Gdk::Drawable>& /*window*/,
-       const Gdk::Rectangle& /*expose_area*/
-)
-{
-}
-
-bool
-WorkAreaRenderer::event_vfunc(
-       GdkEvent* /*event*/
-)
-{
-       return false;
-}
-
-int
-WorkAreaRenderer::get_w()const
-{ return get_work_area()->get_w(); }
-int
-WorkAreaRenderer::get_h()const
-{ return get_work_area()->get_h(); }
-
-float
-WorkAreaRenderer::get_pw()const
-{ return get_work_area()->get_pw(); }
-float
-WorkAreaRenderer::get_ph()const
-{ return get_work_area()->get_ph(); }
-
-synfig::Point
-WorkAreaRenderer::screen_to_comp_coords(synfig::Point pos)const
-{
-       return get_work_area()->screen_to_comp_coords(pos);
-}
-
-synfig::Point
-WorkAreaRenderer::comp_to_screen_coords(synfig::Point pos)const
-{
-       return get_work_area()->comp_to_screen_coords(pos);
-}
diff --git a/synfig-studio/src/gui/workarearenderer.h b/synfig-studio/src/gui/workarearenderer.h
deleted file mode 100644 (file)
index fd79bb6..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/* === S Y N F I G ========================================================= */
-/*!    \file workarearenderer.h
-**     \brief Template Header
-**
-**     $Id$
-**
-**     \legal
-**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**
-**     This package is free software; you can redistribute it and/or
-**     modify it under the terms of the GNU General Public License as
-**     published by the Free Software Foundation; either version 2 of
-**     the License, or (at your option) any later version.
-**
-**     This package is distributed in the hope that it will be useful,
-**     but WITHOUT ANY WARRANTY; without even the implied warranty of
-**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-**     General Public License for more details.
-**     \endlegal
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SYNFIG_WORKAREARENDERER_H
-#define __SYNFIG_WORKAREARENDERER_H
-
-/* === H E A D E R S ======================================================= */
-
-#include <ETL/handle>
-#include <sigc++/signal.h>
-#include <sigc++/object.h>
-#include <synfig/vector.h>
-#include <gdkmm/drawable.h>
-#include <gdkmm/rectangle.h>
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace studio {
-class WorkArea;
-
-class WorkAreaRenderer : public etl::shared_object, public sigc::trackable
-{
-public:
-       typedef etl::handle<WorkAreaRenderer> Handle;
-       typedef etl::loose_handle<WorkAreaRenderer> LooseHandle;
-
-private:
-       bool enabled_;
-       int priority_;
-
-       sigc::signal<void> signal_changed_;
-
-       WorkArea* work_area_;
-
-public:
-
-       sigc::signal<void>& signal_changed() { return signal_changed_; }
-
-public:
-       int get_w()const;
-       int get_h()const;
-
-       float get_pw()const;
-       float get_ph()const;
-
-       //! Converts screen coords (ie: pixels) to composition coordinates
-       synfig::Point screen_to_comp_coords(synfig::Point pos)const;
-
-       //! Converts composition coordinates to screen coords (ie: pixels)
-       synfig::Point comp_to_screen_coords(synfig::Point pos)const;
-
-       WorkAreaRenderer();
-       virtual ~WorkAreaRenderer();
-
-       bool get_enabled()const { return get_enabled_vfunc(); }
-       int get_priority()const { return priority_; }
-       WorkArea* get_work_area()const { return work_area_; }
-
-       void set_enabled(bool x);
-       void set_priority(int x);
-       void set_work_area(WorkArea* work_area_);
-
-       virtual void render_vfunc(
-               const Glib::RefPtr<Gdk::Drawable>& window,
-               const Gdk::Rectangle& expose_area
-       );
-
-       virtual bool event_vfunc(
-               GdkEvent* event
-       );
-
-protected:
-
-       virtual bool get_enabled_vfunc()const;
-
-public:
-       bool operator<(const WorkAreaRenderer &rhs)
-               { return priority_<rhs.priority_; }
-};
-
-inline bool operator<(const WorkAreaRenderer::Handle &lhs,const WorkAreaRenderer::Handle &rhs)
-       { return lhs->get_priority() < rhs->get_priority(); }
-
-inline bool operator<(const WorkAreaRenderer::LooseHandle &lhs,const WorkAreaRenderer::LooseHandle &rhs)
-       { return lhs->get_priority() < rhs->get_priority(); }
-
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif
diff --git a/synfig-studio/src/gui/workarearenderer/renderer_bbox.cpp b/synfig-studio/src/gui/workarearenderer/renderer_bbox.cpp
new file mode 100644 (file)
index 0000000..727ad02
--- /dev/null
@@ -0,0 +1,144 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file renderer_bbox.cpp
+**     \brief Template File
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+#      include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+#      include <config.h>
+#endif
+
+#include "renderer_bbox.h"
+#include "workarea.h"
+#include "canvasview.h"
+#include "general.h"
+
+#endif
+
+/* === U S I N G =========================================================== */
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace studio;
+
+/* === M A C R O S ========================================================= */
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Renderer_BBox::Renderer_BBox()
+{
+}
+
+Renderer_BBox::~Renderer_BBox()
+{
+}
+
+const synfig::Rect&
+Renderer_BBox::get_bbox()
+{
+       return get_work_area()->get_canvas_view()->get_bbox();
+}
+
+void
+Renderer_BBox::render_vfunc(
+       const Glib::RefPtr<Gdk::Drawable>& drawable,
+       const Gdk::Rectangle& /*expose_area*/
+)
+{
+       assert(get_work_area());
+       if(!get_work_area())
+               return;
+
+//     const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
+
+       const synfig::Vector focus_point(get_work_area()->get_focus_point());
+
+//     std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
+
+       int drawable_w,drawable_h;
+       drawable->get_size(drawable_w,drawable_h);
+
+       // Calculate the window coordinates of the top-left
+       // corner of the canvas.
+//     const synfig::Vector::value_type
+//             x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
+//             y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
+
+       /*const synfig::Vector::value_type window_startx(window_tl[0]);
+       const synfig::Vector::value_type window_endx(window_br[0]);
+       const synfig::Vector::value_type window_starty(window_tl[1]);
+       const synfig::Vector::value_type window_endy(window_br[1]);
+       */
+//     const int
+//             tile_w(get_work_area()->get_tile_w()),
+//             tile_h(get_work_area()->get_tile_h());
+
+//     const int
+//             w(get_w()),
+//             h(get_h());
+
+       Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
+
+       //const synfig::Vector grid_size(get_grid_size());
+
+       const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
+//     const synfig::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
+       const synfig::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
+//     const synfig::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
+       const float pw(get_pw()),ph(get_ph());
+
+       const synfig::Point curr_point(get_bbox().get_min());
+       const synfig::Point drag_point(get_bbox().get_max());
+       if(get_bbox().area()<10000000000000000.0)
+       {
+               gc->set_function(Gdk::INVERT);
+               gc->set_rgb_fg_color(Gdk::Color("#FFFFFF"));
+               //gc->set_line_attributes(1,Gdk::LINE_ON_OFF_DASH,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+               gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+
+               Point tl(std::min(drag_point[0],curr_point[0]),std::min(drag_point[1],curr_point[1]));
+               Point br(std::max(drag_point[0],curr_point[0]),std::max(drag_point[1],curr_point[1]));
+
+               tl[0]=(tl[0]-window_startx)/pw;
+               tl[1]=(tl[1]-window_starty)/ph;
+               br[0]=(br[0]-window_startx)/pw;
+               br[1]=(br[1]-window_starty)/ph;
+               if(tl[0]>br[0])
+                       swap(tl[0],br[0]);
+               if(tl[1]>br[1])
+                       swap(tl[1],br[1]);
+
+               drawable->draw_rectangle(gc,false,
+                       round_to_int(tl[0]),
+                       round_to_int(tl[1]),
+                       round_to_int(br[0]-tl[0]),
+                       round_to_int(br[1]-tl[1])
+               );
+       }
+}
diff --git a/synfig-studio/src/gui/workarearenderer/renderer_bbox.h b/synfig-studio/src/gui/workarearenderer/renderer_bbox.h
new file mode 100644 (file)
index 0000000..d3d5952
--- /dev/null
@@ -0,0 +1,63 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file renderer_bbox.h
+**     \brief Template Header
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_RENDERER_BBOX_H
+#define __SYNFIG_RENDERER_BBOX_H
+
+/* === H E A D E R S ======================================================= */
+
+#include "workarearenderer.h"
+#include <vector>
+#include <synfig/vector.h>
+#include <synfig/rect.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace studio {
+
+class Renderer_BBox : public studio::WorkAreaRenderer
+{
+       synfig::Rect bbox;
+
+public:
+       Renderer_BBox();
+       ~Renderer_BBox();
+
+       const synfig::Rect& get_bbox();
+
+       void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable,const Gdk::Rectangle& expose_area );
+
+protected:
+       //bool get_enabled_vfunc()const;
+};
+
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
diff --git a/synfig-studio/src/gui/workarearenderer/renderer_canvas.cpp b/synfig-studio/src/gui/workarearenderer/renderer_canvas.cpp
new file mode 100644 (file)
index 0000000..9608079
--- /dev/null
@@ -0,0 +1,219 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file renderer_canvas.cpp
+**     \brief Template File
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007, 2008 Chris Moore
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+#      include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+#      include <config.h>
+#endif
+
+#include "renderer_canvas.h"
+#include "workarea.h"
+#include <ETL/misc>
+
+#include "general.h"
+
+#endif
+
+/* === U S I N G =========================================================== */
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace studio;
+
+/* === M A C R O S ========================================================= */
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Renderer_Canvas::~Renderer_Canvas()
+{
+}
+std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >&
+Renderer_Canvas::get_tile_book()
+{
+       return get_work_area()->get_tile_book();
+}
+
+bool
+Renderer_Canvas::get_full_frame()const
+{
+       return get_work_area()->get_full_frame();
+}
+
+int Renderer_Canvas::get_refreshes()const
+{
+       return get_work_area()->get_refreshes();
+}
+
+bool
+Renderer_Canvas::get_canceled()const
+{
+       return get_work_area()->get_canceled();
+}
+
+bool
+Renderer_Canvas::get_queued()const
+{
+       return get_work_area()->get_queued();
+}
+
+bool
+Renderer_Canvas::get_rendering()const
+{
+       return get_work_area()->get_rendering();
+}
+
+void
+Renderer_Canvas::render_vfunc(
+       const Glib::RefPtr<Gdk::Drawable>& drawable,
+       const Gdk::Rectangle& /*expose_area*/
+)
+{
+       assert(get_work_area());
+       if(!get_work_area())
+               return;
+
+//     const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
+
+       const synfig::Vector focus_point(get_work_area()->get_focus_point());
+
+       std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
+
+       int drawable_w,drawable_h;
+       drawable->get_size(drawable_w,drawable_h);
+
+       // Calculate the window coordinates of the top-left
+       // corner of the canvas.
+       const synfig::Vector::value_type
+               x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
+               y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
+
+       /*const synfig::Vector::value_type window_startx(window_tl[0]);
+       const synfig::Vector::value_type window_endx(window_br[0]);
+       const synfig::Vector::value_type window_starty(window_tl[1]);
+       const synfig::Vector::value_type window_endy(window_br[1]);
+       */
+       const int
+               tile_w(get_work_area()->get_tile_w()),
+               tile_h(get_work_area()->get_tile_h());
+
+       const int
+               w(get_w()),
+               h(get_h());
+
+       Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
+
+       if(!tile_book.empty())
+       {
+               if(get_full_frame())
+               {
+                       if(tile_book[0].first)
+                       {
+                               drawable->draw_pixbuf(
+                                       gc, //GC
+                                       tile_book[0].first, //pixbuf
+                                       0, 0,   // Source X and Y
+                                       round_to_int(x),round_to_int(y),        // Dest X and Y
+                                       -1,-1,  // Width and Height
+                                       Gdk::RGB_DITHER_MAX,            // RgbDither
+                                       2, 2 // Dither offset X and Y
+                                       );
+                       }
+                       if(tile_book[0].second!=get_refreshes() && get_canceled()==false && get_rendering()==false && get_queued()==false)
+                               get_work_area()->async_update_preview();
+               }
+               else
+               {
+                       int div = get_work_area()->get_low_res_pixel_size();
+                       const int width_in_tiles(w/tile_w+(((get_work_area()->get_low_resolution_flag())?((w/div)%(tile_w/div)):(w%tile_w))?1:0));
+                       const int height_in_tiles(h/tile_h+(h%tile_h?1:0));
+
+                       int u(0),v(0),tx,ty;
+                       int u1(0),v1(0),u2(width_in_tiles), v2(height_in_tiles);
+
+                       bool needs_refresh(false);
+
+                       u1=int(-x/tile_w);
+                       v1=int(-y/tile_h);
+                       u2=int((-x+drawable_w)/tile_w+1);
+                       v2=int((-y+drawable_h)/tile_h+1);
+                       if(u2>width_in_tiles)u2=width_in_tiles;
+                       if(v2>height_in_tiles)v2=height_in_tiles;
+                       if(u1<0)u1=0;
+                       if(v1<0)v1=0;
+
+                       for(v=v1;v<v2;v++)
+                       {
+                               for(u=u1;u<u2;u++)
+                               {
+                                       int index=v*width_in_tiles+u;
+                                       if(int(tile_book.size())>index && tile_book[index].first)
+                                       {
+                                               tx=u*tile_w;
+                                               ty=v*tile_w;
+
+                                               drawable->draw_pixbuf(
+                                                       gc, //GC
+                                                       tile_book[index].first, //pixbuf
+                                                       0, 0,   // Source X and Y
+                                                       round_to_int(x)+tx,round_to_int(y)+ty,  // Dest X and Y
+                                                       -1,-1,  // Width and Height
+                                                       Gdk::RGB_DITHER_MAX,            // RgbDither
+                                                       2, 2 // Dither offset X and Y
+                                                       );
+                                       }
+                                       if(tile_book[index].second!=get_refreshes())
+                                               needs_refresh=true;
+                               }
+                       }
+                       if(needs_refresh==true && get_canceled()==false && get_rendering()==false && get_queued()==false)
+                       {
+                               //queue_render_preview();
+                               get_work_area()->async_update_preview();
+                               //update_preview();
+                               //return true;
+                       }
+
+               }
+       }
+
+       // Draw the border around the rendered region
+       {
+               gc->set_rgb_fg_color(Gdk::Color("#000000"));
+               gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+               drawable->draw_rectangle(
+                       gc,
+                       false,  // Fill?
+                       round_to_int(x),round_to_int(y),        // x,y
+                       w,h     //w,h
+               );
+       }
+}
diff --git a/synfig-studio/src/gui/workarearenderer/renderer_canvas.h b/synfig-studio/src/gui/workarearenderer/renderer_canvas.h
new file mode 100644 (file)
index 0000000..ad2509e
--- /dev/null
@@ -0,0 +1,63 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file renderer_canvas.h
+**     \brief Template Header
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_RENDERER_CANVAS_H
+#define __SYNFIG_RENDERER_CANVAS_H
+
+/* === H E A D E R S ======================================================= */
+
+#include "workarearenderer.h"
+#include <vector>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace studio {
+
+class Renderer_Canvas : public studio::WorkAreaRenderer
+{
+
+public:
+       ~Renderer_Canvas();
+
+       std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& get_tile_book();
+
+       bool get_full_frame()const;
+
+       int get_refreshes()const;
+       bool get_canceled()const;
+       bool get_queued()const;
+       bool get_rendering()const;
+
+       void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable,const Gdk::Rectangle& expose_area );
+};
+
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
diff --git a/synfig-studio/src/gui/workarearenderer/renderer_dragbox.cpp b/synfig-studio/src/gui/workarearenderer/renderer_dragbox.cpp
new file mode 100644 (file)
index 0000000..a177154
--- /dev/null
@@ -0,0 +1,154 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file renderer_dragbox.cpp
+**     \brief Template File
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+#      include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+#      include <config.h>
+#endif
+
+#include "renderer_dragbox.h"
+#include "workarea.h"
+#include <ETL/misc>
+
+#include "general.h"
+
+#endif
+
+/* === U S I N G =========================================================== */
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace studio;
+
+/* === M A C R O S ========================================================= */
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Renderer_Dragbox::~Renderer_Dragbox()
+{
+}
+
+const synfig::Point&
+Renderer_Dragbox::get_drag_point()const
+{
+       return get_work_area()->get_drag_point();
+}
+
+const synfig::Point&
+Renderer_Dragbox::get_curr_point()const
+{
+       return get_work_area()->get_cursor_pos();
+}
+
+bool
+Renderer_Dragbox::get_enabled_vfunc()const
+{
+       return get_work_area()->get_dragging_mode()==WorkArea::DRAG_BOX;
+}
+
+
+void
+Renderer_Dragbox::render_vfunc(
+       const Glib::RefPtr<Gdk::Drawable>& drawable,
+       const Gdk::Rectangle& /*expose_area*/
+)
+{
+       assert(get_work_area());
+       if(!get_work_area())
+               return;
+
+       // const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
+
+       const synfig::Vector focus_point(get_work_area()->get_focus_point());
+
+//     std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
+
+       int drawable_w,drawable_h;
+       drawable->get_size(drawable_w,drawable_h);
+
+       // Calculate the window coordinates of the top-left
+       // corner of the canvas.
+       // const synfig::Vector::value_type
+       //      x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
+       //      y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
+
+       /*const synfig::Vector::value_type window_startx(window_tl[0]);
+       const synfig::Vector::value_type window_endx(window_br[0]);
+       const synfig::Vector::value_type window_starty(window_tl[1]);
+       const synfig::Vector::value_type window_endy(window_br[1]);
+       */
+       // const int
+       //      tile_w(get_work_area()->get_tile_w()),
+       //      tile_h(get_work_area()->get_tile_h());
+
+       // const int
+       //      w(get_w()),
+       //      h(get_h());
+
+       Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
+
+       //const synfig::Vector grid_size(get_grid_size());
+
+       const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
+       // const synfig::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
+       const synfig::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
+       // const synfig::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
+       const float pw(get_pw()),ph(get_ph());
+
+       const synfig::Point& curr_point(get_curr_point());
+       const synfig::Point& drag_point(get_drag_point());
+
+       {
+               gc->set_function(Gdk::COPY);
+               gc->set_rgb_fg_color(Gdk::Color("#000000"));
+               gc->set_line_attributes(1,Gdk::LINE_ON_OFF_DASH,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+               //gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+
+               Point tl(std::min(drag_point[0],curr_point[0]),std::min(drag_point[1],curr_point[1]));
+               Point br(std::max(drag_point[0],curr_point[0]),std::max(drag_point[1],curr_point[1]));
+
+               tl[0]=(tl[0]-window_startx)/pw;
+               tl[1]=(tl[1]-window_starty)/ph;
+               br[0]=(br[0]-window_startx)/pw;
+               br[1]=(br[1]-window_starty)/ph;
+               if(tl[0]>br[0])
+                       swap(tl[0],br[0]);
+               if(tl[1]>br[1])
+                       swap(tl[1],br[1]);
+
+               drawable->draw_rectangle(gc,false,
+                       round_to_int(tl[0]),
+                       round_to_int(tl[1]),
+                       round_to_int(br[0]-tl[0]),
+                       round_to_int(br[1]-tl[1])
+               );
+       }
+}
diff --git a/synfig-studio/src/gui/workarearenderer/renderer_dragbox.h b/synfig-studio/src/gui/workarearenderer/renderer_dragbox.h
new file mode 100644 (file)
index 0000000..497b903
--- /dev/null
@@ -0,0 +1,61 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file renderer_dragbox.h
+**     \brief Template Header
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_RENDERER_DRAGBOX_H
+#define __SYNFIG_RENDERER_DRAGBOX_H
+
+/* === H E A D E R S ======================================================= */
+
+#include "workarearenderer.h"
+#include <vector>
+#include <synfig/vector.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace studio {
+
+class Renderer_Dragbox : public studio::WorkAreaRenderer
+{
+
+public:
+       ~Renderer_Dragbox();
+
+       void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable,const Gdk::Rectangle& expose_area );
+
+       const synfig::Point& get_drag_point()const;
+       const synfig::Point& get_curr_point()const;
+
+protected:
+       bool get_enabled_vfunc()const;
+};
+
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
diff --git a/synfig-studio/src/gui/workarearenderer/renderer_ducks.cpp b/synfig-studio/src/gui/workarearenderer/renderer_ducks.cpp
new file mode 100644 (file)
index 0000000..5ad88cb
--- /dev/null
@@ -0,0 +1,489 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file renderer_ducks.cpp
+**     \brief Template File
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007, 2008 Chris Moore
+**  Copyright (c) 2008 Gerald Young
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+#      include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+#      include <config.h>
+#endif
+
+#include "renderer_ducks.h"
+#include "workarea.h"
+#include "duckmatic.h"
+#include <ETL/bezier>
+#include <ETL/misc>
+#include "widgets/widget_color.h"
+#include <synfig/distance.h>
+#include "app.h"
+
+#include "general.h"
+
+#endif
+
+/* === U S I N G =========================================================== */
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace studio;
+
+/* === M A C R O S ========================================================= */
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Renderer_Ducks::~Renderer_Ducks()
+{
+}
+
+/*
+bool
+Renderer_Ducks::get_enabled_vfunc()const
+{
+       return get_work_area()->grid_status();
+}
+*/
+
+struct ScreenDuck
+{
+       synfig::Point pos;
+       Gdk::Color color;
+       bool selected;
+       bool hover;
+       Real width;
+
+       ScreenDuck():width(0) { }
+};
+
+void
+Renderer_Ducks::render_vfunc(
+       const Glib::RefPtr<Gdk::Drawable>& drawable,
+       const Gdk::Rectangle& /*expose_area*/
+)
+{
+       assert(get_work_area());
+       if(!get_work_area())
+               return;
+
+       const synfig::Vector focus_point(get_work_area()->get_focus_point());
+
+
+       int drawable_w,drawable_h;
+       drawable->get_size(drawable_w,drawable_h);
+
+       Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
+
+
+       const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
+       const synfig::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
+
+       const float pw(get_pw()),ph(get_ph());
+
+       const std::list<etl::handle<Duckmatic::Bezier> >& bezier_list(get_work_area()->bezier_list());
+       const bool solid_lines(get_work_area()->solid_lines);
+
+       const std::list<handle<Duckmatic::Stroke> >& stroke_list(get_work_area()->stroke_list());
+
+       Glib::RefPtr<Pango::Layout> layout(Pango::Layout::create(get_work_area()->get_pango_context()));
+
+       // Render the strokes
+       for(std::list<handle<Duckmatic::Stroke> >::const_iterator iter=stroke_list.begin();iter!=stroke_list.end();++iter)
+       {
+               Point window_start(window_startx,window_starty);
+               vector<Gdk::Point> points;
+               std::list<synfig::Point>::iterator iter2;
+               Point holder;
+
+               for(iter2=(*iter)->stroke_data->begin();iter2!=(*iter)->stroke_data->end();++iter2)
+               {
+                       holder=*iter2-window_start;
+                       holder[0]/=pw;holder[1]/=ph;
+                       points.push_back(Gdk::Point(round_to_int(holder[0]),round_to_int(holder[1])));
+               }
+
+               gc->set_rgb_fg_color(colorconv_synfig2gdk((*iter)->color));
+               gc->set_function(Gdk::COPY);
+               gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+
+               // Draw the stroke
+               drawable->draw_lines(gc, Glib::ArrayHandle<Gdk::Point>(points));
+       }
+
+
+
+       // Render the beziers
+       for(std::list<handle<Duckmatic::Bezier> >::const_iterator iter=bezier_list.begin();iter!=bezier_list.end();++iter)
+       {
+               Point window_start(window_startx,window_starty);
+               Point p1((*iter)->p1->get_trans_point()-window_start);
+               Point p2((*iter)->p2->get_trans_point()-window_start);
+               Point c1((*iter)->c1->get_trans_point()-window_start);
+               Point c2((*iter)->c2->get_trans_point()-window_start);
+               p1[0]/=pw;p1[1]/=ph;
+               p2[0]/=pw;p2[1]/=ph;
+               c1[0]/=pw;c1[1]/=ph;
+               c2[0]/=pw;c2[1]/=ph;
+               bezier<Point> curve(p1,c1,c2,p2);
+               vector<Gdk::Point> points;
+
+               float f;
+               Point pt;
+               for(f=0;f<1.0;f+=1.0/17.0)
+               {
+                       pt=curve(f);
+                       points.push_back(Gdk::Point(round_to_int(pt[0]),round_to_int(pt[1])));
+               }
+               points.push_back(Gdk::Point(round_to_int(p2[0]),round_to_int(p2[1])));
+
+               // Draw the curve
+/*             if(solid_lines)
+               {
+                       gc->set_rgb_fg_color(DUCK_COLOR_BEZIER_1);
+                       gc->set_function(Gdk::COPY);
+                       gc->set_line_attributes(3,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+                       drawable->draw_lines(gc, Glib::ArrayHandle<Gdk::Point>(points));
+                       gc->set_rgb_fg_color(DUCK_COLOR_BEZIER_2);
+                       gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+                       drawable->draw_lines(gc, Glib::ArrayHandle<Gdk::Point>(points));
+               }
+               else
+*/
+               {
+//                     gc->set_rgb_fg_color(Gdk::Color("#ffffff"));
+//                     gc->set_function(Gdk::INVERT);
+//                     gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+//                     drawable->draw_lines(gc, Glib::ArrayHandle<Gdk::Point>(points));
+                       gc->set_rgb_fg_color(DUCK_COLOR_BEZIER_1);
+                       gc->set_function(Gdk::COPY);
+                       gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+                       drawable->draw_lines(gc, Glib::ArrayHandle<Gdk::Point>(points));
+                       gc->set_rgb_fg_color(DUCK_COLOR_BEZIER_2);
+                       gc->set_line_attributes(1,Gdk::LINE_ON_OFF_DASH,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+                       drawable->draw_lines(gc, Glib::ArrayHandle<Gdk::Point>(points));
+
+               }
+       }
+
+
+       const DuckList duck_list(get_work_area()->get_duck_list());
+       //Gtk::StateType state = Gtk::STATE_ACTIVE;
+       Gtk::ShadowType shadow=Gtk::SHADOW_OUT;
+       std::list<ScreenDuck> screen_duck_list;
+       const float radius((abs(pw)+abs(ph))*4);
+
+       etl::handle<Duck> hover_duck(get_work_area()->find_duck(get_work_area()->get_cursor_pos(),radius, get_work_area()->get_type_mask()));
+
+       // Render the ducks
+       for(std::list<handle<Duck> >::const_iterator iter=duck_list.begin();iter!=duck_list.end();++iter)
+       {
+
+               // If this type of duck has been masked, then skip it
+               if((*iter)->get_type() && (!(get_work_area()->get_type_mask() & (*iter)->get_type())))
+                       continue;
+
+//             Real x,y;
+       //      Gdk::Rectangle area;
+               Point sub_trans_point((*iter)->get_sub_trans_point());
+               Point sub_trans_origin((*iter)->get_sub_trans_origin());
+
+               if (App::restrict_radius_ducks &&
+                       (*iter)->is_radius())
+               {
+                       if (sub_trans_point[0] < sub_trans_origin[0])
+                               sub_trans_point[0] = sub_trans_origin[0];
+                       if (sub_trans_point[1] < sub_trans_origin[1])
+                               sub_trans_point[1] = sub_trans_origin[1];
+               }
+
+               Point point((*iter)->get_transform_stack().perform(sub_trans_point));
+               Point origin((*iter)->get_transform_stack().perform(sub_trans_origin));
+
+               point[0]=(point[0]-window_startx)/pw;
+               point[1]=(point[1]-window_starty)/ph;
+
+               bool has_connect(false);
+               if((*iter)->get_tangent() || (*iter)->get_type()&Duck::TYPE_ANGLE)
+               {
+                       has_connect=true;
+               }
+               if((*iter)->get_connect_duck())
+               {
+                       has_connect=true;
+                       origin=(*iter)->get_connect_duck()->get_trans_point();
+               }
+
+               origin[0]=(origin[0]-window_startx)/pw;
+               origin[1]=(origin[1]-window_starty)/ph;
+
+               bool selected(get_work_area()->duck_is_selected(*iter));
+               bool hover(*iter==hover_duck || (*iter)->get_hover());
+
+               shadow = selected?Gtk::SHADOW_IN:Gtk::SHADOW_OUT;
+
+               if(get_work_area()->get_selected_value_node())
+               {
+                       synfigapp::ValueDesc value_desc((*iter)->get_value_desc());
+                       if (value_desc.is_valid() &&
+                               ((value_desc.is_value_node()            && get_work_area()->get_selected_value_node() == value_desc.get_value_node()) ||
+                                (value_desc.parent_is_value_node()     && get_work_area()->get_selected_value_node() == value_desc.get_parent_value_node())))
+                       {
+                               gc->set_function(Gdk::COPY);
+                               gc->set_rgb_fg_color(DUCK_COLOR_SELECTED);
+                               //gc->set_line_attributes(1,Gdk::LINE_ON_OFF_DASH,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+                               gc->set_line_attributes(2,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+
+                               drawable->draw_rectangle(gc,false,
+                                       round_to_int(point[0]-5),
+                                       round_to_int(point[1]-5),
+                                       10,
+                                       10
+                               );
+                       }
+
+               }
+
+               if((*iter)->get_box_duck())
+               {
+                       Point boxpoint((*iter)->get_box_duck()->get_trans_point());
+                       boxpoint[0]=(boxpoint[0]-window_startx)/pw;
+                       boxpoint[1]=(boxpoint[1]-window_starty)/ph;
+                       Point tl(min(point[0],boxpoint[0]),min(point[1],boxpoint[1]));
+
+                       gc->set_function(Gdk::COPY);
+                       gc->set_rgb_fg_color(DUCK_COLOR_BOX_1);
+                       gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+                       drawable->draw_rectangle(gc,false,
+                               round_to_int(tl[0]),
+                               round_to_int(tl[1]),
+                               round_to_int(abs(boxpoint[0]-point[0])),
+                               round_to_int(abs(boxpoint[1]-point[1]))
+                       );
+                       gc->set_function(Gdk::COPY);
+                       gc->set_rgb_fg_color(DUCK_COLOR_BOX_2);
+                       gc->set_line_attributes(1,Gdk::LINE_ON_OFF_DASH,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+                       drawable->draw_rectangle(gc,false,
+                               round_to_int(tl[0]),
+                               round_to_int(tl[1]),
+                               round_to_int(abs(boxpoint[0]-point[0])),
+                               round_to_int(abs(boxpoint[1]-point[1]))
+                       );
+               }
+
+               ScreenDuck screen_duck;
+               screen_duck.pos=point;
+               screen_duck.selected=selected;
+               screen_duck.hover=hover;
+
+               if(!(*iter)->get_editable())
+                       screen_duck.color=(DUCK_COLOR_NOT_EDITABLE);
+               else if((*iter)->get_tangent())
+                       screen_duck.color=((*iter)->get_scalar()<0 ? DUCK_COLOR_TANGENT_1 : DUCK_COLOR_TANGENT_2);
+               else if((*iter)->get_type()&Duck::TYPE_VERTEX)
+                       screen_duck.color=DUCK_COLOR_VERTEX;
+               else if((*iter)->get_type()&Duck::TYPE_RADIUS)
+                       screen_duck.color=DUCK_COLOR_RADIUS;
+               else if((*iter)->get_type()&Duck::TYPE_WIDTH)
+                       screen_duck.color=DUCK_COLOR_WIDTH;
+               else if((*iter)->get_type()&Duck::TYPE_ANGLE)
+                       screen_duck.color=(DUCK_COLOR_ANGLE);
+               else
+                       screen_duck.color=DUCK_COLOR_OTHER;
+
+               screen_duck_list.push_front(screen_duck);
+
+               if(has_connect)
+               {
+                       if(solid_lines)
+                       {
+                               gc->set_line_attributes(3,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+                               gc->set_rgb_fg_color(DUCK_COLOR_CONNECT_OUTSIDE);
+                               gc->set_function(Gdk::COPY);
+                               drawable->draw_line(gc, (int)origin[0],(int)origin[1],(int)(point[0]),(int)(point[1]));
+                               gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+                               gc->set_rgb_fg_color(DUCK_COLOR_CONNECT_INSIDE);
+                               drawable->draw_line(gc, (int)origin[0],(int)origin[1],(int)(point[0]),(int)(point[1]));
+                       }
+                       else
+                       {
+//                             gc->set_rgb_fg_color(Gdk::Color("#ffffff"));
+//                             gc->set_function(Gdk::INVERT);
+//                             drawable->draw_line(gc, (int)origin[0],(int)origin[1],(int)(point[0]),(int)(point[1]));
+                               gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+                               gc->set_rgb_fg_color(DUCK_COLOR_CONNECT_OUTSIDE);
+                               gc->set_function(Gdk::COPY);
+                               drawable->draw_line(gc, (int)origin[0],(int)origin[1],(int)(point[0]),(int)(point[1]));
+                               gc->set_line_attributes(1,Gdk::LINE_ON_OFF_DASH,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+                               gc->set_rgb_fg_color(DUCK_COLOR_CONNECT_INSIDE);
+                               drawable->draw_line(gc, (int)origin[0],(int)origin[1],(int)(point[0]),(int)(point[1]));
+                       }
+               }
+
+               if((*iter)->is_radius())
+               {
+                       const Real mag((point-origin).mag());
+                       const int d(round_to_int(mag*2));
+                       const int x(round_to_int(origin[0]-mag));
+                       const int y(round_to_int(origin[1]-mag));
+
+                       if(solid_lines)
+                       {
+                               gc->set_rgb_fg_color(Gdk::Color("#000000"));
+                               gc->set_function(Gdk::COPY);
+                               gc->set_line_attributes(3,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+                               drawable->draw_arc(
+                                       gc,
+                                       false,
+                                       x,
+                                       y,
+                                       d,
+                                       d,
+                                       0,
+                                       360*64
+                               );
+                               gc->set_rgb_fg_color(Gdk::Color("#afafaf"));
+                       }
+                       else
+                       {
+                               gc->set_rgb_fg_color(Gdk::Color("#ffffff"));
+                               gc->set_function(Gdk::INVERT);
+                       }
+                       gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+
+                       drawable->draw_arc(
+                               gc,
+                               false,
+                               x,
+                               y,
+                               d,
+                               d,
+                               0,
+                               360*64
+                       );
+
+                       if(hover)
+                       {
+                               Real mag;
+                               if (App::restrict_radius_ducks)
+                               {
+                                       Point sub_trans_point((*iter)->get_sub_trans_point());
+                                       Point sub_trans_origin((*iter)->get_sub_trans_origin());
+
+                                       if (sub_trans_point[0] < sub_trans_origin[0])
+                                               sub_trans_point[0] = sub_trans_origin[0];
+                                       if (sub_trans_point[1] < sub_trans_origin[1])
+                                               sub_trans_point[1] = sub_trans_origin[1];
+
+                                       Point point((*iter)->get_transform_stack().perform(sub_trans_point));
+                                       Point origin((*iter)->get_transform_stack().perform(sub_trans_origin));
+
+                                       mag = (point-origin).mag();
+                               }
+                               else
+                                       mag = ((*iter)->get_trans_point()-(*iter)->get_trans_origin()).mag();
+
+                               Distance real_mag(mag, Distance::SYSTEM_UNITS);
+                               real_mag.convert(App::distance_system,get_work_area()->get_rend_desc());
+                               layout->set_text(real_mag.get_string());
+
+                               gc->set_rgb_fg_color(DUCK_COLOR_WIDTH_TEXT_1);
+                               drawable->draw_layout(
+                                       gc,
+                                       round_to_int(point[0])+1+6,
+                                       round_to_int(point[1])+1-8,
+                                       layout
+                               );
+                               gc->set_rgb_fg_color(DUCK_COLOR_WIDTH_TEXT_2);
+                               drawable->draw_layout(
+                                       gc,
+                                       round_to_int(point[0])+6,
+                                       round_to_int(point[1])-8,
+                                       layout
+                               );
+                       }
+
+               }
+
+       }
+
+
+       for(;screen_duck_list.size();screen_duck_list.pop_front())
+       {
+               int radius=4;
+               int outline=1;
+               Gdk::Color color(screen_duck_list.front().color);
+
+               if(!screen_duck_list.front().selected)
+               {
+                       color.set_red(color.get_red()*2/3);
+                       color.set_green(color.get_green()*2/3);
+                       color.set_blue(color.get_blue()*2/3);
+               }
+
+               if(screen_duck_list.front().hover && !screen_duck_list.back().hover && screen_duck_list.size()>1)
+               {
+                       screen_duck_list.push_back(screen_duck_list.front());
+                       continue;
+               }
+
+               if(screen_duck_list.front().hover)
+               {
+                       radius+=2;
+                       outline++;
+               }
+
+               gc->set_function(Gdk::COPY);
+               gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+               gc->set_rgb_fg_color(DUCK_COLOR_OUTLINE);
+               drawable->draw_arc(
+                       gc,
+                       true,
+                       round_to_int(screen_duck_list.front().pos[0]-radius),
+                       round_to_int(screen_duck_list.front().pos[1]-radius),
+                       radius*2,
+                       radius*2,
+                       0,
+                       360*64
+               );
+
+
+               gc->set_rgb_fg_color(color);
+
+               drawable->draw_arc(
+                       gc,
+                       true,
+                       round_to_int(screen_duck_list.front().pos[0]-radius+outline),
+                       round_to_int(screen_duck_list.front().pos[1]-radius+outline),
+                       radius*2-outline*2,
+                       radius*2-outline*2,
+                       0,
+                       360*64
+               );
+       }
+}
diff --git a/synfig-studio/src/gui/workarearenderer/renderer_ducks.h b/synfig-studio/src/gui/workarearenderer/renderer_ducks.h
new file mode 100644 (file)
index 0000000..32a6efd
--- /dev/null
@@ -0,0 +1,84 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file renderer_ducks.h
+**     \brief Template Header
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007 Chris Moore
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_RENDERER_DUCKS_H
+#define __SYNFIG_RENDERER_DUCKS_H
+
+/* === H E A D E R S ======================================================= */
+
+#include "workarearenderer.h"
+#include <vector>
+
+/* === M A C R O S ========================================================= */
+
+#define DUCK_COLOR_NOT_EDITABLE        Gdk::Color("#cfcfcf")
+
+#define DUCK_COLOR_ANGLE               Gdk::Color("#0000ff")
+#define DUCK_COLOR_RADIUS              Gdk::Color("#00ffff")
+#define DUCK_COLOR_TANGENT_1   Gdk::Color("#ffff00")
+#define DUCK_COLOR_TANGENT_2   Gdk::Color("#ff0000")
+#define DUCK_COLOR_VERTEX              Gdk::Color("#ff7f00")
+#define DUCK_COLOR_WIDTH               Gdk::Color("#ff00ff")
+#define DUCK_COLOR_OTHER               Gdk::Color("#00ff00")
+
+#define DUCK_COLOR_OUTLINE             Gdk::Color("#000000") // the outline around each duck
+
+#define DUCK_COLOR_BEZIER_1            Gdk::Color("#000000") // the 2 colors used to draw bezier curves
+#define DUCK_COLOR_BEZIER_2            Gdk::Color("#afafaf")
+
+#define DUCK_COLOR_BOX_1               Gdk::Color("#ffffff") // the 2 colors used to draw boxes
+#define DUCK_COLOR_BOX_2               Gdk::Color("#000000")
+
+#define DUCK_COLOR_SELECTED            Gdk::Color("#ff0000") // the color of the box drawn when a valuenode is selected
+
+#define DUCK_COLOR_CONNECT_INSIDE      Gdk::Color("#9fefef") // the color of the inside of the line connecting a vertex duck to the tangent ducks
+#define DUCK_COLOR_CONNECT_OUTSIDE     Gdk::Color("#000000") // the color of the outside of the line connecting a vertex duck to the tangent ducks
+
+#define DUCK_COLOR_WIDTH_TEXT_1        Gdk::Color("#000000") // the color of the text's shadow when hovering over a width duck
+#define DUCK_COLOR_WIDTH_TEXT_2        Gdk::Color("#ff00ff") // the color of the text when hovering over a width duck
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace studio {
+
+class Renderer_Ducks : public studio::WorkAreaRenderer
+{
+
+public:
+       ~Renderer_Ducks();
+
+       void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable,const Gdk::Rectangle& expose_area );
+
+protected:
+//     bool get_enabled_vfunc()const;
+};
+
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
diff --git a/synfig-studio/src/gui/workarearenderer/renderer_grid.cpp b/synfig-studio/src/gui/workarearenderer/renderer_grid.cpp
new file mode 100644 (file)
index 0000000..b00a593
--- /dev/null
@@ -0,0 +1,173 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file renderer_grid.cpp
+**     \brief Template File
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+#      include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+#      include <config.h>
+#endif
+
+#include "renderer_grid.h"
+#include "workarea.h"
+#include <ETL/misc>
+
+#include "general.h"
+
+#endif
+
+/* === U S I N G =========================================================== */
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace studio;
+
+/* === M A C R O S ========================================================= */
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Renderer_Grid::~Renderer_Grid()
+{
+}
+
+bool
+Renderer_Grid::get_enabled_vfunc()const
+{
+       return get_work_area()->grid_status();
+}
+
+synfig::Vector
+Renderer_Grid::get_grid_size()const
+{
+       return get_work_area()->get_grid_size();
+}
+
+void
+Renderer_Grid::render_vfunc(
+       const Glib::RefPtr<Gdk::Drawable>& drawable,
+       const Gdk::Rectangle& /*expose_area*/
+)
+{
+       assert(get_work_area());
+       if(!get_work_area())
+               return;
+
+//     const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
+
+       const synfig::Vector focus_point(get_work_area()->get_focus_point());
+
+//     std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
+
+       int drawable_w,drawable_h;
+       drawable->get_size(drawable_w,drawable_h);
+
+       // Calculate the window coordinates of the top-left
+       // corner of the canvas.
+//     const synfig::Vector::value_type
+//             x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
+//             y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
+
+       /*const synfig::Vector::value_type window_startx(window_tl[0]);
+       const synfig::Vector::value_type window_endx(window_br[0]);
+       const synfig::Vector::value_type window_starty(window_tl[1]);
+       const synfig::Vector::value_type window_endy(window_br[1]);
+       */
+//     const int
+//             tile_w(get_work_area()->get_tile_w()),
+//             tile_h(get_work_area()->get_tile_h());
+
+//     const int
+//             w(get_w()),
+//             h(get_h());
+
+       Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
+
+       const synfig::Vector grid_size(get_grid_size());
+
+       const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
+       const synfig::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
+       const synfig::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
+       const synfig::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
+       const float pw(get_pw()),ph(get_ph());
+
+       // Draw out the grid
+       if(grid_size[0]>pw*3.5 && grid_size[1]>ph*3.5)
+       {
+               synfig::Vector::value_type x,y;
+
+               x=floor(window_startx/grid_size[0])*grid_size[0];
+               y=floor(window_starty/grid_size[1])*grid_size[1];
+
+               gc->set_function(Gdk::COPY);
+               gc->set_rgb_fg_color(Gdk::Color("#9f9f9f"));
+               gc->set_line_attributes(1,Gdk::LINE_ON_OFF_DASH,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+
+               if(x<window_endx)
+                       for(;x<window_endx;x+=grid_size[0])
+                       {
+                               drawable->draw_line(gc,
+                                       round_to_int((x-window_startx)/pw),
+                                       0,
+                                       round_to_int((x-window_startx)/pw),
+                                       drawable_h
+                               );
+                       }
+               else
+                       for(;x>window_endx;x-=grid_size[0])
+                       {
+                               drawable->draw_line(gc,
+                                       round_to_int((x-window_startx)/pw),
+                                       0,
+                                       round_to_int((x-window_startx)/pw),
+                                       drawable_h
+                               );
+                       }
+
+               if(y<window_endy)
+                       for(;y<window_endy;y+=grid_size[1])
+                       {
+                               drawable->draw_line(gc,
+                                       0,
+                                       round_to_int((y-window_starty)/ph),
+                                       drawable_w,
+                                       round_to_int((y-window_starty)/ph)
+                               );
+                       }
+               else
+                       for(;y>window_endy;y-=grid_size[1])
+                       {
+                               drawable->draw_line(gc,
+                                       0,
+                                       round_to_int((y-window_starty)/ph),
+                                       drawable_w,
+                                       round_to_int((y-window_starty)/ph)
+                               );
+                       }
+       }
+}
diff --git a/synfig-studio/src/gui/workarearenderer/renderer_grid.h b/synfig-studio/src/gui/workarearenderer/renderer_grid.h
new file mode 100644 (file)
index 0000000..9cb96c4
--- /dev/null
@@ -0,0 +1,59 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file renderer_grid.h
+**     \brief Template Header
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_RENDERER_GRID_H
+#define __SYNFIG_RENDERER_GRID_H
+
+/* === H E A D E R S ======================================================= */
+
+#include "workarearenderer.h"
+#include <vector>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace studio {
+
+class Renderer_Grid : public studio::WorkAreaRenderer
+{
+
+public:
+       ~Renderer_Grid();
+
+       synfig::Vector get_grid_size()const;
+
+       void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable,const Gdk::Rectangle& expose_area );
+
+protected:
+       bool get_enabled_vfunc()const;
+};
+
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
diff --git a/synfig-studio/src/gui/workarearenderer/renderer_guides.cpp b/synfig-studio/src/gui/workarearenderer/renderer_guides.cpp
new file mode 100644 (file)
index 0000000..c1f5d9f
--- /dev/null
@@ -0,0 +1,284 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file renderer_guides.cpp
+**     \brief Template File
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+#      include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+#      include <config.h>
+#endif
+
+#include "renderer_guides.h"
+#include "workarea.h"
+#include <ETL/misc>
+
+#include "general.h"
+
+#endif
+
+/* === U S I N G =========================================================== */
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace studio;
+
+/* === M A C R O S ========================================================= */
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Renderer_Guides::Renderer_Guides():
+       dragging(false)
+{
+
+}
+
+Renderer_Guides::~Renderer_Guides()
+{
+}
+
+bool
+Renderer_Guides::get_enabled_vfunc()const
+{
+       return get_work_area()->get_show_guides();
+}
+
+std::list<float>&
+Renderer_Guides::get_guide_list_x()
+{
+       return get_work_area()->get_guide_list_x();
+}
+
+std::list<float>&
+Renderer_Guides::get_guide_list_y()
+{
+       return get_work_area()->get_guide_list_y();
+}
+
+bool
+Renderer_Guides::event_vfunc(GdkEvent* event)
+{
+       synfig::Point mouse_pos;
+       // float bezier_click_pos;
+       // const float radius((abs(get_pw())+abs(get_ph()))*4);
+       int button_pressed(0);
+       float pressure(0);
+       bool is_mouse(false);
+       Gdk::ModifierType modifier(Gdk::ModifierType(0));
+
+       // Handle input stuff
+       if(
+               event->any.type==GDK_MOTION_NOTIFY ||
+               event->any.type==GDK_BUTTON_PRESS ||
+               event->any.type==GDK_2BUTTON_PRESS ||
+               event->any.type==GDK_3BUTTON_PRESS ||
+               event->any.type==GDK_BUTTON_RELEASE
+       )
+       {
+               GdkDevice *device;
+               if(event->any.type==GDK_MOTION_NOTIFY)
+               {
+                       device=event->motion.device;
+                       modifier=Gdk::ModifierType(event->motion.state);
+               }
+               else
+               {
+                       device=event->button.device;
+                       modifier=Gdk::ModifierType(event->button.state);
+               }
+
+               // Make sure we recognize the device
+               /*if(curr_input_device)
+               {
+                       if(curr_input_device!=device)
+                       {
+                               assert(device);
+                               curr_input_device=device;
+                               signal_input_device_changed()(curr_input_device);
+                       }
+               }
+               else*/ if(device)
+               {
+                       //curr_input_device=device;
+                       //signal_input_device_changed()(curr_input_device);
+               }
+
+               //assert(curr_input_device);
+
+               // Calculate the position of the
+               // input device in canvas coordinates
+               // and the buttons
+               if(!event->button.axes)
+               {
+                       mouse_pos=synfig::Point(screen_to_comp_coords(synfig::Point(event->button.x,event->button.y)));
+                       button_pressed=event->button.button;
+                       pressure=1.0f;
+                       is_mouse=true;
+                       if(isnan(event->button.x) || isnan(event->button.y))
+                               return false;
+               }
+               else
+               {
+                       double x(event->button.axes[0]);
+                       double y(event->button.axes[1]);
+                       if(isnan(x) || isnan(y))
+                               return false;
+
+                       pressure=event->button.axes[2];
+                       //synfig::info("pressure=%f",pressure);
+                       pressure-=0.04f;
+                       pressure/=1.0f-0.04f;
+
+
+                       assert(!isnan(pressure));
+
+                       mouse_pos=synfig::Point(screen_to_comp_coords(synfig::Point(x,y)));
+
+                       button_pressed=event->button.button;
+
+                       if(button_pressed==1 && pressure<0 && (event->any.type!=GDK_BUTTON_RELEASE && event->any.type!=GDK_BUTTON_PRESS))
+                               button_pressed=0;
+                       if(pressure<0)
+                               pressure=0;
+
+                       //if(event->any.type==GDK_BUTTON_PRESS && button_pressed)
+                       //      synfig::info("Button pressed on input device = %d",event->button.button);
+
+                       //if(event->button.axes[2]>0.1)
+                       //      button_pressed=1;
+                       //else
+                       //      button_pressed=0;
+               }
+       }
+       switch(event->type)
+    {
+       case GDK_BUTTON_PRESS:
+               break;
+       case GDK_MOTION_NOTIFY:
+               break;
+       case GDK_BUTTON_RELEASE:
+               break;
+       default:
+               break;
+       }
+
+       return false;
+}
+
+void
+Renderer_Guides::render_vfunc(
+       const Glib::RefPtr<Gdk::Drawable>& drawable,
+       const Gdk::Rectangle& /*expose_area*/
+)
+{
+       assert(get_work_area());
+       if(!get_work_area())
+               return;
+
+       // const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
+
+       const synfig::Vector focus_point(get_work_area()->get_focus_point());
+
+       //std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
+
+       int drawable_w,drawable_h;
+       drawable->get_size(drawable_w,drawable_h);
+
+       // Calculate the window coordinates of the top-left
+       // corner of the canvas.
+       // const synfig::Vector::value_type
+       //      x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
+       //      y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
+
+       /*const synfig::Vector::value_type window_startx(window_tl[0]);
+       const synfig::Vector::value_type window_endx(window_br[0]);
+       const synfig::Vector::value_type window_starty(window_tl[1]);
+       const synfig::Vector::value_type window_endy(window_br[1]);
+       */
+       // const int
+       //      tile_w(get_work_area()->get_tile_w()),
+       //      tile_h(get_work_area()->get_tile_h());
+
+       // const int
+       //      w(get_w()),
+       //      h(get_h());
+
+       Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
+
+       //const synfig::Vector grid_size(get_grid_size());
+
+       const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
+       // const synfig::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
+       const synfig::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
+       // const synfig::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
+       const float pw(get_pw()),ph(get_ph());
+
+       // Draw out the guides
+       {
+               gc->set_function(Gdk::COPY);
+               gc->set_rgb_fg_color(Gdk::Color("#9f9fff"));
+               gc->set_line_attributes(1,Gdk::LINE_ON_OFF_DASH,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
+
+               Duckmatic::GuideList::const_iterator iter;
+
+               // vertical
+               for(iter=get_guide_list_x().begin();iter!=get_guide_list_x().end();++iter)
+               {
+                       const float x((*iter-window_startx)/pw);
+
+                       if(iter==get_work_area()->curr_guide)
+                               gc->set_rgb_fg_color(Gdk::Color("#ff6f6f"));
+                       else
+                               gc->set_rgb_fg_color(Gdk::Color("#6f6fff"));
+
+                       drawable->draw_line(gc,
+                               round_to_int(x),
+                               0,
+                               round_to_int(x),
+                               drawable_h
+                       );
+               }
+               // horizontal
+               for(iter=get_guide_list_y().begin();iter!=get_guide_list_y().end();++iter)
+               {
+                       const float y((*iter-window_starty)/ph);
+
+                       if(iter==get_work_area()->curr_guide)
+                               gc->set_rgb_fg_color(Gdk::Color("#ff6f6f"));
+                       else
+                               gc->set_rgb_fg_color(Gdk::Color("#6f6fff"));
+
+                       drawable->draw_line(gc,
+                               0,
+                               round_to_int(y),
+                               drawable_w,
+                               round_to_int(y)
+                       );
+               }
+       }
+}
diff --git a/synfig-studio/src/gui/workarearenderer/renderer_guides.h b/synfig-studio/src/gui/workarearenderer/renderer_guides.h
new file mode 100644 (file)
index 0000000..d7c7ce0
--- /dev/null
@@ -0,0 +1,62 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file renderer_guides.h
+**     \brief Template Header
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_RENDERER_GUIDES_H
+#define __SYNFIG_RENDERER_GUIDES_H
+
+/* === H E A D E R S ======================================================= */
+
+#include "workarearenderer.h"
+#include <vector>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace studio {
+
+class Renderer_Guides : public studio::WorkAreaRenderer
+{
+       bool dragging;
+public:
+       Renderer_Guides();
+       ~Renderer_Guides();
+
+       std::list<float>& get_guide_list_x();
+       std::list<float>& get_guide_list_y();
+
+       void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable,const Gdk::Rectangle& expose_area );
+       bool event_vfunc(GdkEvent* event);
+
+protected:
+       bool get_enabled_vfunc()const;
+};
+
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
diff --git a/synfig-studio/src/gui/workarearenderer/renderer_timecode.cpp b/synfig-studio/src/gui/workarearenderer/renderer_timecode.cpp
new file mode 100644 (file)
index 0000000..48cc42b
--- /dev/null
@@ -0,0 +1,169 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file renderer_timecode.cpp
+**     \brief Template File
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007 Chris Moore
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+#      include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+#      include <config.h>
+#endif
+
+#include "renderer_timecode.h"
+#include "workarea.h"
+#include <pangomm/layout.h>
+#include <pangomm/context.h>
+#include <pango/pango.h>
+#include "app.h"
+#include <cassert>
+
+#include "general.h"
+
+#endif
+
+/* === U S I N G =========================================================== */
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace studio;
+
+/* === M A C R O S ========================================================= */
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Renderer_Timecode::~Renderer_Timecode()
+{
+}
+
+bool
+Renderer_Timecode::get_enabled_vfunc()const
+{
+       Canvas::Handle canvas(get_work_area()->get_canvas());
+       return (canvas->rend_desc().get_time_start()!=canvas->rend_desc().get_time_end() ||
+               canvas->get_time()!=canvas->rend_desc().get_time_start());
+}
+
+synfig::Vector
+Renderer_Timecode::get_grid_size()const
+{
+       return get_work_area()->get_grid_size();
+}
+
+void
+Renderer_Timecode::render_vfunc(
+       const Glib::RefPtr<Gdk::Drawable>& drawable,
+       const Gdk::Rectangle& /*expose_area*/
+)
+{
+       assert(get_work_area());
+       if(!get_work_area())
+               return;
+
+       //const synfig::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
+
+       const synfig::Vector focus_point(get_work_area()->get_focus_point());
+
+       //std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
+
+       int drawable_w,drawable_h;
+       drawable->get_size(drawable_w,drawable_h);
+
+       // Calculate the window coordinates of the top-left
+       // corner of the canvas.
+//     const synfig::Vector::value_type
+//             x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
+//             y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
+
+       /*const synfig::Vector::value_type window_startx(window_tl[0]);
+       const synfig::Vector::value_type window_endx(window_br[0]);
+       const synfig::Vector::value_type window_starty(window_tl[1]);
+       const synfig::Vector::value_type window_endy(window_br[1]);
+       */
+//     const int
+//             tile_w(get_work_area()->get_tile_w()),
+//             tile_h(get_work_area()->get_tile_h());
+
+//     const int
+//             w(get_w()),
+//             h(get_h());
+
+       Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
+
+       //const synfig::Vector grid_size(get_grid_size());
+
+//     const synfig::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
+//     const synfig::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
+//     const synfig::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
+//     const synfig::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
+//     const float pw(get_pw()),ph(get_ph());
+
+       Canvas::Handle canvas(get_work_area()->get_canvas());
+       synfig::Time cur_time(canvas->get_time());
+
+       // Print out the timecode
+       {
+               Glib::RefPtr<Pango::Layout> layout(Pango::Layout::create(get_work_area()->get_pango_context()));
+
+/*             Glib::ustring timecode(cur_time.get_string(rend_desc.get_frame_rate(),App::get_time_format()));
+
+               try
+               {
+                       timecode+="\n"+canvas->keyframe_list().find(cur_time)->get_description();
+                       gc->set_rgb_fg_color(Gdk::Color("#FF0000"));
+               }
+               catch(synfig::Exception::NotFound)
+               {
+                       return;
+                       gc->set_rgb_fg_color(Gdk::Color("#000000"));
+               }
+
+               layout->set_text(timecode);
+*/
+
+               gc->set_rgb_fg_color(Gdk::Color("#5f0000"));
+               try
+               {
+                       int w, h;
+                       layout->set_text(canvas->keyframe_list().find(cur_time)->get_description());
+                       layout->get_size(w, h);
+                       get_work_area()->timecode_width = int(w*1.0/Pango::SCALE);
+                       get_work_area()->timecode_height = int(h*1.0/Pango::SCALE);
+               }
+               catch(synfig::Exception::NotFound)
+               {
+                       get_work_area()->timecode_width = get_work_area()->timecode_height = 0;
+                       return;
+               }
+               catch(...) {
+                       assert(0);
+               }
+
+               drawable->draw_layout(gc, 4, 4, layout);
+       }
+}
diff --git a/synfig-studio/src/gui/workarearenderer/renderer_timecode.h b/synfig-studio/src/gui/workarearenderer/renderer_timecode.h
new file mode 100644 (file)
index 0000000..cfd9a0b
--- /dev/null
@@ -0,0 +1,59 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file renderer_timecode.h
+**     \brief Template Header
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_RENDERER_TIMECODE_H
+#define __SYNFIG_RENDERER_TIMECODE_H
+
+/* === H E A D E R S ======================================================= */
+
+#include "workarearenderer.h"
+#include <vector>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace studio {
+
+class Renderer_Timecode : public studio::WorkAreaRenderer
+{
+
+public:
+       ~Renderer_Timecode();
+
+       synfig::Vector get_grid_size()const;
+
+       void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable,const Gdk::Rectangle& expose_area );
+
+protected:
+       bool get_enabled_vfunc()const;
+};
+
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
diff --git a/synfig-studio/src/gui/workarearenderer/workarearenderer.cpp b/synfig-studio/src/gui/workarearenderer/workarearenderer.cpp
new file mode 100644 (file)
index 0000000..303bc03
--- /dev/null
@@ -0,0 +1,134 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file workarearenderer.cpp
+**     \brief Template File
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+#      include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+#      include <config.h>
+#endif
+
+#include "workarearenderer.h"
+#include "workarea.h"
+
+#include "general.h"
+
+#endif
+
+/* === U S I N G =========================================================== */
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace studio;
+
+/* === M A C R O S ========================================================= */
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+WorkAreaRenderer::WorkAreaRenderer():
+       enabled_(true),
+       priority_(0)
+{
+}
+
+WorkAreaRenderer::~WorkAreaRenderer()
+{
+}
+
+bool
+WorkAreaRenderer::get_enabled_vfunc()const
+{
+       return enabled_;
+}
+
+void
+WorkAreaRenderer::set_enabled(bool x)
+{
+       if(x==enabled_)
+               return;
+       enabled_=x;
+       signal_changed()();
+}
+
+void
+WorkAreaRenderer::set_priority(int x)
+{
+       if(x==priority_)
+               return;
+       priority_=x;
+       signal_changed()();
+}
+
+void
+WorkAreaRenderer::set_work_area(WorkArea* x)
+{
+       work_area_=x;
+}
+
+void
+WorkAreaRenderer::render_vfunc(
+       const Glib::RefPtr<Gdk::Drawable>& /*window*/,
+       const Gdk::Rectangle& /*expose_area*/
+)
+{
+}
+
+bool
+WorkAreaRenderer::event_vfunc(
+       GdkEvent* /*event*/
+)
+{
+       return false;
+}
+
+int
+WorkAreaRenderer::get_w()const
+{ return get_work_area()->get_w(); }
+int
+WorkAreaRenderer::get_h()const
+{ return get_work_area()->get_h(); }
+
+float
+WorkAreaRenderer::get_pw()const
+{ return get_work_area()->get_pw(); }
+float
+WorkAreaRenderer::get_ph()const
+{ return get_work_area()->get_ph(); }
+
+synfig::Point
+WorkAreaRenderer::screen_to_comp_coords(synfig::Point pos)const
+{
+       return get_work_area()->screen_to_comp_coords(pos);
+}
+
+synfig::Point
+WorkAreaRenderer::comp_to_screen_coords(synfig::Point pos)const
+{
+       return get_work_area()->comp_to_screen_coords(pos);
+}
diff --git a/synfig-studio/src/gui/workarearenderer/workarearenderer.h b/synfig-studio/src/gui/workarearenderer/workarearenderer.h
new file mode 100644 (file)
index 0000000..fd79bb6
--- /dev/null
@@ -0,0 +1,116 @@
+/* === S Y N F I G ========================================================= */
+/*!    \file workarearenderer.h
+**     \brief Template Header
+**
+**     $Id$
+**
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
+**
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
+**     \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_WORKAREARENDERER_H
+#define __SYNFIG_WORKAREARENDERER_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <ETL/handle>
+#include <sigc++/signal.h>
+#include <sigc++/object.h>
+#include <synfig/vector.h>
+#include <gdkmm/drawable.h>
+#include <gdkmm/rectangle.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace studio {
+class WorkArea;
+
+class WorkAreaRenderer : public etl::shared_object, public sigc::trackable
+{
+public:
+       typedef etl::handle<WorkAreaRenderer> Handle;
+       typedef etl::loose_handle<WorkAreaRenderer> LooseHandle;
+
+private:
+       bool enabled_;
+       int priority_;
+
+       sigc::signal<void> signal_changed_;
+
+       WorkArea* work_area_;
+
+public:
+
+       sigc::signal<void>& signal_changed() { return signal_changed_; }
+
+public:
+       int get_w()const;
+       int get_h()const;
+
+       float get_pw()const;
+       float get_ph()const;
+
+       //! Converts screen coords (ie: pixels) to composition coordinates
+       synfig::Point screen_to_comp_coords(synfig::Point pos)const;
+
+       //! Converts composition coordinates to screen coords (ie: pixels)
+       synfig::Point comp_to_screen_coords(synfig::Point pos)const;
+
+       WorkAreaRenderer();
+       virtual ~WorkAreaRenderer();
+
+       bool get_enabled()const { return get_enabled_vfunc(); }
+       int get_priority()const { return priority_; }
+       WorkArea* get_work_area()const { return work_area_; }
+
+       void set_enabled(bool x);
+       void set_priority(int x);
+       void set_work_area(WorkArea* work_area_);
+
+       virtual void render_vfunc(
+               const Glib::RefPtr<Gdk::Drawable>& window,
+               const Gdk::Rectangle& expose_area
+       );
+
+       virtual bool event_vfunc(
+               GdkEvent* event
+       );
+
+protected:
+
+       virtual bool get_enabled_vfunc()const;
+
+public:
+       bool operator<(const WorkAreaRenderer &rhs)
+               { return priority_<rhs.priority_; }
+};
+
+inline bool operator<(const WorkAreaRenderer::Handle &lhs,const WorkAreaRenderer::Handle &rhs)
+       { return lhs->get_priority() < rhs->get_priority(); }
+
+inline bool operator<(const WorkAreaRenderer::LooseHandle &lhs,const WorkAreaRenderer::LooseHandle &rhs)
+       { return lhs->get_priority() < rhs->get_priority(); }
+
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif