X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fcanvasview.h;h=cddcbe2e7ab4dd18dff9471bdd9bdd72d96006ba;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=cdd9975201ffe5e229e2559d05486220db150d2e;hpb=ce408de81ca266b1f334ee9bc6c8fb7ba1492ed4;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/canvasview.h b/synfig-studio/trunk/src/gtkmm/canvasview.h index cdd9975..cddcbe2 100644 --- a/synfig-studio/trunk/src/gtkmm/canvasview.h +++ b/synfig-studio/trunk/src/gtkmm/canvasview.h @@ -2,10 +2,12 @@ /*! \file canvasview.h ** \brief Template Header ** -** $Id: canvasview.h,v 1.2 2005/01/13 18:37:30 darco Exp $ +** $Id$ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007, 2008 Chris Moore +** Copyright (c) 2009 Carlos López ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -40,6 +42,7 @@ #include #include #include +#include #include #include @@ -64,6 +67,10 @@ #include "dialog_waypoint.h" #include "dialog_keyframe.h" +#include "framedial.h" +#include "toggleducksdial.h" +#include "resolutiondial.h" +#include "widget_keyframe_list.h" #include "duckmatic.h" #include @@ -89,7 +96,7 @@ #if _DEBUG #define DEBUGPOINT_CLASS(x) struct debugpointclass_ ## x { debugpointclass_ ## x () { DEBUGPOINT(); } ~debugpointclass_ ## x () { DEBUGPOINT(); } } badfthguae_ ## x ; #else -#define DEBUGPOINT_CLASS(x) +#define DEBUGPOINT_CLASS(x) #endif #endif @@ -97,6 +104,10 @@ /* === C L A S S E S & S T R U C T S ======================================= */ +namespace synfig { + class TransformStack; +} + namespace studio { class CanvasViewUIInterface; @@ -112,41 +123,40 @@ class Duckmatic; class Preview; struct PreviewInfo; class AudioContainer; - + class Widget_Sound; class Widget_Timeslider; class Widget_Time; - + class Dialog_SoundSelect; class Dialog_Preview; -class synfig::TransformStack; class Dock_Layers; class Dock_Children; class Dock_Keyframes; - + class CanvasView : public Gtk::Window, public etl::shared_object { friend class UniversalScrubber; friend class Dock_Layers; friend class Dock_Children; friend class Dock_Keyframes; - + friend class CanvasViewUIInterface; friend class CanvasViewSelectionManager; friend class Duckmatic; - + /* -- ** -- P U B L I C T Y P E S --------------------------------------------- */ - + public: typedef etl::handle Handle; - + typedef etl::handle ConstHandle; - + typedef etl::loose_handle LooseHandle; typedef LayerTreeStore::Model LayerTreeModel; @@ -154,7 +164,7 @@ public: typedef ChildrenTreeStore::Model ChildrenTreeModel; //! Create an instance of this class whenever doing a longer task. - /*! Make sure that you check the bool value of this class occasionaly + /*! Make sure that you check the bool value of this class occasionally ** to make sure the action has not been canceled. */ class IsWorking { @@ -169,6 +179,9 @@ public: typedef synfigapp::CanvasInterface::Mode Mode; + void set_grid_snap_toggle(bool flag) { grid_snap_toggle->set_active(flag); } + void set_grid_show_toggle(bool flag) { grid_show_toggle->set_active(flag); } + /* -- ** -- P R I V A T E D A T A --------------------------------------------- */ @@ -184,31 +197,31 @@ private: synfig::Rect bbox; - DEBUGPOINT_CLASS(1); + // DEBUGPOINT_CLASS(1); //! State Machine Smach smach_; - DEBUGPOINT_CLASS(2); + // DEBUGPOINT_CLASS(2); etl::loose_handle instance_; etl::handle canvas_interface_; - DEBUGPOINT_CLASS(3); + // DEBUGPOINT_CLASS(3); //! Sound and information to play it etl::handle audio; studio::Widget_Sound *disp_audio; //should this be put into thing too? - SigC::Connection playcon; - SigC::Connection stopcon; - + sigc::connection playcon; + sigc::connection stopcon; + std::auto_ptr universal_scrubber; - - //! Tooltip controler + + //! Tooltip controller Gtk::Tooltips tooltips; - DEBUGPOINT_CLASS(4); + // DEBUGPOINT_CLASS(4); //! TreeModel for the layers LayerTreeModel layer_tree_model; @@ -222,23 +235,21 @@ private: //Glib::RefPtr keyframe_tree_store_; - DEBUGPOINT_CLASS(5); - + // DEBUGPOINT_CLASS(5); + //std::map > tree_model_book_; std::map > ref_obj_book_; std::map ext_widget_book_; - //! The time adjustment's scope is defined by the time_window adjustment Gtk::Adjustment time_adjustment_; - + //! The time_window adjustment governs the position of the time window on the whole time line //Gtk::Adjustment time_window_adjustment_; studio::Adjust_Window time_window_adjustment_; - - + LayerTree *layer_tree; - + ChildrenTree *children_tree; KeyframeTree *keyframe_tree; @@ -247,28 +258,48 @@ private: Gtk::ProgressBar *progressbar; Gtk::Statusbar *statusbar; - + Gtk::TreeRow children_canvas_row; Gtk::TreeRow children_valuenode_row; - + Gtk::Button *stopbutton; Gtk::Button *refreshbutton; - Gtk::Button *treetogglebutton; - Gtk::Notebook *notebook; - Gtk::Widget *timebar; - + Gtk::Button *treetogglebutton; // not used + Gtk::Notebook *notebook; // not used + Gtk::Table *timebar; + Gtk::Table *displaybar; + Gtk::Button *animatebutton; + Gtk::Button *keyframebutton; + FrameDial *framedial; + ToggleDucksDial *toggleducksdial; + bool toggling_ducks_; + ResolutionDial *resolutiondial; + bool changing_resolution_; + Gtk::Adjustment quality_adjustment_; + Gtk::SpinButton *quality_spin; + Gtk::Adjustment past_onion_adjustment_; + Gtk::SpinButton *past_onion_spin; + Gtk::Adjustment future_onion_adjustment_; + Gtk::SpinButton *future_onion_spin; + bool updating_quality_; + Gtk::ToggleButton *show_grid; + Gtk::ToggleButton *snap_grid; + Gtk::ToggleButton *onion_skin; + bool toggling_show_grid; + bool toggling_snap_grid; + bool toggling_onion_skin; + //! Shows current time and allows edition Widget_Time *current_time_widget; void on_current_time_widget_changed(); - - std::auto_ptr timeslider; - std::list duck_changed_connections; + //! Time slider class. Same than the Time track panel + std::auto_ptr timeslider; + //!Keyframe list slider + std::auto_ptr widget_kf_list; + std::list duck_changed_connections; - Gtk::Button *animatebutton; - Gtk::Button *keyframebutton; - /* DEBUGPOINT_CLASS(8); Gtk::Menu duckmaskmenu; @@ -305,24 +336,20 @@ private: Gtk::CheckMenuItem* duck_mask_width; Gtk::CheckMenuItem* duck_mask_angle; */ + //! Menu members Gtk::Menu parammenu; - - Glib::RefPtr duck_mask_position; - Glib::RefPtr duck_mask_vertex; - Glib::RefPtr duck_mask_tangent; - Glib::RefPtr duck_mask_radius; - Glib::RefPtr duck_mask_width; - Glib::RefPtr duck_mask_angle; + Glib::RefPtr grid_snap_toggle; + Glib::RefPtr grid_show_toggle; Gtk::RadioButtonGroup quality_group; - - Glib::RefPtr action_group; + Gtk::RadioButtonGroup low_res_pixel_size_group; + Glib::RefPtr action_group; etl::handle ui_interface_; etl::handle selection_manager_; - + bool is_playing_; sigc::signal signal_deleted_; @@ -348,7 +375,6 @@ public: bool cancel; - /* -- ** -- D I A L O G S ------------------------------------------------------- */ @@ -370,18 +396,18 @@ public: */ private: - + // Constructor is private to force the use of the "create()" constructor CanvasView(etl::loose_handle instance,etl::handle canvas_interface); //! Constructor Helper - Gtk::Widget* create_layer_tree(); + // Gtk::Widget* create_layer_tree(); //! Constructor Helper - Gtk::Widget* create_children_tree(); + // Gtk::Widget* create_children_tree(); //! Constructor Helper - Gtk::Widget* create_keyframe_tree(); + // Gtk::Widget* create_keyframe_tree(); //! Constructor Helper Gtk::Widget* create_status_bar(); @@ -395,27 +421,26 @@ private: void time_was_changed(); - void refresh_rend_desc(); - + void refresh_rend_desc(); + void toggle_duck_mask(Duckmatic::Type type); Gtk::Widget *create_work_area(); Gtk::Widget *create_time_bar(); + Gtk::Widget *create_display_bar(); - + //! Pop up menu for the bezier (bline, draw) tool (?) void popup_param_menu_bezier(float location, synfigapp::ValueDesc value_desc) - { popup_param_menu(value_desc,location); } - - void popup_param_menu(synfigapp::ValueDesc value_desc, float location=0); + { popup_param_menu(value_desc,location,true); } + //! Pop up menu for the tools but not the bezier ones. + void popup_param_menu(synfigapp::ValueDesc value_desc, float location=0, bool bezier=false); void workarea_layer_selected(synfig::Layer::Handle layer); void selected_layer_color_set(synfig::Color color); - - void register_layer_type(synfig::Layer::Book::value_type &lyr,std::map*); @@ -424,6 +449,15 @@ private: void rebuild_ducks_layer_(synfig::TransformStack& transform_stack, synfig::Canvas::Handle canvas, std::set& selected_list); + void decrease_low_res_pixel_size(); + void increase_low_res_pixel_size(); + void toggle_low_res_pixel_flag(); + void set_quality(int x); + void set_onion_skins(); + void toggle_show_grid(); + void toggle_snap_grid(); + void toggle_onion_skin(); + /* -- ** -- P U B L I C M E T H O D S ----------------------------------------- */ @@ -443,7 +477,7 @@ public: Gtk::Widget* get_ext_widget(const synfig::String& x); void set_ext_widget(const synfig::String& x, Gtk::Widget* y); - + //std::map& tree_view_book() { return tree_view_book_; } //std::map& ext_widget_book() { return tree_view_book_; } @@ -452,23 +486,23 @@ public: Smach& get_smach() { return smach_; } const Smach& get_smach()const { return smach_; } - + Smach::event_result process_event_key(EventKey x); - + void popup_layer_menu(synfig::Layer::Handle layer); virtual ~CanvasView(); void set_mode(Mode x) { canvas_interface()->set_mode(x); } - + Mode get_mode()const { return canvas_interface()->get_mode(); } - + Gtk::Adjustment &time_adjustment() { return time_adjustment_; } - + const Gtk::Adjustment &time_adjustment()const { return time_adjustment_; } studio::Adjust_Window &time_window_adjustment() { return time_window_adjustment_; } - + const studio::Adjust_Window &time_window_adjustment()const { return time_window_adjustment_; } etl::handle get_ui_interface() { return ui_interface_;} @@ -476,19 +510,19 @@ public: etl::handle get_selection_manager() { return selection_manager_; } Glib::RefPtr layer_tree_store() { return get_tree_model("layers"); } - + Glib::RefPtr layer_tree_store()const { return get_tree_model("layers"); } Glib::RefPtr children_tree_store() { return get_tree_model("children"); } - + Glib::RefPtr children_tree_store()const { return get_tree_model("children"); } Glib::RefPtr keyframe_tree_store() { return get_tree_model("keyframes"); } - + Glib::RefPtr keyframe_tree_store()const { return get_tree_model("keyframes"); } void set_time(synfig::Time t) { canvas_interface_->set_time(t); } - + synfig::Time get_time() { return canvas_interface_->get_time(); } etl::handle get_canvas()const { return canvas_interface_->get_canvas(); } @@ -504,8 +538,11 @@ public: //! Updates the title of the window void update_title(); + //! Closes this document + bool close_instance(); + //! Closes this canvas view - bool close(); + bool close_view(); //! Stops the currently executing action /*! \see get_cancel_status(), reset_cancel_status(), IsWorking */ @@ -544,62 +581,64 @@ public: //! \writeme void rebuild_ducks(); - + //bool add_to_ducks(synfigapp::ValueDesc value_desc, synfig::ParamDesc *param_desc=NULL); - + //! Starts "playing" the animation in real-time void play(); //! Shows the tables (Layer/Children) void show_tables(); - + //! Hides the tables (Layer/Children) void hide_tables(); - + //! Toggles the tables void toggle_tables(); //! Gets the table status bool tables_are_visible(); - + //! Shows the time bar void show_timebar(); //! Hides the time bar void hide_timebar(); - void do_rotoscope_bline(); - - void do_rotoscope(); - - void do_rotoscope_poly(); - - void do_eyedrop(); + //t Enables or disables interaction with the timebar + void set_sensitive_timebar(bool sensitive); void time_zoom_in(); void time_zoom_out(); - + void add_layer(synfig::String x); - + void show_keyframe_dialog(); - + void play_audio(float t); void stop_audio(); - + void image_import(); - void on_waypoint_clicked(synfigapp::ValueDesc,synfig::Waypoint, int button); - + void on_waypoint_clicked_canvasview(synfigapp::ValueDesc,std::set >, int button); + void preview_option() {on_preview_option();} - + void present(); - + + bool is_playing() { return is_playing_; } + + void update_quality(); + + + /* -- ** -- S I G N A L T E R M I N A L S ------------------------------------- */ private: - + + void on_select_layers(); void on_unselect_layers(); void on_input_device_changed(GdkDevice*); @@ -608,7 +647,7 @@ private: virtual bool on_focus_in_event(GdkEventFocus*); virtual bool on_focus_out_event(GdkEventFocus*); - + //bool on_children_tree_event(GdkEvent *event); bool on_keyframe_tree_event(GdkEvent *event); @@ -622,21 +661,21 @@ private: bool on_layer_user_click(int, Gtk::TreeRow, LayerTree::ColumnID); // void on_layer_toggle(const Glib::ustring& path_string, Gtk::TreeModelColumn column); - + void on_mode_changed(synfigapp::CanvasInterface::Mode mode); // void on_layer_waypoint_clicked(const Glib::ustring &, synfig::ValueNode_Animated::WaypointList::iterator); - + //void on_children_waypoint_clicked(const Glib::ustring &, synfig::ValueNode_Animated::WaypointList::iterator); void on_waypoint_changed(); - + void on_waypoint_delete(); void on_refresh_pressed(); void on_id_changed(); - + void on_time_changed(); /* @@ -645,7 +684,7 @@ private: void on_layer_duplicate_pressed(); void on_layer_delete_pressed(); */ - + void on_keyframe_add_pressed(); void on_keyframe_duplicate_pressed(); @@ -655,40 +694,44 @@ private: void on_animate_button_pressed(); void on_keyframe_button_pressed(); - + void on_preview_option(); void on_preview_create(const PreviewInfo &); - + void on_audio_option(); void on_audio_file_change(const std::string &f); void on_audio_offset_change(const synfig::Time &t); - + void on_audio_file_notify(); void on_audio_offset_notify(); - + bool on_duck_changed(const synfig::Point &value,const synfigapp::ValueDesc& value_desc); + bool on_duck_angle_changed(const synfig::Angle &rotation,const synfigapp::ValueDesc& value_desc); void on_layer_toggle(synfig::Layer::Handle); void on_edited_value(synfigapp::ValueDesc,synfig::ValueBase); - //void on_waypoint_clicked(synfigapp::ValueDesc,synfig::ValueNode_Animated::WaypointList::iterator, int button); - void on_drop_drag_data_received(const Glib::RefPtr& context, int x, int y, const Gtk::SelectionData& selection_data, guint info, guint time); - + //void on_audio_play(); bool on_audio_scrub(); + void on_play_stop_pressed(); + protected: + bool close_instance_when_safe(); bool on_delete_event(GdkEventAny* event); - + /* -- ** -- S T A T I C P U B L I C M E T H O D S --------------------------- */ public: - + static etl::handle create(etl::loose_handle instance,etl::handle canvas); + static std::list& get_pixel_sizes(); + }; // END of class CanvasView }; // END of namespace studio