Module: synfig
Branch: morevna
Commit: d9145bee28dfd34a12ff9c5d43f9fc850bd15c61
URL:    
http://synfig.git.sourceforge.net/git/gitweb.cgi?p=synfig;a=commit;h=d9145bee28dfd34a12ff9c5d43f9fc850bd15c61

Author: Carlos Lopez <car...@pcnuevo.(none)>
Date:   Fri Jul 17 19:57:15 2009 +0200

Add the code to setup an instance of the keyframe list handler.

---

 synfig-studio/trunk/src/gtkmm/dock_timetrack.cpp   |   11 +++++++++++
 synfig-studio/trunk/src/gtkmm/dock_timetrack.h     |    5 ++++-
 .../trunk/src/gtkmm/widget_keyframe_list.cpp       |   13 ++++++++++++-
 .../trunk/src/gtkmm/widget_keyframe_list.h         |    6 +++++-
 4 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/synfig-studio/trunk/src/gtkmm/dock_timetrack.cpp 
b/synfig-studio/trunk/src/gtkmm/dock_timetrack.cpp
index a0f7fca..956c9e1 100644
--- a/synfig-studio/trunk/src/gtkmm/dock_timetrack.cpp
+++ b/synfig-studio/trunk/src/gtkmm/dock_timetrack.cpp
@@ -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);
diff --git a/synfig-studio/trunk/src/gtkmm/dock_timetrack.h 
b/synfig-studio/trunk/src/gtkmm/dock_timetrack.h
index d103d9a..9da19fd 100644
--- a/synfig-studio/trunk/src/gtkmm/dock_timetrack.h
+++ b/synfig-studio/trunk/src/gtkmm/dock_timetrack.h
@@ -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
@@ -40,12 +41,14 @@
 
 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
 
diff --git a/synfig-studio/trunk/src/gtkmm/widget_keyframe_list.cpp 
b/synfig-studio/trunk/src/gtkmm/widget_keyframe_list.cpp
index d3269de..e0669c4 100644
--- a/synfig-studio/trunk/src/gtkmm/widget_keyframe_list.cpp
+++ b/synfig-studio/trunk/src/gtkmm/widget_keyframe_list.cpp
@@ -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();
+       }
+}
diff --git a/synfig-studio/trunk/src/gtkmm/widget_keyframe_list.h 
b/synfig-studio/trunk/src/gtkmm/widget_keyframe_list.h
index 3b83722..2acef1c 100644
--- a/synfig-studio/trunk/src/gtkmm/widget_keyframe_list.h
+++ b/synfig-studio/trunk/src/gtkmm/widget_keyframe_list.h
@@ -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();
 


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Synfig-devl mailing list
Synfig-devl@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to