Add the code to setup an instance of the keyframe list handler.
authorCarlos Lopez <carlos@pcnuevo.(none)>
Fri, 17 Jul 2009 17:57:15 +0000 (19:57 +0200)
committerCarlos Lopez <carlos@pcnuevo.(none)>
Fri, 17 Jul 2009 17:57:15 +0000 (19:57 +0200)
synfig-studio/trunk/src/gtkmm/dock_timetrack.cpp
synfig-studio/trunk/src/gtkmm/dock_timetrack.h
synfig-studio/trunk/src/gtkmm/widget_keyframe_list.cpp
synfig-studio/trunk/src/gtkmm/widget_keyframe_list.h

index a0f7fca..956c9e1 100644 (file)
@@ -43,6 +43,7 @@
 #include "layerparamtreestore.h"
 #include "workarea.h"
 #include "widget_timeslider.h"
+#include "widget_keyframe_list.h"
 #include "layerparamtreestore.h"
 #include "general.h"
 #include <synfig/timepointcollect.h>
@@ -405,6 +406,7 @@ Dock_Timetrack::Dock_Timetrack():
 {
        table_=0;
        widget_timeslider_= new Widget_Timeslider();
+       widget_kf_list_= new Widget_Keyframe_List();
 
        int header_height = 0;
        if(getenv("SYNFIG_TIMETRACK_HEADER_HEIGHT"))
@@ -413,6 +415,8 @@ Dock_Timetrack::Dock_Timetrack():
                header_height = 22;
 
        widget_timeslider_->set_size_request(-1,header_height);
+       widget_kf_list_->set_size_request(-1,header_height);
+
        hscrollbar_=new Gtk::HScrollbar();
        vscrollbar_=new Gtk::VScrollbar();
 }
@@ -423,6 +427,7 @@ Dock_Timetrack::~Dock_Timetrack()
        delete hscrollbar_;
        delete vscrollbar_;
        delete widget_timeslider_;
+       delete widget_kf_list_;
 }
 
 void
@@ -493,14 +498,20 @@ Dock_Timetrack::changed_canvas_view_vfunc(etl::loose_handle<CanvasView> canvas_v
 
                assert(tree_view);
 
+
                widget_timeslider_->set_time_adjustment(&canvas_view->time_adjustment());
                widget_timeslider_->set_bounds_adjustment(&canvas_view->time_window_adjustment());
                widget_timeslider_->set_global_fps(canvas_view->get_canvas()->rend_desc().get_frame_rate());
 
+               widget_kf_list_->set_time_adjustment(&canvas_view->time_adjustment());
+               widget_kf_list_->set_fps(canvas_view->get_canvas()->rend_desc().get_frame_rate());
+               widget_kf_list_->set_kf_list(canvas_view->get_canvas()->keyframe_list());
+
                vscrollbar_->set_adjustment(*tree_view->get_vadjustment());
                hscrollbar_->set_adjustment(canvas_view->time_window_adjustment());
                table_=new Gtk::Table(2,2);
                table_->attach(*widget_timeslider_, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK);
+               table_->attach(*widget_kf_list_, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK);
                table_->attach(*tree_view, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
                table_->attach(*hscrollbar_, 0, 1, 2, 3, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK);
                table_->attach(*vscrollbar_, 1, 2, 0, 2, Gtk::FILL|Gtk::SHRINK, Gtk::FILL|Gtk::EXPAND);
index d103d9a..9da19fd 100644 (file)
@@ -6,6 +6,7 @@
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**  Copyright (c) 2009 Carlos López
 **
 **     This package is free software; you can redistribute it and/or
 **     modify it under the terms of the GNU General Public License as
 
 namespace studio {
 class Widget_Timeslider;
+class Widget_Keyframe_List;
 
 class Dock_Timetrack : public Dock_CanvasSpecific
 {
        Gtk::HScrollbar* hscrollbar_;
        Gtk::VScrollbar* vscrollbar_;
        Widget_Timeslider* widget_timeslider_;
+       Widget_Keyframe_List* widget_kf_list_;
        Gtk::Table* table_;
 
 protected:
@@ -59,7 +62,7 @@ public:
 
        Dock_Timetrack();
        ~Dock_Timetrack();
-}; // END of Dock_Keyframes
+}; // END of Dock_Timetrack
 
 }; // END of namespace studio
 
index d3269de..e0669c4 100644 (file)
@@ -218,7 +218,7 @@ Widget_Keyframe_List::on_event(GdkEvent *event)
                                t = floor(t*fps + 0.5)/fps;
                        }
                bool stat=perform_move_kf();
-               synfig::info("Dropping keyframe at: %s", t.get_string());
+               synfig::info("Dropping keyframe at: %s", t.get_string().c_str());
                return stat;
                }
        default:
@@ -245,3 +245,14 @@ void Widget_Keyframe_List::set_time_adjustment(Gtk::Adjustment *x)
                time_other_change = x->signal_changed().connect(sigc::mem_fun(*this,&Widget_Keyframe_List::queue_draw));
        }
 }
+
+void
+Widget_Keyframe_List::set_fps(float d)
+{
+       if(fps != d)
+       {
+               fps = d;
+               //update everything since we need to redraw already
+               queue_draw();
+       }
+}
index 3b83722..2acef1c 100644 (file)
@@ -52,7 +52,8 @@ class Widget_Keyframe_List : public Gtk::DrawingArea
        synfig::KeyframeList kf_list_;
 
        //! The frames per second of the canvas
-       synfig::Time fps;
+       float fps;
+
        //!True if it is editable. Keyframes can be moved.
        bool editable_;
 
@@ -105,6 +106,9 @@ public:
        //! Set the time adjustment and proper connects its change signals
        void set_time_adjustment(Gtk::Adjustment *x);
 
+       //! Set the fps
+       void set_fps(float x);
+
        //! Performs the keyframe movement. Returns true if it was sucessful
        bool perform_move_kf();