27 #ifndef __SYNFIG_STUDIO_GTKMM_CANVASVIEW_H
28 #define __SYNFIG_STUDIO_GTKMM_CANVASVIEW_H
32 #include <glibmm/dispatcher.h>
34 #include <gtkmm/window.h>
35 #include <gtkmm/image.h>
36 #include <gtkmm/tooltip.h>
37 #include <gtkmm/table.h>
38 #include <gtkmm/statusbar.h>
39 #include <gtkmm/progressbar.h>
40 #include <gtkmm/button.h>
41 #include <gtkmm/menu.h>
42 #include <gtkmm/treeview.h>
43 #include <gtkmm/treestore.h>
44 #include <gtkmm/scrolledwindow.h>
45 #include <gtkmm/notebook.h>
46 #include <gdkmm/device.h>
47 #include <gtkmm/spinbutton.h>
48 #include <gtkmm/alignment.h>
49 #include <gtkmm/toolbar.h>
50 #include <gtkmm/toolitem.h>
51 #include <gtkmm/toolbutton.h>
52 #include <gtkmm/toggletoolbutton.h>
53 #include <gtkmm/separatortoolitem.h>
61 #include <synfig/canvas.h>
62 #include <synfig/context.h>
63 #include <synfig/string.h>
64 #include <synfig/time.h>
89 #include <gtkmm/scale.h>
91 #include <gtkmm/uimanager.h>
98 #include <gtkmm/toggleaction.h>
99 #include <gtkmm/radioaction.h>
100 #include <synfig/rect.h>
104 #include <synfig/transform.h>
105 #include <synfig/soundprocessor.h>
110 #include <jack/jack.h>
111 #include <jack/transport.h>
114 #ifndef ONION_SKIN_PAST
115 #define ONION_SKIN_PAST 10
118 #ifndef ONION_SKIN_FUTURE
119 #define ONION_SKIN_FUTURE 10
124 #ifndef DEBUGPOINT_CLASS
126 #define DEBUGPOINT_CLASS(x) struct debugpointclass_ ## x { debugpointclass_ ## x () { DEBUGPOINT(); } ~debugpointclass_ ## x () { DEBUGPOINT(); } } badfthguae_ ## x ;
128 #define DEBUGPOINT_CLASS(x)
137 class TransformStack;
142 class CanvasViewUIInterface;
143 class CanvasViewSelectionManager;
145 class CellRenderer_TimeTrack;
146 class CellRenderer_ValueBase;
147 class UniversalScrubber;
156 class AudioContainer;
159 class Widget_Timeslider;
162 class Dialog_SoundSelect;
163 class Dialog_Preview;
167 class Dock_Keyframes;
212 operator bool()
const;
255 synfig::SoundProcessor soundProcessor;
257 ActivationIndex activation_index_;
268 etl::loose_handle<Instance> instance_;
269 etl::handle<synfigapp::CanvasInterface> canvas_interface_;
270 synfig::ContextParams context_params_;
275 etl::handle<AudioContainer> audio;
278 sigc::connection playcon;
279 sigc::connection stopcon;
281 std::auto_ptr<UniversalScrubber> universal_scrubber;
300 std::map<synfig::String,Glib::RefPtr<Glib::ObjectBase> > ref_obj_book_;
301 std::map<synfig::String,Gtk::Widget*> ext_widget_book_;
304 Glib::RefPtr<Gtk::Adjustment> time_adjustment_;
308 Glib::RefPtr<studio::Adjust_Window> time_window_adjustment_;
316 Gtk::Widget *keyframe_tab_child;
318 Gtk::ProgressBar *progressbar;
319 Gtk::Statusbar *statusbar;
321 Gtk::TreeRow children_canvas_row;
322 Gtk::TreeRow children_valuenode_row;
324 Gtk::Button *closebutton;
325 Gtk::Button *stopbutton;
326 Gtk::ToolButton *refreshbutton;
327 Gtk::Button *treetogglebutton;
328 Gtk::Notebook *notebook;
330 Gtk::Toolbar *displaybar;
332 Gtk::ScrolledWindow *widget_interpolation_scroll;
333 Gtk::ToggleButton *animatebutton;
334 Gtk::ToggleButton *timetrackbutton;
335 Gtk::VBox *timetrack;
336 Gtk::Button *keyframebutton;
337 Gtk::ToggleButton *pastkeyframebutton;
338 Gtk::ToggleButton *futurekeyframebutton;
339 bool toggling_animate_mode_;
342 Gtk::ToggleButton *jackbutton;
345 bool toggling_ducks_;
347 bool changing_resolution_;
348 Glib::RefPtr<Gtk::Adjustment> quality_adjustment_;
349 Gtk::SpinButton *quality_spin;
350 Glib::RefPtr<Gtk::Adjustment> future_onion_adjustment_;
351 Glib::RefPtr<Gtk::Adjustment> past_onion_adjustment_;
352 Gtk::SpinButton *past_onion_spin;
353 Gtk::SpinButton *future_onion_spin;
354 bool updating_quality_;
355 Gtk::ToggleToolButton *show_grid;
356 Gtk::ToggleToolButton *snap_grid;
357 Gtk::ToggleToolButton *onion_skin;
358 Gtk::ToolButton *render_options_button;
359 Gtk::ToolButton *preview_options_button;
360 bool toggling_show_grid;
361 bool toggling_snap_grid;
362 bool toggling_onion_skin;
365 void on_current_time_widget_changed();
368 std::auto_ptr<Widget_Timeslider> timeslider;
371 std::auto_ptr<Widget_Keyframe_List> widget_kf_list;
373 std::list<sigc::connection> duck_changed_connections;
414 Gtk::UIManager::ui_merge_id merge_id_popup_;
415 Gtk::UIManager::ui_merge_id merge_id_toolbar_;
417 Glib::RefPtr<Gtk::ToggleAction> grid_snap_toggle;
418 Glib::RefPtr<Gtk::ToggleAction> grid_show_toggle;
419 Glib::RefPtr<Gtk::ToggleAction> onion_skin_toggle;
421 Gtk::RadioButtonGroup quality_group;
422 Gtk::RadioButtonGroup low_res_pixel_size_group;
424 Glib::RefPtr<Gtk::ActionGroup> action_group;
426 etl::handle<synfigapp::UIInterface> ui_interface_;
427 etl::handle<synfigapp::SelectionManager> selection_manager_;
430 sigc::connection playing_connection;
431 etl::clock playing_timer;
432 synfig::Time playing_time;
434 sigc::signal<void> signal_deleted_;
436 bool rebuild_ducks_queued;
437 sigc::connection queue_rebuild_ducks_connection;
440 bool jack_actual_enabled;
442 bool jack_enabled_in_preview;
444 Glib::Dispatcher jack_dispatcher;
445 jack_client_t *jack_client;
446 bool jack_synchronizing;
447 bool jack_is_playing;
448 synfig::Time jack_time;
452 Glib::RefPtr<Gtk::ToggleAction> action_mask_bone_setup_ducks, action_mask_bone_recursive_ducks;
509 bool duck_change_param(
const synfig::Point &value,
synfig::Layer::Handle layer, synfig::String param_name);
511 void refresh_time_window();
513 void time_was_changed();
515 void refresh_rend_desc();
517 void mask_bone_ducks();
521 Gtk::Widget *create_work_area();
523 Gtk::Widget *create_time_bar();
525 Gtk::ToolButton* create_action_toolbutton(
const Glib::RefPtr<Gtk::Action> &action);
526 Gtk::SeparatorToolItem* create_tool_separator();
527 Gtk::Widget* create_display_bar();
531 { popup_param_menu(value_desc,location,
true); }
538 void selected_layer_color_set(synfig::Color color);
540 void register_layer_type(synfig::Layer::Book::value_type &lyr,std::map<synfig::String,Gtk::Menu*>*);
543 void build_new_layer_menu(Gtk::Menu &menu);
545 void decrease_low_res_pixel_size();
546 void increase_low_res_pixel_size();
547 void toggle_low_res_pixel_flag();
548 void set_quality(
int x);
549 void set_onion_skins();
550 void toggle_show_grid();
551 void toggle_snap_grid();
552 void toggle_onion_skin();
554 void toggle_animatebutton();
555 void toggle_timetrackbutton();
557 void on_play_timeout();
559 void interpolation_refresh();
560 void on_interpolation_changed();
561 void on_interpolation_event(GdkEvent *event);
563 static void save_all();
582 bool get_jack_enabled()
const {
return jack_enabled; }
583 bool get_jack_actual_enabled()
const {
return jack_actual_enabled; }
584 void set_jack_enabled(
bool value);
589 Glib::RefPtr<Glib::ObjectBase>
get_ref_obj(
const synfig::String& x);
590 Glib::RefPtr<const Glib::ObjectBase>
get_ref_obj(
const synfig::String& x)
const;
591 void set_ref_obj(
const synfig::String& x, Glib::RefPtr<Glib::ObjectBase> y);
593 Glib::RefPtr<Gtk::TreeModel>
get_tree_model(
const synfig::String& x);
594 Glib::RefPtr<const Gtk::TreeModel>
get_tree_model(
const synfig::String& x)
const;
595 void set_tree_model(
const synfig::String& x, Glib::RefPtr<Gtk::TreeModel> y);
601 void set_popup_id(Gtk::UIManager::ui_merge_id popup_id);
632 Glib::RefPtr<const Gtk::Adjustment>
time_adjustment()
const {
return time_adjustment_; }
653 void set_time(synfig::Time t) { canvas_interface_->set_time(t); }
655 synfig::Time
get_time() {
return canvas_interface_->get_time(); }
657 etl::handle<synfig::Canvas>
get_canvas()
const {
return canvas_interface_->get_canvas(); }
663 etl::handle<const synfigapp::CanvasInterface>
canvas_interface()
const {
return canvas_interface_; }
775 void on_select_layers();
776 void on_unselect_layers();
778 void on_input_device_changed(GdkDevice*);
782 Gtk::Widget* create_tab_label();
784 bool on_button_press_event(GdkEventButton *event);
788 bool on_keyframe_tree_event(GdkEvent *event);
792 void on_dirty_preview();
806 void on_waypoint_changed();
808 void on_waypoint_delete();
810 void on_refresh_pressed();
812 void on_id_changed();
814 void on_time_changed();
823 void on_keyframe_add_pressed();
825 void on_keyframe_duplicate_pressed();
827 void on_keyframe_remove_pressed();
829 void on_animate_button_pressed();
831 void on_keyframe_button_pressed();
832 void toggle_past_keyframe_button();
833 void toggle_future_keyframe_button();
835 void on_preview_option();
838 void on_audio_option();
839 void on_audio_file_change(
const std::string &f);
840 void on_audio_offset_change(
const synfig::Time &t);
842 void on_audio_file_notify();
843 void on_audio_offset_notify();
849 void on_drop_drag_data_received(
const Glib::RefPtr<Gdk::DragContext>& context,
int x,
int y,
const Gtk::SelectionData& selection_data,
guint info,
guint time);
852 bool on_audio_scrub();
854 void on_play_pause_pressed();
857 void on_jack_offset_changed();
858 void toggle_jack_button();
860 synfig::Time get_jack_offset()
const;
861 void set_jack_offset(
const synfig::Time &value);
864 void on_meta_data_changed();
867 bool on_key_press_event(GdkEventKey* event);
868 bool focused_widget_has_priority(Gtk::Widget * focused);
881 static etl::handle<studio::CanvasView>
create(etl::loose_handle<Instance> instance,etl::handle<synfig::Canvas> canvas);
887 static int jack_sync_callback(jack_transport_state_t state, jack_position_t *pos,
void *arg);