Module: synfig Branch: testing Commit: e6ab4a9a493de43a3f2f27d18c179f681d35926d URL: http://synfig.git.sourceforge.net/git/gitweb.cgi?p=synfig;a=commit;h=e6ab4a9a493de43a3f2f27d18c179f681d35926d
Author: Carlos Lopez <car...@pcnuevo.(none)> Date: Tue Jul 21 00:16:57 2009 +0200 Test commit. Do not use --- .../trunk/src/gtkmm/widget_keyframe_list.cpp | 98 ++++++++++++++------ 1 files changed, 71 insertions(+), 27 deletions(-) diff --git a/synfig-studio/trunk/src/gtkmm/widget_keyframe_list.cpp b/synfig-studio/trunk/src/gtkmm/widget_keyframe_list.cpp index d31810a..fb9e4ba 100644 --- a/synfig-studio/trunk/src/gtkmm/widget_keyframe_list.cpp +++ b/synfig-studio/trunk/src/gtkmm/widget_keyframe_list.cpp @@ -33,7 +33,7 @@ #include "widget_keyframe_list.h" #include "app.h" -#include <gtkmm/menu.h> +//#include <gtkmm/menu.h> #include <synfig/exception.h> #include <ETL/misc> @@ -72,6 +72,8 @@ Widget_Keyframe_List::Widget_Keyframe_List(): //! left button motion add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); add_events(Gdk::BUTTON1_MOTION_MASK); + add_events(Gdk::POINTER_MOTION_MASK); + set_time_adjustment(&adj_default); } @@ -221,7 +223,6 @@ Widget_Keyframe_List::on_event(GdkEvent *event) if(pos>1.0f)pos=1.0f; //! The time where the event x is synfig::Time t((float)(bottom+pos*(top-bottom))); - //Do not respond mouse events if the list is empty if(!kf_list_->size()) { @@ -232,18 +233,64 @@ Widget_Keyframe_List::on_event(GdkEvent *event) //! here the guts of the event switch(event->type) { + case GDK_ENTER_NOTIFY: + synfig::info("Enter Notify"); + break; case GDK_MOTION_NOTIFY: if(editable_) { - // stick to integer frames. It can be optional in the future - if(fps) + // here is captured mouse motion + // AND left mouse button pressed + if (event->motion.state & GDK_BUTTON1_MASK) + { + + // stick to integer frames. It can be optional in the future + if(fps) t = floor(t*fps + 0.5)/fps; + dragging_kf_time=t; + dragging_=true; + queue_draw(); + return true; + } + // here is captured mouse motion + // AND NOT left mouse button pressed + else + { +/* + synfig::Time p_t,n_t; + kf_list_->find_prev_next(t, p_t, n_t); + synfig::info("tiempo $s", t.get_string()); + synfig::info("previo $s", p_t.get_string()); + synfig::info("prox $s", n_t.get_string()); + if( (p_t==Time::begin() && n_t==Time::end()) + || + ((t-p_t)>time_ratio && (n_t-t)>time_ratio) + ) + { + synfig::info("tiempo $s", t.get_string()); + synfig::info("previo $s", p_t.get_string()); + synfig::info("prox $s", n_t.get_string()); + synfig::info("Click and drag keyframes"); + } + //else if ((t-prev_t)<(next_t-t)) + { + + synfig::Keyframe kf(*kf_list_->find_prev(t)); + synfig::String kf_name(kf.get_description().c_str()); + synfig::info("Decription: %s", kf_name); + } + + else { - t = floor(t*fps + 0.5)/fps; + //String kf_name=(kf_list_->find_next(t))->get_description(); + //synfig::info("Decription: %s", kf_name); + synfig::info("Name keyframes"); } - dragging_kf_time=t; - dragging_=true; - queue_draw(); - return true; +*/ + dragging_=false; + queue_draw(); + return true; + } + } break; case GDK_BUTTON_PRESS: @@ -251,45 +298,45 @@ Widget_Keyframe_List::on_event(GdkEvent *event) dragging_=false; if(event->button.button==1) { - /*synfig::info("Looking keyframe at %s", t.get_string().c_str()); - synfig::info("Total amount of keyframes %i", kf_list_->size()); - synfig::info("Time ratio %s",time_ratio.get_string().c_str()); - synfig::info("Bottom %s",bottom.get_string().c_str()); - synfig::info("Top %s",top.get_string().c_str());*/ if(editable_) { + synfig::Time prev_t,next_t; kf_list_->find_prev_next(t, prev_t, next_t); + int a=0; + synfig::info("tiempo $s", t.get_string()); + //synfig::info("previo $s", prev_t.get_string()); + //synfig::info("prox $s", next_t.get_string()); if( (prev_t==Time::begin() && next_t==Time::end()) - || - ((t-prev_t)>time_ratio && (next_t-t)>time_ratio) - ) + || + ((t-prev_t)>time_ratio && (next_t-t)>time_ratio) + ) { set_selected_keyframe(selected_none); selected_=false; - /*synfig::info("Selected keyframe set to none"); - synfig::info("Distance to prev %s", (t-prev_t).get_string().c_str()); - synfig::info("Distance to next %s", (next_t-t).get_string().c_str());*/ queue_draw(); return true; } else if ((t-prev_t)<(next_t-t)) { set_selected_keyframe(*(kf_list_->find_prev(t))); - //synfig::info("Selected keyframe set to previous"); queue_draw(); selected_=true; + + //synfig::Time p_t,n_t; + //kf_list_->find_prev_next(t, p_t, n_t); + + + return true; } else { set_selected_keyframe(*(kf_list_->find_next(t))); - //synfig::info("Selected keyframe set to next"); queue_draw(); selected_=true; return true; } - return false; } else @@ -314,11 +361,10 @@ Widget_Keyframe_List::on_event(GdkEvent *event) //synfig::info("perform move result: %i", stat); return stat; } + break; default: break; } - - return false; } @@ -361,5 +407,3 @@ Widget_Keyframe_List::set_canvas_interface(etl::loose_handle<synfigapp::CanvasIn set_kf_list(&canvas_interface_->get_canvas()->keyframe_list()); } } - - ------------------------------------------------------------------------------ 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