Tidy up the waypoint menu, while adding functionality. Now there are 3 sub-menus...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sat, 16 Feb 2008 11:17:15 +0000 (11:17 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sat, 16 Feb 2008 11:17:15 +0000 (11:17 +0000)
git-svn-id: http://svn.voria.com/code@1712 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/gtkmm/canvasview.cpp

index 3af3417..e941822 100644 (file)
@@ -3198,47 +3198,55 @@ CanvasView::on_waypoint_clicked_canvasview(synfigapp::ValueDesc value_desc,
                Gtk::Menu* waypoint_menu(manage(new Gtk::Menu()));
                waypoint_menu->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), waypoint_menu));
 
-               Waypoint::Model model;
-               String side_string(String(" ") + (side==Waypoint::SIDE_LEFT ? _("In") : _("Out")));
+               Gtk::Menu* interp_menu_in(manage(new Gtk::Menu()));
+               Gtk::Menu* interp_menu_out(manage(new Gtk::Menu()));
+               Gtk::Menu* interp_menu_both(manage(new Gtk::Menu()));
+
+               waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_In"), *interp_menu_in));
+               waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Out"), *interp_menu_out));
+               waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Both"), *interp_menu_both));
 
                // ------------------------------------------------------------------------
-               if(side==Waypoint::SIDE_LEFT)   model.set_before(INTERPOLATION_TCB);
-               else                                                    model.set_after(INTERPOLATION_TCB);
-               waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_TCB") + side_string,
-                       sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+               Waypoint::Model model;
 
-               if(side==Waypoint::SIDE_LEFT)   model.set_before(INTERPOLATION_LINEAR);
-               else                                                    model.set_after(INTERPOLATION_LINEAR);
-               waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Linear") + side_string,
+               model.reset(); model.set_before(INTERPOLATION_TCB);
+               interp_menu_in->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_TCB"),
                        sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
-
-               if(side==Waypoint::SIDE_LEFT)   model.set_before(INTERPOLATION_HALT);
-               else                                                    model.set_after(INTERPOLATION_HALT);
-               waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Ease") + side_string,
+               model.reset(); model.set_after(INTERPOLATION_TCB);
+               interp_menu_out->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_TCB"),
                        sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
-
-               if(side==Waypoint::SIDE_LEFT)   model.set_before(INTERPOLATION_CONSTANT);
-               else                                                    model.set_after(INTERPOLATION_CONSTANT);
-               waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Constant") + side_string,
+               model.set_before(INTERPOLATION_TCB);
+               interp_menu_both->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_TCB"),
                        sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
 
-               // ------------------------------------------------------------------------
-               waypoint_menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem());
-
-               model.set_after(INTERPOLATION_TCB); model.set_before(INTERPOLATION_TCB);
-               waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("TC_B Both"),
+               model.reset(); model.set_before(INTERPOLATION_LINEAR);
+               interp_menu_in->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Linear"),
                        sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
-
-               model.set_after(INTERPOLATION_LINEAR); model.set_before(INTERPOLATION_LINEAR);
-               waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Li_near Both"),
+               model.reset(); model.set_after(INTERPOLATION_LINEAR);
+               interp_menu_out->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Linear"),
+                       sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+               model.set_before(INTERPOLATION_LINEAR);
+               interp_menu_both->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Linear"),
                        sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
 
-               model.set_after(INTERPOLATION_HALT); model.set_before(INTERPOLATION_HALT);
-               waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Ea_se Both"),
+               model.reset(); model.set_before(INTERPOLATION_HALT);
+               interp_menu_in->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Ease In"),
+                       sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+               model.reset(); model.set_after(INTERPOLATION_HALT);
+               interp_menu_out->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Ease Out"),
+                       sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+               model.set_before(INTERPOLATION_HALT);
+               interp_menu_both->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Ease In/Out"),
                        sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
 
-               model.set_after(INTERPOLATION_CONSTANT); model.set_before(INTERPOLATION_CONSTANT);
-               waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("C_onstant Both"),
+               model.reset(); model.set_before(INTERPOLATION_CONSTANT);
+               interp_menu_in->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Constant"),
+                       sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+               model.reset(); model.set_after(INTERPOLATION_CONSTANT);
+               interp_menu_out->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Constant"),
+                       sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
+               model.set_before(INTERPOLATION_CONSTANT);
+               interp_menu_both->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Constant"),
                        sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface())));
 
                // ------------------------------------------------------------------------