synfig-studio  1.0.3
cellrenderer_timetrack.h
Go to the documentation of this file.
1 /* === S Y N F I G ========================================================= */
22 /* ========================================================================= */
23 
24 /* === S T A R T =========================================================== */
25 
26 #ifndef __SYNFIG_GTKMM_CELLRENDERER_TIMETRACK_H
27 #define __SYNFIG_GTKMM_CELLRENDERER_TIMETRACK_H
28 
29 /* === H E A D E R S ======================================================= */
30 
31 #include <gtk/gtk.h>
32 #include <gtkmm/arrow.h>
33 #include <gtkmm/image.h>
34 #include <gdkmm/pixbufloader.h>
35 #include <gtkmm/viewport.h>
36 #include <gtkmm/adjustment.h>
37 #include <gtkmm/scrolledwindow.h>
38 #include <gtkmm/table.h>
39 #include <gtkmm/statusbar.h>
40 #include <gtkmm/button.h>
41 #include <gtkmm/progressbar.h>
42 #include <gtkmm/paned.h>
43 #include <gtkmm/treeview.h>
44 #include <gtkmm/treestore.h>
45 #include <gtkmm/box.h>
46 #include <gtkmm/scrollbar.h>
47 #include <gtkmm/cellrenderer.h>
48 
49 #include <gtkmm/dialog.h>
50 #include <gtkmm/menu.h>
51 
52 #include <glibmm/property.h>
53 
55 #include <synfigapp/value_desc.h>
56 #include <synfig/valuenodes/valuenode_animated.h>
57 #include <synfig/valuenodes/valuenode_dynamiclist.h>
58 #include <synfig/string.h>
59 #include <synfig/time.h>
60 
61 /* === M A C R O S ========================================================= */
62 
63 /* === T Y P E D E F S ===================================================== */
64 
65 
66 /* === C L A S S E S & S T R U C T S ======================================= */
67 
68 namespace studio {
69 class Widget_ValueBase;
70 
75  public Gtk::CellRenderer
76 {
77 
78  /*
79  -- ** -- P R I V A T E D A T A ---------------------------------------------
80  */
81 
82 private:
84  Glib::RefPtr<Gtk::Adjustment> adjustment_;
85 
87  sigc::signal<void, const etl::handle<synfig::Node>&, const synfig::Time&, const synfig::Time&, const synfig::Time&, int> signal_waypoint_clicked_cellrenderer_;
88 
89  sigc::signal<void, synfig::Waypoint, synfig::ValueNode::Handle> signal_waypoint_changed_;
90 
92  synfig::ValueNode_Animated::WaypointList::iterator selected_waypoint;
93 
94  synfig::UniqueID selected;
95 
97  //TODO: make multiple... on both time and value select...
98  std::set<synfig::Time> sel_times;
99  synfigapp::ValueDesc sel_value;
100  synfig::Time actual_time;
101  synfig::Time actual_dragtime;
102  int mode;
103 
105  synfig::Time selected_time;
106 
108  Glib::ustring path;
109 
111  bool selection;
112 
113  bool dragging;
114 
115  synfig::Time drag_time;
116 
117  etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_;
118 
119  /*
120  -- ** -- P R O P E R T I E S -------------------------------------------------
121  */
122 
123 private:
124 
126  Glib::Property<synfigapp::ValueDesc> property_valuedesc_;
127 
129  Glib::Property<synfig::Canvas::Handle> property_canvas_;
130 
132  Glib::Property< Glib::RefPtr<Gtk::Adjustment> > property_adjustment_;
133 
135  Glib::Property<bool> property_enable_timing_info_;
136 
137  /*
138  -- ** -- P R I V A T E M E T H O D S --------------------------------------
139  */
140 
141 private:
143  void draw_activepoint_off(
144  const ::Cairo::RefPtr< ::Cairo::Context>& cr,
145  Gdk::Color inactive_color,
146  int line_width,
147  int from_x,
148  int from_y,
149  int to_x,
150  int to_y);
151 
152  /*
153  -- ** -- P R O P E R T Y I N T E R F A C E S -------------------------------
154  */
155 
156 public:
157 
158  Glib::PropertyProxy<synfigapp::ValueDesc> property_value_desc();
159 
160  Glib::PropertyProxy<synfig::Canvas::Handle> property_canvas();
161 
162  Glib::PropertyProxy< Glib::RefPtr<Gtk::Adjustment> > property_adjustment();
163 
164  /*
165  -- ** -- S I G N A L I N T E R F A C E S -----------------------------------
166  */
167 
168 public:
169 
170  sigc::signal<void, const etl::handle<synfig::Node>&, const synfig::Time&, const synfig::Time&, const synfig::Time&, int> &signal_waypoint_clicked_cellrenderer()
171  {return signal_waypoint_clicked_cellrenderer_; }
172 
173  sigc::signal<void, synfig::Waypoint, synfig::ValueNode::Handle> &signal_waypoint_changed()
174  {return signal_waypoint_changed_; }
175 
176  /*
177  -- ** -- P U B L I C M E T H O D S -----------------------------------------
178  */
179 
180 public:
181 
184 
185  void set_adjustment(const Glib::RefPtr<Gtk::Adjustment> &x);
186  Glib::RefPtr<Gtk::Adjustment> get_adjustment()const;
187 
188  etl::loose_handle<synfigapp::CanvasInterface> canvas_interface()const {return canvas_interface_;}
189  void set_canvas_interface(etl::loose_handle<synfigapp::CanvasInterface> h); //this should only be called by smart people
190 
192 
193  bool is_selected(const synfig::Waypoint& waypoint)const;
194 
195  synfig::ValueNode_Animated::WaypointList::iterator find_editable_waypoint(const synfig::Time& t, const synfig::Time& scope=synfig::Time::end());
196 
197  virtual void
198  render_vfunc(
199  const ::Cairo::RefPtr< ::Cairo::Context>& cr,
200  Gtk::Widget& widget,
201  const Gdk::Rectangle& background_area,
202  const Gdk::Rectangle& cell_area,
203  Gtk::CellRendererState flags);
204 
205  virtual bool
206  activate_vfunc( GdkEvent* event,
207  Gtk::Widget& widget,
208  const Glib::ustring& path,
209  const Gdk::Rectangle& background_area,
210  const Gdk::Rectangle& cell_area,
211  Gtk::CellRendererState flags);
212 
213 }; // END of class CellRenderer_TimeTrack
214 
215 }; // END of namespace studio
216 
217 /* === E N D =============================================================== */
218 
219 #endif