X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fcellrenderer_timetrack.cpp;h=058ecd67e28a7f64d6640284be5eaca0f8719803;hb=e7e1794959f6b4af0d60d69b5501adcd305f2207;hp=b3c9a66b0283a1baf52e1c15abac895840b44aab;hpb=3a3c4bca3a17137bec5d7960560934b91ef4146e;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/cellrenderer_timetrack.cpp b/synfig-studio/trunk/src/gtkmm/cellrenderer_timetrack.cpp index b3c9a66..058ecd6 100644 --- a/synfig-studio/trunk/src/gtkmm/cellrenderer_timetrack.cpp +++ b/synfig-studio/trunk/src/gtkmm/cellrenderer_timetrack.cpp @@ -1,20 +1,21 @@ -/* === S I N F G =========================================================== */ +/* === S Y N F I G ========================================================= */ /*! \file cellrenderer_timetrack.cpp ** \brief Template Header ** ** $Id: cellrenderer_timetrack.cpp,v 1.4 2005/01/13 20:23:01 darco Exp $ ** ** \legal -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** -** This software and associated documentation -** are CONFIDENTIAL and PROPRIETARY property of -** the above-mentioned copyright holder. +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. ** -** You may not copy, print, publish, or in any -** other way distribute this software without -** a prior written agreement with -** the copyright holder. +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. ** \endlegal */ /* ========================================================================= */ @@ -41,14 +42,14 @@ #include "widget_time.h" #include "widget_timeslider.h" -#include +#include #include "instance.h" -#include +#include #endif -using namespace sinfg; +using namespace synfig; using namespace std; using namespace etl; using namespace studio; @@ -77,8 +78,8 @@ CellRenderer_TimeTrack::CellRenderer_TimeTrack(): Gtk::CellRenderer (), adjustment_ (10,10,20,0,0,0), - property_valuedesc_ (*this,"value_desc",sinfgapp::ValueDesc()), - property_canvas_ (*this,"canvas",sinfg::Canvas::Handle()), + property_valuedesc_ (*this,"value_desc",synfigapp::ValueDesc()), + property_canvas_ (*this,"canvas",synfig::Canvas::Handle()), property_adjustment_(*this,"adjustment",&adjustment_), property_enable_timing_info_(*this,"enable-timing-info", false) { @@ -88,7 +89,7 @@ CellRenderer_TimeTrack::CellRenderer_TimeTrack(): CellRenderer_TimeTrack::~CellRenderer_TimeTrack() { - sinfg::info("CellRenderer_TimeTrack::~CellRenderer_TimeTrack(): deleted"); + synfig::info("CellRenderer_TimeTrack::~CellRenderer_TimeTrack(): deleted"); } void @@ -98,7 +99,7 @@ CellRenderer_TimeTrack::set_adjustment(Gtk::Adjustment &x) // x.signal_value_changed().connect(sigc::mem_fun(*this,&Gtk::Widget::queue_draw)); } -sinfg::Canvas::Handle +synfig::Canvas::Handle CellRenderer_TimeTrack::get_canvas()const { return const_cast(this)->property_canvas().get_value(); @@ -123,11 +124,11 @@ CellRenderer_TimeTrack::is_selected(const Waypoint& waypoint)const } //kind of a hack... pointer is ugly -const sinfg::Node::time_set *get_times_from_vdesc(const sinfgapp::ValueDesc &v) +const synfig::Node::time_set *get_times_from_vdesc(const synfigapp::ValueDesc &v) { - if(v.get_value_type() == sinfg::ValueBase::TYPE_CANVAS) + if(v.get_value_type() == synfig::ValueBase::TYPE_CANVAS) { - sinfg::Canvas::Handle canvasparam = v.get_value().get(Canvas::Handle()); + synfig::Canvas::Handle canvasparam = v.get_value().get(Canvas::Handle()); if(canvasparam) { @@ -153,7 +154,7 @@ const sinfg::Node::time_set *get_times_from_vdesc(const sinfgapp::ValueDesc &v) return 0; } -bool get_closest_time(const sinfg::Node::time_set &tset, const Time &t, const Time &range, Time &out) +bool get_closest_time(const synfig::Node::time_set &tset, const Time &t, const Time &range, Time &out) { Node::time_set::const_iterator i,j,end = tset.end(); @@ -217,21 +218,21 @@ CellRenderer_TimeTrack::render_vfunc( inactive_gc->set_stipple(Gdk::Bitmap::create(stipple_xpm,2,2)); inactive_gc->set_fill(Gdk::STIPPLED); - sinfg::Canvas::Handle canvas(property_canvas().get_value()); + synfig::Canvas::Handle canvas(property_canvas().get_value()); - sinfgapp::ValueDesc value_desc = property_value_desc().get_value(); - sinfg::ValueNode *base_value = value_desc.get_value_node().get(); - sinfg::ValueNode_Animated *value_node=dynamic_cast(base_value); + synfigapp::ValueDesc value_desc = property_value_desc().get_value(); + synfig::ValueNode *base_value = value_desc.get_value_node().get(); + synfig::ValueNode_Animated *value_node=dynamic_cast(base_value); - sinfg::ValueNode_DynamicList *parent_value_node(0); + synfig::ValueNode_DynamicList *parent_value_node(0); if(property_value_desc().get_value().parent_is_value_node()) - parent_value_node=dynamic_cast(property_value_desc().get_value().get_parent_value_node().get()); + parent_value_node=dynamic_cast(property_value_desc().get_value().get_parent_value_node().get()); // If the canvas is defined, then load up the keyframes if(canvas) { - const sinfg::KeyframeList& keyframe_list(canvas->keyframe_list()); - sinfg::KeyframeList::const_iterator iter; + const synfig::KeyframeList& keyframe_list(canvas->keyframe_list()); + synfig::KeyframeList::const_iterator iter; for(iter=keyframe_list.begin();iter!=keyframe_list.end();++iter) { @@ -249,11 +250,11 @@ CellRenderer_TimeTrack::render_vfunc( //render all the time points that exist { - const sinfg::Node::time_set *tset = get_times_from_vdesc(value_desc); + const synfig::Node::time_set *tset = get_times_from_vdesc(value_desc); if(tset) { - sinfg::Node::time_set::const_iterator i = tset->begin(), end = tset->end(); + synfig::Node::time_set::const_iterator i = tset->begin(), end = tset->end(); float lower = adjustment->get_lower(), upper = adjustment->get_upper(); @@ -314,7 +315,7 @@ CellRenderer_TimeTrack::render_vfunc( gc->set_rgb_fg_color(Gdk::Color("#00EEEE")); } - //sinfg::info("Displaying time: %.3f s",(float)t); + //synfig::info("Displaying time: %.3f s",(float)t); const int x = (int)((t-lower)*area.get_width()/(upper-lower)); //should draw me a grey filled circle... @@ -349,7 +350,7 @@ CellRenderer_TimeTrack::render_vfunc( if(!t.is_valid()) continue; - //sinfg::info("Displaying time: %.3f s",(float)t); + //synfig::info("Displaying time: %.3f s",(float)t); const int x = (int)((t-lower)*area.get_width()/(upper-lower)); //should draw me a grey filled circle... @@ -383,7 +384,7 @@ CellRenderer_TimeTrack::render_vfunc( if(value_node) { //now render the actual waypoints - sinfg::ValueNode_Animated::WaypointList::iterator iter; + synfig::ValueNode_Animated::WaypointList::iterator iter; for( iter=value_node->waypoint_list().begin(); iter!=value_node->waypoint_list().end(); @@ -435,9 +436,9 @@ CellRenderer_TimeTrack::render_vfunc( if(parent_value_node) { const int index(property_value_desc().get_value().get_index()); - const sinfg::ValueNode_DynamicList::ListEntry& list_entry(parent_value_node->list[index]); - const sinfg::ValueNode_DynamicList::ListEntry::ActivepointList& activepoint_list(list_entry.timing_info); - sinfg::ValueNode_DynamicList::ListEntry::ActivepointList::const_iterator iter,next; + const synfig::ValueNode_DynamicList::ListEntry& list_entry(parent_value_node->list[index]); + const synfig::ValueNode_DynamicList::ListEntry::ActivepointList& activepoint_list(list_entry.timing_info); + synfig::ValueNode_DynamicList::ListEntry::ActivepointList::const_iterator iter,next; bool is_off(false); if(!activepoint_list.empty()) @@ -519,14 +520,14 @@ CellRenderer_TimeTrack::render_vfunc( } } -sinfg::ValueNode_Animated::WaypointList::iterator -CellRenderer_TimeTrack::find_waypoint(const sinfg::Time& t,const sinfg::Time& scope) +synfig::ValueNode_Animated::WaypointList::iterator +CellRenderer_TimeTrack::find_waypoint(const synfig::Time& t,const synfig::Time& scope) { - sinfg::ValueNode_Animated *value_node=dynamic_cast(property_value_desc().get_value().get_value_node().get()); + synfig::ValueNode_Animated *value_node=dynamic_cast(property_value_desc().get_value().get_value_node().get()); Time nearest(Time::end()); - sinfg::ValueNode_Animated::WaypointList::iterator iter,ret; + synfig::ValueNode_Animated::WaypointList::iterator iter,ret; if(value_node) { @@ -562,17 +563,17 @@ CellRenderer_TimeTrack::activate_vfunc( Gtk::CellRendererState flags) { path=treepath; - sinfg::ValueNode_Animated::WaypointList::iterator iter; + synfig::ValueNode_Animated::WaypointList::iterator iter; Time nearest=1000000000; Gtk::Adjustment *adjustment=get_adjustment(); - sinfg::ValueNode_Animated *value_node=dynamic_cast(property_value_desc().get_value().get_value_node().get()); + synfig::ValueNode_Animated *value_node=dynamic_cast(property_value_desc().get_value().get_value_node().get()); - sinfg::Canvas::Handle canvas(get_canvas()); + synfig::Canvas::Handle canvas(get_canvas()); - sinfg::ValueNode_DynamicList *parent_value_node(0); + synfig::ValueNode_DynamicList *parent_value_node(0); if(property_value_desc().get_value().parent_is_value_node()) - parent_value_node=dynamic_cast(property_value_desc().get_value().get_parent_value_node().get()); + parent_value_node=dynamic_cast(property_value_desc().get_value().get_parent_value_node().get()); Time deltatime = 0; Time curr_time; @@ -629,7 +630,7 @@ CellRenderer_TimeTrack::activate_vfunc( will remove it from the the set if it is included. */ - sinfgapp::ValueDesc valdesc = property_value_desc().get_value(); + synfigapp::ValueDesc valdesc = property_value_desc().get_value(); const Node::time_set *tset = get_times_from_vdesc(valdesc); bool clickfound = tset && get_closest_time(*tset,actual_time,pixel_width*cell_area.get_height(),stime); @@ -676,7 +677,7 @@ CellRenderer_TimeTrack::activate_vfunc( catch(int) { selection=false; - selected=sinfg::UniqueID::nil(); + selected=synfig::UniqueID::nil(); } if((!sel_times.empty() || selection) && event->button.button==1) @@ -692,8 +693,8 @@ CellRenderer_TimeTrack::activate_vfunc( if(parent_value_node) { const int index(property_value_desc().get_value().get_index()); - const sinfg::ValueNode_DynamicList::ListEntry::ActivepointList& activepoint_list(parent_value_node->list[index].timing_info); - sinfg::ValueNode_DynamicList::ListEntry::ActivepointList::const_iterator iter; + const synfig::ValueNode_DynamicList::ListEntry::ActivepointList& activepoint_list(parent_value_node->list[index].timing_info); + synfig::ValueNode_DynamicList::ListEntry::ActivepointList::const_iterator iter; for(iter=activepoint_list.begin();iter!=activepoint_list.end();++iter) { @@ -711,12 +712,12 @@ CellRenderer_TimeTrack::activate_vfunc( if(event->button.button==3) { Time stime; - sinfgapp::ValueDesc valdesc = property_value_desc().get_value(); + synfigapp::ValueDesc valdesc = property_value_desc().get_value(); const Node::time_set *tset = get_times_from_vdesc(valdesc); bool clickfound = tset && get_closest_time(*tset,actual_time,pixel_width*cell_area.get_height(),stime); - etl::handle node; + etl::handle node; if(valdesc.get_value(stime).get_type()==ValueBase::TYPE_CANVAS) { node=Canvas::Handle(valdesc.get_value(stime).get(Canvas::Handle())); @@ -761,11 +762,11 @@ CellRenderer_TimeTrack::activate_vfunc( deltatime = actual_time - actual_dragtime; if(sel_times.size() != 0 && (delmode || !deltatime.is_equal(Time(0)))) { - sinfgapp::Action::ParamList param_list; + synfigapp::Action::ParamList param_list; param_list.add("canvas",canvas_interface()->get_canvas()); param_list.add("canvas_interface",canvas_interface()); - if(sel_value.get_value_type() == sinfg::ValueBase::TYPE_CANVAS) + if(sel_value.get_value_type() == synfig::ValueBase::TYPE_CANVAS) { param_list.add("addcanvas",sel_value.get_value().get(Canvas::Handle())); }else @@ -774,7 +775,7 @@ CellRenderer_TimeTrack::activate_vfunc( } set