Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / stable / src / gtkmm / renderer_timecode.cpp
index 2910a98..48cc42b 100644 (file)
@@ -6,6 +6,7 @@
 **
 **     \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
@@ -37,6 +38,8 @@
 #include "app.h"
 #include <cassert>
 
+#include "general.h"
+
 #endif
 
 /* === U S I N G =========================================================== */
@@ -75,7 +78,7 @@ Renderer_Timecode::get_grid_size()const
 void
 Renderer_Timecode::render_vfunc(
        const Glib::RefPtr<Gdk::Drawable>& drawable,
-       const Gdk::Rectangle& expose_area
+       const Gdk::Rectangle& /*expose_area*/
 )
 {
        assert(get_work_area());
@@ -146,10 +149,15 @@ Renderer_Timecode::render_vfunc(
                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(...) {