source: synfigstudio/trunk/fuentes/src/gui/canvasview.h @ 481

Last change on this file since 481 was 481, checked in by jrpelegrina, 4 years ago

First release to xenial

File size: 24.1 KB
Line 
1/* === S Y N F I G ========================================================= */
2/*!     \file canvasview.h
3**      \brief Template Header
4**
5**      $Id$
6**
7**      \legal
8**      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9**      Copyright (c) 2007, 2008 Chris Moore
10**      Copyright (c) 2009 Carlos López
11**
12**      This package is free software; you can redistribute it and/or
13**      modify it under the terms of the GNU General Public License as
14**      published by the Free Software Foundation; either version 2 of
15**      the License, or (at your option) any later version.
16**
17**      This package is distributed in the hope that it will be useful,
18**      but WITHOUT ANY WARRANTY; without even the implied warranty of
19**      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20**      General Public License for more details.
21**      \endlegal
22*/
23/* ========================================================================= */
24
25/* === S T A R T =========================================================== */
26
27#ifndef __SYNFIG_STUDIO_GTKMM_CANVASVIEW_H
28#define __SYNFIG_STUDIO_GTKMM_CANVASVIEW_H
29
30/* === H E A D E R S ======================================================= */
31
32#include <glibmm/dispatcher.h>
33
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>
54
55
56#include <synfigapp/canvasinterface.h>
57#include <synfigapp/selectionmanager.h>
58
59#include <ETL/clock>
60
61#include <synfig/canvas.h>
62#include <synfig/context.h>
63#include <synfig/string.h>
64#include <synfig/time.h>
65
66#include "instance.h"
67#include "dialogs/canvasproperties.h"
68#include "dialogs/canvasoptions.h"
69#include "render.h"
70#include "cellrenderer/cellrenderer_timetrack.h"
71#include "app.h"
72
73#include "trees/layertreestore.h"
74#include "trees/layertree.h"
75#include "trees/childrentreestore.h"
76#include "trees/childrentree.h"
77#include "trees/keyframetreestore.h"
78#include "trees/keyframetree.h"
79
80#include "dialogs/dialog_waypoint.h"
81#include "dialogs/dialog_keyframe.h"
82#include "dials/framedial.h"
83#include "dials/jackdial.h"
84#include "dials/toggleducksdial.h"
85#include "dials/resolutiondial.h"
86#include "widgets/widget_keyframe_list.h"
87
88#include "duckmatic.h"
89#include <gtkmm/scale.h>
90
91#include <gtkmm/uimanager.h>
92
93#include "smach.h"
94
95#include <memory>
96#include <set>
97#include <map>
98#include <gtkmm/toggleaction.h>
99#include <gtkmm/radioaction.h>
100#include <synfig/rect.h>
101
102#include "adjust_window.h"
103
104#include <synfig/transform.h>
105#include <synfig/soundprocessor.h>
106
107#include "docks/dockable.h"
108
109#ifdef WITH_JACK
110#include <jack/jack.h>
111#include <jack/transport.h>
112#endif
113
114#ifndef ONION_SKIN_PAST
115        #define ONION_SKIN_PAST 10
116#endif
117
118#ifndef ONION_SKIN_FUTURE
119        #define ONION_SKIN_FUTURE 10
120#endif
121
122/* === M A C R O S ========================================================= */
123
124#ifndef DEBUGPOINT_CLASS
125#if     _DEBUG
126#define DEBUGPOINT_CLASS(x)             struct debugpointclass_ ## x { debugpointclass_ ## x () { DEBUGPOINT(); } ~debugpointclass_ ## x () { DEBUGPOINT(); } } badfthguae_ ## x ;
127#else
128#define DEBUGPOINT_CLASS(x)
129#endif
130#endif
131
132/* === T Y P E D E F S ===================================================== */
133
134/* === C L A S S E S & S T R U C T S ======================================= */
135
136namespace synfig {
137        class TransformStack;
138}
139
140namespace studio {
141
142class CanvasViewUIInterface;
143class CanvasViewSelectionManager;
144
145class CellRenderer_TimeTrack;
146class CellRenderer_ValueBase;
147class UniversalScrubber;
148class WorkArea;
149
150class Duckmatic;
151
152class Widget_Enum;
153
154class Preview;
155struct PreviewInfo;
156class AudioContainer;
157
158class Widget_Sound;
159class Widget_Timeslider;
160class Widget_Time;
161
162class Dialog_SoundSelect;
163class Dialog_Preview;
164
165class Dock_Layers;
166class Dock_Children;
167class Dock_Keyframes;
168
169/*!     \class studio::CanvasView
170**      \brief \writeme
171**
172**      \writeme
173*/
174class CanvasView : public Dockable, public etl::shared_object
175{
176        friend class UniversalScrubber;
177        friend class Dock_Layers;
178        friend class Dock_Children;
179        friend class Dock_Keyframes;
180
181        friend class CanvasViewUIInterface;
182        friend class CanvasViewSelectionManager;
183
184        friend class Duckmatic;
185
186        /*
187 -- ** -- P U B L I C   T Y P E S ---------------------------------------------
188        */
189
190public:
191
192        typedef etl::handle<CanvasView> Handle;
193
194        typedef etl::handle<const CanvasView> ConstHandle;
195
196        typedef etl::loose_handle<CanvasView> LooseHandle;
197
198        typedef LayerTreeStore::Model LayerTreeModel;
199
200        typedef ChildrenTreeStore::Model ChildrenTreeModel;
201
202        //! Create an instance of this class whenever doing a longer task.
203        /*! Make sure that you check the bool value of this class occasionally
204        **      to make sure the action has not been canceled. */
205        class IsWorking
206        {
207                CanvasView &canvas_view_;
208
209        public:
210                IsWorking(CanvasView &canvas_view_);
211                ~IsWorking();
212                operator bool()const;
213        };
214        friend class IsWorking;
215
216        class ActivationIndex {
217        private:
218                static ActivationIndex last__;
219        public:
220                long long int activation_index;
221                long long int creation_index;
222
223                void create() { creation_index = ++last__.creation_index; }
224                void activate() { activation_index = ++last__.activation_index; }
225
226                explicit ActivationIndex(bool create = false): activation_index(0), creation_index(0)
227                {
228                        if (create) this->create();
229                }
230
231                bool operator < (const ActivationIndex &other) const
232                {
233                        if (activation_index < other.activation_index) return true;
234                        if (other.activation_index < activation_index) return false;
235                        return creation_index < other.creation_index;
236                }
237        };
238
239        typedef synfigapp::CanvasInterface::Mode Mode;
240
241        void set_grid_snap_toggle(bool flag) { grid_snap_toggle->set_active(flag); }
242        void set_grid_show_toggle(bool flag) { grid_show_toggle->set_active(flag); }
243        void set_onion_skin_toggle(bool flag) { onion_skin_toggle->set_active(flag); }
244
245        /*
246 -- ** -- P R I V A T E   D A T A ---------------------------------------------
247        */
248
249public:
250        std::auto_ptr<WorkArea> work_area;
251
252        WorkArea* get_work_area() { return work_area.get(); }
253
254private:
255        synfig::SoundProcessor soundProcessor;
256
257        ActivationIndex activation_index_;
258
259        synfig::Rect bbox;
260
261        // DEBUGPOINT_CLASS(1);
262
263        //! State Machine
264        Smach smach_;
265
266        // DEBUGPOINT_CLASS(2);
267
268        etl::loose_handle<Instance> instance_;
269        etl::handle<synfigapp::CanvasInterface> canvas_interface_;
270        synfig::ContextParams context_params_;
271
272        // DEBUGPOINT_CLASS(3);
273
274        //! Sound and information to play it
275        etl::handle<AudioContainer>             audio;
276        studio::Widget_Sound                    *disp_audio; //should this be put into thing too?
277
278        sigc::connection                                playcon;
279        sigc::connection                                stopcon;
280
281        std::auto_ptr<UniversalScrubber> universal_scrubber;
282
283        // DEBUGPOINT_CLASS(4);
284
285        //! TreeModel for the layers
286        LayerTreeModel layer_tree_model;
287
288        //! TreeModel for the the children
289        ChildrenTreeModel children_tree_model;
290
291        //Glib::RefPtr<LayerTreeStore> layer_tree_store_;
292
293        //Glib::RefPtr<ChildrenTreeStore> children_tree_store_;
294
295        //Glib::RefPtr<KeyframeTreeStore> keyframe_tree_store_;
296
297        // DEBUGPOINT_CLASS(5);
298
299        //std::map<synfig::String,Glib::RefPtr<Gtk::TreeModel> > tree_model_book_;
300        std::map<synfig::String,Glib::RefPtr<Glib::ObjectBase> > ref_obj_book_;
301        std::map<synfig::String,Gtk::Widget*> ext_widget_book_;
302
303        //! The time adjustment's scope is defined by the time_window adjustment
304        Glib::RefPtr<Gtk::Adjustment> time_adjustment_;
305
306        //! The time_window adjustment governs the position of the time window on the whole time line
307        //Glib::RefPtr<Gtk::Adjustment> time_window_adjustment_;
308        Glib::RefPtr<studio::Adjust_Window> time_window_adjustment_;
309
310        LayerTree *layer_tree;
311
312        ChildrenTree *children_tree;
313
314        KeyframeTree *keyframe_tree;
315
316        Gtk::Widget *keyframe_tab_child;
317
318        Gtk::ProgressBar *progressbar;
319        Gtk::Statusbar *statusbar;
320
321        Gtk::TreeRow children_canvas_row;
322        Gtk::TreeRow children_valuenode_row;
323
324        Gtk::Button *closebutton;
325        Gtk::Button *stopbutton;
326        Gtk::ToolButton *refreshbutton;
327        Gtk::Button *treetogglebutton;  // not used
328        Gtk::Notebook *notebook; // not used
329        Gtk::Table *timebar;
330        Gtk::Toolbar *displaybar;
331        Widget_Enum *widget_interpolation;
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_;
340        FrameDial *framedial;
341        JackDial *jackdial;
342        Gtk::ToggleButton *jackbutton;
343        Widget_Time *offset_widget;
344        ToggleDucksDial toggleducksdial;
345        bool toggling_ducks_;
346        ResolutionDial resolutiondial;
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;
363        //! Shows current time and allows edition
364        Widget_Time *current_time_widget;
365        void on_current_time_widget_changed();
366
367        //! Time slider class. Same than the Time track panel
368        std::auto_ptr<Widget_Timeslider> timeslider;
369
370        //!Keyframe list slider
371        std::auto_ptr<Widget_Keyframe_List> widget_kf_list;
372
373        std::list<sigc::connection> duck_changed_connections;
374
375/*      DEBUGPOINT_CLASS(8);
376
377        Gtk::Menu duckmaskmenu;
378        DEBUGPOINT_CLASS(77);
379        Gtk::Menu qualitymenu;
380        DEBUGPOINT_CLASS(6);
381
382        Gtk::Menu filemenu;
383        DEBUGPOINT_CLASS(777);
384        Gtk::Menu editmenu;
385        DEBUGPOINT_CLASS(71);
386        Gtk::Menu canvasmenu;
387        DEBUGPOINT_CLASS(73);
388public:
389        Gtk::Menu layermenu;
390private:
391        DEBUGPOINT_CLASS(74);
392        Gtk::Menu newlayermenu;
393        DEBUGPOINT_CLASS(76);
394        Gtk::Menu viewmenu;
395
396        DEBUGPOINT_CLASS(99);
397        Gtk::Menu keyframemenu;
398
399        Gtk::Menu parammenu;
400        DEBUGPOINT_CLASS(9);
401        Gtk::Menu trackmenu;
402        DEBUGPOINT_CLASS(7);
403
404        Gtk::CheckMenuItem* duck_mask_position;
405        Gtk::CheckMenuItem* duck_mask_vertex;
406        Gtk::CheckMenuItem* duck_mask_tangent;
407        Gtk::CheckMenuItem* duck_mask_radius;
408        Gtk::CheckMenuItem* duck_mask_width;
409        Gtk::CheckMenuItem* duck_mask_angle;
410*/
411        //! Menu members
412        Gtk::Menu parammenu;
413
414        Gtk::UIManager::ui_merge_id merge_id_popup_;
415        Gtk::UIManager::ui_merge_id merge_id_toolbar_;
416
417        Glib::RefPtr<Gtk::ToggleAction> grid_snap_toggle;
418        Glib::RefPtr<Gtk::ToggleAction> grid_show_toggle;
419        Glib::RefPtr<Gtk::ToggleAction> onion_skin_toggle;
420
421        Gtk::RadioButtonGroup quality_group;
422        Gtk::RadioButtonGroup low_res_pixel_size_group;
423
424        Glib::RefPtr<Gtk::ActionGroup> action_group;
425
426        etl::handle<synfigapp::UIInterface> ui_interface_;
427        etl::handle<synfigapp::SelectionManager> selection_manager_;
428
429        bool is_playing_;
430        sigc::connection playing_connection;
431        etl::clock playing_timer;
432        synfig::Time playing_time;
433
434        sigc::signal<void> signal_deleted_;
435
436        bool rebuild_ducks_queued;
437        sigc::connection queue_rebuild_ducks_connection;
438
439        bool jack_enabled;
440        bool jack_actual_enabled;
441        int jack_locks;
442        bool jack_enabled_in_preview;
443#ifdef WITH_JACK
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;
449        bool toggling_jack;
450#endif
451
452        Glib::RefPtr<Gtk::ToggleAction> action_mask_bone_setup_ducks, action_mask_bone_recursive_ducks;
453
454        /*
455 -- ** -- P U B L I C   D A T A -----------------------------------------------
456        */
457
458public:
459        void queue_rebuild_ducks();
460        sigc::signal<void>& signal_deleted() { return signal_deleted_; }
461
462        Gtk::Menu mainmenu;
463
464        bool duck_refresh_flag;
465        bool duck_refresh_needed;
466
467        //! This is for the IsWorking class.
468        int working_depth;
469
470        bool cancel;
471
472        /*
473 -- ** -- D I A L O G S -------------------------------------------------------
474        */
475
476public:
477
478        CanvasProperties canvas_properties;
479        CanvasOptions canvas_options;
480        RenderSettings render_settings;
481        Dialog_Waypoint waypoint_dialog;
482        Dialog_Keyframe keyframe_dialog;
483
484        std::auto_ptr<Dialog_Preview>                   preview_dialog;
485        //std::auto_ptr<Dialog_PreviewOptions>  previewoption_dialog;
486        std::auto_ptr<Dialog_SoundSelect>               sound_dialog;
487
488        /*
489 -- ** -- P R I V A T E   M E T H O D S ---------------------------------------
490        */
491
492private:
493
494        // Constructor is private to force the use of the "create()" constructor
495        CanvasView(etl::loose_handle<Instance> instance,etl::handle<synfigapp::CanvasInterface> canvas_interface);
496
497        //! Constructor Helper
498        // Gtk::Widget* create_layer_tree();
499
500        //! Constructor Helper
501        // Gtk::Widget* create_children_tree();
502
503        //! Constructor Helper
504        // Gtk::Widget* create_keyframe_tree();
505
506        //! Constructor Helper - Initializes all of the menus
507        void init_menus();
508
509        bool duck_change_param(const synfig::Point &value,synfig::Layer::Handle layer, synfig::String param_name);
510
511        void refresh_time_window();
512
513        void time_was_changed();
514
515        void refresh_rend_desc();
516
517        void mask_bone_ducks();
518
519        //! Constructor Helper - Create the workarea and connect data and signal
520        /*! \see popup_main_menu() */
521        Gtk::Widget *create_work_area();
522
523        Gtk::Widget *create_time_bar();
524
525        Gtk::ToolButton* create_action_toolbutton(const Glib::RefPtr<Gtk::Action> &action);
526        Gtk::SeparatorToolItem* create_tool_separator();
527        Gtk::Widget* create_display_bar();
528
529        //! Pop up menu for the bezier (bline, draw) tool (?)
530        void popup_param_menu_bezier(float location, synfigapp::ValueDesc value_desc)
531        { popup_param_menu(value_desc,location,true); }
532
533        //! Pop up menu for the tools but not the bezier ones.
534        void popup_param_menu(synfigapp::ValueDesc value_desc, float location=0, bool bezier=false);
535
536        void workarea_layer_selected(synfig::Layer::Handle layer);
537
538        void selected_layer_color_set(synfig::Color color);
539
540        void register_layer_type(synfig::Layer::Book::value_type &lyr,std::map<synfig::String,Gtk::Menu*>*);
541
542        //! Rebuilds the "new layer" menu
543        void build_new_layer_menu(Gtk::Menu &menu);
544
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();
553
554        void toggle_animatebutton();
555        void toggle_timetrackbutton();
556
557        void on_play_timeout();
558       
559        void interpolation_refresh();
560        void on_interpolation_changed();
561        void on_interpolation_event(GdkEvent *event);
562       
563        static void save_all();
564
565        /*
566 -- ** -- P U B L I C   M E T H O D S -----------------------------------------
567        */
568
569public:
570        ActivationIndex get_activation_index() { return activation_index_; }
571
572        void activate();
573        void deactivate();
574        void present();
575
576        bool jack_is_locked() const { return jack_locks > 0; }
577        void jack_lock();
578        void jack_unlock();
579        bool get_jack_enabled_in_preview() const { return jack_enabled_in_preview; }
580        void set_jack_enabled_in_preview(bool x) { jack_enabled_in_preview = x; }
581#ifdef WITH_JACK
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);
585#endif
586
587        synfig::Rect& get_bbox() { return bbox; }
588
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);
592
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);
596
597        Gtk::Widget* get_ext_widget(const synfig::String& x);
598        void set_ext_widget(const synfig::String& x, Gtk::Widget* y);
599
600        Gtk::UIManager::ui_merge_id get_popup_id();
601        void set_popup_id(Gtk::UIManager::ui_merge_id popup_id);
602        Gtk::UIManager::ui_merge_id get_toolbar_id();
603        void set_toolbar_id(Gtk::UIManager::ui_merge_id toolbar_id);
604
605        //std::map<synfig::String,Gtk::Widget*>& tree_view_book() { return tree_view_book_; }
606        //std::map<synfig::String,Gtk::Widget*>& ext_widget_book() { return tree_view_book_; }
607
608        //! Pop up menu for the main menu and the caret menu (not tools and not the bezier ones).
609        /*! Signal handler for work_area->signal_popup_menu */
610        /*! \see create_work_area(), popup_param_menu(), popup_param_menu_bezier() */
611        void popup_main_menu();
612
613        Smach& get_smach() { return smach_; }
614
615        const Smach& get_smach()const { return smach_; }
616
617        Smach::event_result process_event_key(EventKey x);
618
619        void popup_layer_menu(synfig::Layer::Handle layer);
620
621        virtual ~CanvasView();
622
623        const synfig::ContextParams& get_context_params()const { return context_params_; }
624
625        void set_context_params(const synfig::ContextParams &x) { context_params_ = x; }
626
627        void set_mode(Mode x) { canvas_interface()->set_mode(x); }
628
629        Mode get_mode()const { return canvas_interface()->get_mode(); }
630
631        Glib::RefPtr<Gtk::Adjustment> time_adjustment() { return time_adjustment_; }
632        Glib::RefPtr<const Gtk::Adjustment> time_adjustment()const { return time_adjustment_; }
633
634        Glib::RefPtr<studio::Adjust_Window> time_window_adjustment() { return time_window_adjustment_; }
635        Glib::RefPtr<const studio::Adjust_Window> time_window_adjustment()const { return time_window_adjustment_; }
636
637        etl::handle<synfigapp::UIInterface> get_ui_interface() { return ui_interface_;}
638
639        etl::handle<synfigapp::SelectionManager> get_selection_manager() { return selection_manager_; }
640
641        Glib::RefPtr<Gtk::TreeModel> layer_tree_store() { return get_tree_model("layers"); }
642
643        Glib::RefPtr<const Gtk::TreeModel> layer_tree_store()const { return get_tree_model("layers"); }
644
645        Glib::RefPtr<Gtk::TreeModel> children_tree_store() { return get_tree_model("children"); }
646
647        Glib::RefPtr<const Gtk::TreeModel> children_tree_store()const { return get_tree_model("children"); }
648
649        Glib::RefPtr<Gtk::TreeModel> keyframe_tree_store() { return get_tree_model("keyframes"); }
650
651        Glib::RefPtr<const Gtk::TreeModel> keyframe_tree_store()const { return get_tree_model("keyframes"); }
652
653        void set_time(synfig::Time t) { canvas_interface_->set_time(t); }
654
655        synfig::Time get_time() { return canvas_interface_->get_time(); }
656
657        etl::handle<synfig::Canvas> get_canvas()const { return canvas_interface_->get_canvas(); }
658
659        etl::handle<Instance> get_instance()const { return instance_; }
660
661        etl::handle<synfigapp::CanvasInterface> canvas_interface() { return canvas_interface_; }
662
663        etl::handle<const synfigapp::CanvasInterface> canvas_interface()const { return canvas_interface_; }
664
665        void add_actions_to_menu(Gtk::Menu *menu,   const synfigapp::Action::ParamList &param_list, synfigapp::Action::Category category=synfigapp::Action::CATEGORY_ALL)const;
666
667        //! Updates the title of the window
668        void update_title();
669
670        //! Closes this document
671        bool close_instance();
672
673        //! Closes this canvas view
674        bool close_view();
675
676        //!     Stops the currently executing action
677        /*! \see get_cancel_status(), reset_cancel_status(), IsWorking */
678        void stop() { cancel=true; }
679
680        //! Returns the cancel status
681        /*! \see stop(), reset_cancel_status(), IsWorking */
682        bool get_cancel_status()const { return cancel; }
683
684        //! Resets the cancel status
685        /*! \see stop(), get_cancel_status(), IsWorking */
686        void reset_cancel_status() { cancel=false; }
687
688        void new_child_canvas();
689
690        //! Rebuilds layer_tree_store_ from the Canvas. Maintains selected items.
691        void rebuild_tables();
692
693        //! Builds layer_tree_store_ from the Canvas. Does not maintain selected items.
694        void build_tables();
695
696        //! Refreshes the data for the tables
697        void refresh_tables();
698
699        //void rebuild_layer_table();
700        //void build_layer_table();
701        //void refresh_layer_table();
702
703//      void rebuild_canvas_table();
704//      void build_canvas_table();
705//      void refresh_canvas_table();
706
707//      void rebuild_valuenode_table();
708//      void build_valuenode_table();
709//      void refresh_valuenode_table();
710
711        //! \writeme
712        void rebuild_ducks();
713
714        //bool add_to_ducks(synfigapp::ValueDesc value_desc, synfig::ParamDesc *param_desc=NULL);
715
716        //! Starts "playing" the animation in real-time
717        void play();
718
719        void play_async();
720        void stop_async();
721
722        //! Shows the tables (Layer/Children)
723        void show_tables();
724
725        //! Hides the tables (Layer/Children)
726        void hide_tables();
727
728        //! Toggles the tables
729        void toggle_tables();
730
731        //! Gets the table status
732        bool tables_are_visible();
733
734        //! Shows the time bar
735        void show_timebar();
736
737        //! Hides the time bar
738        void hide_timebar();
739
740        //! Enables or disables interaction with the timebar
741        void set_sensitive_timebar(bool sensitive);
742
743        void time_zoom_in();
744        void time_zoom_out();
745
746        void add_layer(synfig::String x);
747
748        void show_keyframe_dialog();
749        void on_keyframe_toggle();
750        void on_keyframe_description_set();
751
752        void play_audio(float t);
753        void stop_audio();
754
755        void image_import();
756
757        void on_waypoint_clicked_canvasview(synfigapp::ValueDesc,std::set<synfig::Waypoint,std::less<synfig::UniqueID> >, int button);
758
759        void preview_option() {on_preview_option();}
760
761        bool is_playing() { return is_playing_; }
762
763        void update_quality();
764
765        void toggle_duck_mask(Duckmatic::Type type);
766
767        bool is_time_equal_to_current_frame(const synfig::Time &time, const synfig::Time &range = synfig::Time(0.0));
768
769        /*
770 -- ** -- S I G N A L   T E R M I N A L S -------------------------------------
771        */
772
773private:
774
775        void on_select_layers();
776        void on_unselect_layers();
777
778        void on_input_device_changed(GdkDevice*);
779
780        void on_hide();
781
782        Gtk::Widget* create_tab_label();
783
784        bool on_button_press_event(GdkEventButton *event);
785
786        //bool on_children_tree_event(GdkEvent *event);
787
788        bool on_keyframe_tree_event(GdkEvent *event);
789
790        //void on_children_edited_value(const Glib::ustring&path_string,synfig::ValueBase value);
791
792        void on_dirty_preview();
793
794        bool on_children_user_click(int, Gtk::TreeRow, ChildrenTree::ColumnID);
795
796        bool on_layer_user_click(int, Gtk::TreeRow, LayerTree::ColumnID);
797
798//      void on_layer_toggle(const Glib::ustring& path_string, Gtk::TreeModelColumn<bool> column);
799
800        void on_mode_changed(synfigapp::CanvasInterface::Mode mode);
801
802//      void on_layer_waypoint_clicked(const Glib::ustring &, synfig::ValueNode_Animated::WaypointList::iterator);
803
804        //void on_children_waypoint_clicked(const Glib::ustring &, synfig::ValueNode_Animated::WaypointList::iterator);
805
806        void on_waypoint_changed();
807
808        void on_waypoint_delete();
809
810        void on_refresh_pressed();
811
812        void on_id_changed();
813
814        void on_time_changed();
815
816        /*
817        void on_layer_raise_pressed();
818        void on_layer_lower_pressed();
819        void on_layer_duplicate_pressed();
820        void on_layer_delete_pressed();
821        */
822
823        void on_keyframe_add_pressed();
824
825        void on_keyframe_duplicate_pressed();
826
827        void on_keyframe_remove_pressed();
828
829        void on_animate_button_pressed();
830
831        void on_keyframe_button_pressed();
832        void toggle_past_keyframe_button();
833        void toggle_future_keyframe_button();
834
835        void on_preview_option();
836        void on_preview_create(const PreviewInfo &);
837
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);
841
842        void on_audio_file_notify();
843        void on_audio_offset_notify();
844
845        void on_layer_toggle(synfig::Layer::Handle);
846
847        void on_edited_value(synfigapp::ValueDesc,synfig::ValueBase);
848
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);
850
851        //void on_audio_play();
852        bool on_audio_scrub();
853
854        void on_play_pause_pressed();
855
856#ifdef WITH_JACK
857        void on_jack_offset_changed();
858        void toggle_jack_button();
859
860        synfig::Time get_jack_offset()const;
861        void set_jack_offset(const synfig::Time &value);
862#endif
863
864        void on_meta_data_changed();
865
866        //! Keyboard event dispatcher following window priority
867        bool on_key_press_event(GdkEventKey* event);
868        bool focused_widget_has_priority(Gtk::Widget * focused);
869
870
871protected:
872        bool close_instance_when_safe();
873        bool on_delete_event(GdkEventAny* event);
874
875        /*
876 -- ** -- S T A T I C   P U B L I C   M E T H O D S ---------------------------
877        */
878
879public:
880
881        static etl::handle<studio::CanvasView> create(etl::loose_handle<Instance> instance,etl::handle<synfig::Canvas> canvas);
882        static std::list<int>& get_pixel_sizes();
883
884private:
885#ifdef WITH_JACK
886        void on_jack_sync();
887        static int jack_sync_callback(jack_transport_state_t state, jack_position_t *pos, void *arg);
888#endif
889
890}; // END of class CanvasView
891
892}; // END of namespace studio
893
894/* === E N D =============================================================== */
895
896#endif
Note: See TracBrowser for help on using the repository browser.