X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fcellrenderer_timetrack.cpp;h=83824657c43f5af3c0699a4c2b5fc5ad0bcda6cb;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=96f19b8370ddf180619fea125959926e7c33c816;hpb=39cc772bf2d4d1f750f2aef255248095a94fb13a;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/cellrenderer_timetrack.cpp b/synfig-studio/trunk/src/gtkmm/cellrenderer_timetrack.cpp index 96f19b8..8382465 100644 --- a/synfig-studio/trunk/src/gtkmm/cellrenderer_timetrack.cpp +++ b/synfig-studio/trunk/src/gtkmm/cellrenderer_timetrack.cpp @@ -6,7 +6,7 @@ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2007 Chris Moore +** Copyright (c) 2007, 2008 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 @@ -46,7 +46,7 @@ #include #include "instance.h" -#include +#include "general.h" #endif @@ -90,7 +90,8 @@ CellRenderer_TimeTrack::CellRenderer_TimeTrack(): CellRenderer_TimeTrack::~CellRenderer_TimeTrack() { - synfig::info("CellRenderer_TimeTrack::~CellRenderer_TimeTrack(): deleted"); + if (getenv("SYNFIG_DEBUG_DESTRUCTORS")) + synfig::info("CellRenderer_TimeTrack::~CellRenderer_TimeTrack(): Deleted"); } void @@ -127,7 +128,8 @@ CellRenderer_TimeTrack::is_selected(const Waypoint& waypoint)const const synfig::Time get_time_offset_from_vdesc(const synfigapp::ValueDesc &v) { #ifdef ADJUST_WAYPOINTS_FOR_TIME_OFFSET - if(v.get_value_type() != synfig::ValueBase::TYPE_CANVAS) + if(getenv("SYNFIG_SHOW_CANVAS_PARAM_WAYPOINTS") || + v.get_value_type() != synfig::ValueBase::TYPE_CANVAS) return synfig::Time::zero(); synfig::Canvas::Handle canvasparam = v.get_value().get(Canvas::Handle()); @@ -151,7 +153,8 @@ const synfig::Time get_time_offset_from_vdesc(const synfigapp::ValueDesc &v) //kind of a hack... pointer is ugly const synfig::Node::time_set *get_times_from_vdesc(const synfigapp::ValueDesc &v) { - if(v.get_value_type() == synfig::ValueBase::TYPE_CANVAS) + if(!getenv("SYNFIG_SHOW_CANVAS_PARAM_WAYPOINTS") && + v.get_value_type() == synfig::ValueBase::TYPE_CANVAS) { synfig::Canvas::Handle canvasparam = v.get_value().get(Canvas::Handle()); @@ -310,6 +313,7 @@ CellRenderer_TimeTrack::render_vfunc( Time t_orig = i->get_time(); if(!t_orig.is_valid()) continue; Time t = t_orig - time_offset; + if(tget_lower() || t>adjustment->get_upper()) continue; //if it found it... (might want to change comparison, and optimize // sel_times.find to not produce an overall nlogn solution) @@ -751,7 +755,8 @@ CellRenderer_TimeTrack::activate_vfunc( bool clickfound = tset && get_closest_time(*tset,actual_time+time_offset,pixel_width*cell_area.get_height(),stime); etl::handle node; - if(valdesc.get_value(stime).get_type()==ValueBase::TYPE_CANVAS) + if(!getenv("SYNFIG_SHOW_CANVAS_PARAM_WAYPOINTS") && + valdesc.get_value(stime).get_type()==ValueBase::TYPE_CANVAS) { node=Canvas::Handle(valdesc.get_value(stime).get(Canvas::Handle())); } @@ -761,14 +766,11 @@ CellRenderer_TimeTrack::activate_vfunc( } if(clickfound && node) - { - show_timepoint_menu(node, stime, time_offset, actual_time+time_offsetmotion.x-(float)cell_area.get_x())/(float)cell_area.get_width()*(adjustment->get_upper()-adjustment->get_lower())+adjustment->get_lower(); return true; @@ -776,14 +778,12 @@ CellRenderer_TimeTrack::activate_vfunc( break; case GDK_BUTTON_RELEASE: { - DEBUGPOINT(); - //selected_time=((float)event->button.x-(float)cell_area.get_x())/(float)cell_area.get_width()*(adjustment->get_upper()-adjustment->get_lower())+adjustment->get_lower(); dragging=false; /*if(event->button.button==3 && selection) { - signal_waypoint_clicked_(path,*selected_waypoint,event->button.button-1); + signal_waypoint_clicked_cellrenderer()(path,*selected_waypoint,event->button.button-1); return true; } */ @@ -799,7 +799,8 @@ CellRenderer_TimeTrack::activate_vfunc( param_list.add("canvas",canvas_interface()->get_canvas()); param_list.add("canvas_interface",canvas_interface()); - if(sel_value.get_value_type() == synfig::ValueBase::TYPE_CANVAS) + if(!getenv("SYNFIG_SHOW_CANVAS_PARAM_WAYPOINTS") && + sel_value.get_value_type() == synfig::ValueBase::TYPE_CANVAS) { param_list.add("addcanvas",sel_value.get_value().get(Canvas::Handle())); }else @@ -823,15 +824,15 @@ CellRenderer_TimeTrack::activate_vfunc( if(mode & COPY_MASK) //copy { etl::handle::cast_static(canvas_interface()->get_instance()) - ->process_action("timepoint_copy", param_list); + ->process_action("TimepointsCopy", param_list); }else if(delmode) //DELETE { etl::handle::cast_static(canvas_interface()->get_instance()) - ->process_action("timepoint_delete", param_list); + ->process_action("TimepointsDelete", param_list); }else //MOVE { etl::handle::cast_static(canvas_interface()->get_instance()) - ->process_action("timepoint_move", param_list); + ->process_action("TimepointsMove", param_list); } //now replace all the selected with the new selected @@ -844,7 +845,7 @@ CellRenderer_TimeTrack::activate_vfunc( /*if(value_node && selection) { if(selected_time==drag_time && event->button.button!=3) - signal_waypoint_clicked_(path,*selected_waypoint,event->button.button-1); + signal_waypoint_clicked_cellrenderer()(path,*selected_waypoint,event->button.button-1); else if(event->button.button==1) { @@ -876,6 +877,10 @@ CellRenderer_TimeTrack::activate_vfunc( +// The following three functions don't get documented correctly by +// doxygen 1.5.[23] because of a bug with any function whose name +// begins with 'property'. Fixed in doxygen 1.5.4 apparently. See +// http://bugzilla.gnome.org/show_bug.cgi?id=471185 . Glib::PropertyProxy CellRenderer_TimeTrack::property_value_desc() { @@ -899,140 +904,3 @@ CellRenderer_TimeTrack::set_canvas_interface(etl::loose_handle > waypoints, Waypoint::Model model, etl::loose_handle canvas_interface) -{ - // Create the action group - synfigapp::Action::PassiveGrouper group(canvas_interface->get_instance().get(),_("Change Waypoint Group")); - - std::set >::const_iterator iter; - for(iter=waypoints.begin();iter!=waypoints.end();++iter) - { - Waypoint waypoint(*iter); - waypoint.apply_model(model); - - synfigapp::Action::Handle action(synfigapp::Action::create("waypoint_set")); - - assert(action); - - action->set_param("canvas",canvas_interface->get_canvas()); - action->set_param("canvas_interface",canvas_interface); - - action->set_param("waypoint",waypoint); - action->set_param("value_node",waypoint.get_parent_value_node()); - - if(!canvas_interface->get_instance()->perform_action(action)) - { - group.cancel(); - return; - } - } -} - -void -CellRenderer_TimeTrack::show_timepoint_menu(const etl::handle& node, const synfig::Time& time, const synfig::Time& time_offset, Side side) -{ - std::set > waypoint_set; - int n; - n=synfig::waypoint_collect(waypoint_set,time,node); - - Gtk::Menu* menu(manage(new Gtk::Menu())); - - // Create the interpolation method menu - if(!waypoint_set.empty()) - { - Gtk::Menu* interp_menu(manage(new Gtk::Menu())); - Waypoint::Model model; - - // note: each of the following 4 'if' blocks provokes these warnings: - // /usr/include/sigc++-2.0/sigc++/adaptors/bound_argument.h:57: warning: - // 'model.synfig::Waypoint::Model::temporal_tension' is used uninitialized in this function - // 'model.synfig::Waypoint::Model::bias' is used uninitialized in this function - // 'model.synfig::Waypoint::Model::continuity' is used uninitialized in this function - // 'model.synfig::Waypoint::Model::tension' is used uninitialized in this function - // 'model.synfig::Waypoint::Model::priority' is used uninitialized in this function - // I don't know if that matters or not. - - if(side==SIDE_LEFT)model.set_before(INTERPOLATION_TCB); - else model.set_after(INTERPOLATION_TCB); - interp_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("TCB"), - sigc::bind( - sigc::ptr_fun(set_waypoint_model), - waypoint_set, - model, - canvas_interface() - ) - )); - - if(side==SIDE_LEFT)model.set_before(INTERPOLATION_LINEAR); - else model.set_after(INTERPOLATION_LINEAR); - interp_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Linear"), - sigc::bind( - sigc::ptr_fun(set_waypoint_model), - waypoint_set, - model, - canvas_interface() - ) - )); - - if(side==SIDE_LEFT)model.set_before(INTERPOLATION_HALT); - else model.set_after(INTERPOLATION_HALT); - interp_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Ease"), - sigc::bind( - sigc::ptr_fun(set_waypoint_model), - waypoint_set, - model, - canvas_interface() - ) - )); - - if(side==SIDE_LEFT)model.set_before(INTERPOLATION_CONSTANT); - else model.set_after(INTERPOLATION_CONSTANT); - interp_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Constant"), - sigc::bind( - sigc::ptr_fun(set_waypoint_model), - waypoint_set, - model, - canvas_interface() - ) - )); - - - menu->items().push_back( - Gtk::Menu_Helpers::MenuElem( - side==SIDE_LEFT?_("Change \"In\" Interp."):_("Change \"Out\" Interp."), - *interp_menu - ) - ); - } - - menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-jump-to"), - sigc::bind( - sigc::mem_fun( - *canvas_interface(), - &synfigapp::CanvasInterface::set_time - ), - time - time_offset - ) - )); - - if(!waypoint_set.empty()) - { - // attempting to locate the valuenode for the clicked waypoint doesn't work if this is a Canvas parameter, - // so act as if there were multiple waypoints in that case as a workaround - if(waypoint_set.size()==1 && !Canvas::Handle::cast_dynamic(node)) - { - delete menu; - menu=0; - signal_waypoint_clicked_(" ",*waypoint_set.begin(),2); - return; - } - else - synfig::info("Too many waypoints under me"); - } - else - synfig::info("ZERO waypoints under me"); - - if(menu)menu->popup(3,gtk_get_current_event_time()); -}