Working on 1827966: Angles are recalculated to 360 mod.
[synfig.git] / synfig-studio / trunk / src / gtkmm / canvasview.cpp
index b6e093e..1d75c65 100644 (file)
@@ -784,7 +784,7 @@ CanvasView::CanvasView(etl::loose_handle<Instance> instance,etl::handle<synfigap
        refresh_time_window();
 
        /*! \todo We shouldn't need to do this at construction --
-       **      This should be preformed at the first time the window
+       **      This should be performed at the first time the window
        **      becomes visible.
        */
        work_area->queue_render_preview();
@@ -802,7 +802,7 @@ CanvasView::CanvasView(etl::loose_handle<Instance> instance,etl::handle<synfigap
                //         WorkArea::async_update_preview() =>
                //           WorkArea::set_zoom(float) =>
                //                 WorkArea::async_update_preview() =>
-               //                       desc.set_time(cur_time), where cur_time isn't initialised
+               //                       desc.set_time(cur_time), where cur_time isn't initialized
                work_area->set_time(0);
                work_area->zoom_out();
                w=round_to_int(get_canvas()->rend_desc().get_w()*work_area->get_zoom()+70);
@@ -2196,6 +2196,8 @@ CanvasView::on_layer_user_click(int button, Gtk::TreeRow /*row*/, LayerTree::Col
                                parammenu.items().clear();
 
                                Gtk::Menu *newlayers(manage(new Gtk::Menu()));
+                               // do we need this?  the code is all #ifdef'ed out anyway
+                               // newlayers->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), newlayers));
                                build_new_layer_menu(*newlayers);
 
                                parammenu.items().push_back(Gtk::Menu_Helpers::MenuElem("New Layer",*newlayers));
@@ -2431,7 +2433,7 @@ CanvasView::on_id_changed()
 void
 CanvasView::on_mode_changed(synfigapp::CanvasInterface::Mode mode)
 {
-       // If the aninimate flag was set in mode...
+       // If the animate flag was set in mode...
        if(mode&synfigapp::MODE_ANIMATE)
        {
                Gtk::Image *icon;
@@ -2554,6 +2556,14 @@ CanvasView::on_duck_changed(const synfig::Point &value,const synfigapp::ValueDes
        return true;
 }
 
+bool
+CanvasView::on_duck_angle_changed(const synfig::Angle &rotation,const synfigapp::ValueDesc& value_desc)
+{
+       // \todo will this really always be the case?
+       assert(value_desc.get_value_type() == ValueBase::TYPE_ANGLE);
+       return canvas_interface()->change_value(value_desc, value_desc.get_value(get_time()).get(Angle()) + rotation);
+}
+
 void
 CanvasView::selected_layer_color_set(Color color)
 {
@@ -2604,7 +2614,7 @@ CanvasView::rebuild_ducks_layer_(synfig::TransformStack& transform_stack, Canvas
                        // do the bounding box thing
                        bbox|=transform_stack.perform(layer->get_bounding_rect());
 
-                       // Grab the layer's list pf parameters
+                       // Grab the layer's list of parameters
                        Layer::ParamList paramlist(layer->get_param_list());
 
                        // Grab the layer vocabulary
@@ -2990,6 +3000,7 @@ CanvasView::on_waypoint_clicked(synfigapp::ValueDesc value_desc,synfig::Waypoint
        case 2:
                {
                        Gtk::Menu* waypoint_menu(manage(new Gtk::Menu()));
+                       waypoint_menu->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), waypoint_menu));
 
                        waypoint_menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-jump-to"),
                                sigc::bind(
@@ -3071,8 +3082,8 @@ CanvasView::on_drop_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& con
 {
        // We will make this true once we have a solid drop
        bool success(false);
-       //synfig::info("Droped data of type \"%s\"",selection_data.get_data_type());
-       //synfig::info("Droped data of target \"%s\"",gdk_atom_name(selection_data->target));
+       //synfig::info("Dropped data of type \"%s\"",selection_data.get_data_type());
+       //synfig::info("Dropped data of target \"%s\"",gdk_atom_name(selection_data->target));
        //synfig::info("selection=\"%s\"",gdk_atom_name(selection_data->selection));
 
        if ((selection_data_.get_length() >= 0) && (selection_data_.get_format() == 8))
@@ -3108,8 +3119,8 @@ CanvasView::on_drop_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& con
                {
                        synfig::String selection_data((gchar *)(selection_data_.get_data()));
 
-                       // For some reason, GTK hands us a list of URL's seperated
-                       // by not only Carrage-Returns, but also Line-Feeds.
+                       // For some reason, GTK hands us a list of URLs separated
+                       // by not only Carriage-Returns, but also Line-Feeds.
                        // Line-Feeds will mess us up. Remove all the line-feeds.
                        while(selection_data.find_first_of('\r')!=synfig::String::npos)
                                selection_data.erase(selection_data.begin()+selection_data.find_first_of('\r'));
@@ -3137,8 +3148,8 @@ CanvasView::on_drop_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& con
                                // Strip the "file://" part from the filename
                                filename=synfig::String(filename.begin()+sizeof("file://")-1,filename.end());
 
-                               String ext;
-                               try{ext=(String(filename.begin()+filename.find_last_of('.')+1,filename.end()));}catch(...){continue;}
+                               String ext(filename_extension(filename));
+                               if (ext.size()) ext = ext.substr(1); // skip initial '.'
 
                                // If this is a SIF file, then we need to do things slightly differently
                                if(ext=="sketch")