1 /* === S I N F G =========================================================== */
3 ** \brief Template File
5 ** $Id: renderer_timecode.cpp,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
8 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
14 ** You may not copy, print, publish, or in any
15 ** other way distribute this software without
16 ** a prior written agreement with
17 ** the copyright holder.
20 /* ========================================================================= */
22 /* === H E A D E R S ======================================================= */
31 #include "renderer_timecode.h"
33 #include <pangomm/layout.h>
34 #include <pangomm/context.h>
35 #include <pango/pango.h>
40 /* === U S I N G =========================================================== */
44 using namespace sinfg;
45 using namespace studio;
47 /* === M A C R O S ========================================================= */
49 /* === G L O B A L S ======================================================= */
51 /* === P R O C E D U R E S ================================================= */
53 /* === M E T H O D S ======================================================= */
55 Renderer_Timecode::~Renderer_Timecode()
60 Renderer_Timecode::get_enabled_vfunc()const
62 Canvas::Handle canvas(get_work_area()->get_canvas());
63 return (canvas->rend_desc().get_time_start()!=canvas->rend_desc().get_time_end() ||
64 canvas->get_time()!=canvas->rend_desc().get_time_start());
68 Renderer_Timecode::get_grid_size()const
70 return get_work_area()->get_grid_size();
74 Renderer_Timecode::render_vfunc(
75 const Glib::RefPtr<Gdk::Drawable>& drawable,
76 const Gdk::Rectangle& expose_area
79 assert(get_work_area());
83 //const sinfg::RendDesc &rend_desc(get_work_area()->get_canvas()->rend_desc());
85 const sinfg::Vector focus_point(get_work_area()->get_focus_point());
87 //std::vector< std::pair<Glib::RefPtr<Gdk::Pixbuf>,int> >& tile_book(get_tile_book());
89 int drawable_w,drawable_h;
90 drawable->get_size(drawable_w,drawable_h);
92 // Calculate the window coordinates of the top-left
93 // corner of the canvas.
94 // const sinfg::Vector::value_type
95 // x(focus_point[0]/get_pw()+drawable_w/2-get_w()/2),
96 // y(focus_point[1]/get_ph()+drawable_h/2-get_h()/2);
98 /*const sinfg::Vector::value_type window_startx(window_tl[0]);
99 const sinfg::Vector::value_type window_endx(window_br[0]);
100 const sinfg::Vector::value_type window_starty(window_tl[1]);
101 const sinfg::Vector::value_type window_endy(window_br[1]);
104 // tile_w(get_work_area()->get_tile_w()),
105 // tile_h(get_work_area()->get_tile_h());
111 Glib::RefPtr<Gdk::GC> gc(Gdk::GC::create(drawable));
113 //const sinfg::Vector grid_size(get_grid_size());
115 // const sinfg::Vector::value_type window_startx(get_work_area()->get_window_tl()[0]);
116 // const sinfg::Vector::value_type window_endx(get_work_area()->get_window_br()[0]);
117 // const sinfg::Vector::value_type window_starty(get_work_area()->get_window_tl()[1]);
118 // const sinfg::Vector::value_type window_endy(get_work_area()->get_window_br()[1]);
119 // const float pw(get_pw()),ph(get_ph());
121 Canvas::Handle canvas(get_work_area()->get_canvas());
122 sinfg::Time cur_time(canvas->get_time());
124 // Print out the timecode
126 Glib::RefPtr<Pango::Layout> layout(Pango::Layout::create(get_work_area()->get_pango_context()));
128 /* Glib::ustring timecode(cur_time.get_string(rend_desc.get_frame_rate(),App::get_time_format()));
132 timecode+="\n"+canvas->keyframe_list().find(cur_time)->get_description();
133 gc->set_rgb_fg_color(Gdk::Color("#FF0000"));
135 catch(sinfg::Exception::NotFound)
138 gc->set_rgb_fg_color(Gdk::Color("#000000"));
141 layout->set_text(timecode);
144 gc->set_rgb_fg_color(Gdk::Color("#5f0000"));
147 layout->set_text(canvas->keyframe_list().find(cur_time)->get_description());
149 catch(sinfg::Exception::NotFound)
154 drawable->draw_layout(gc, 4, 4, layout);