Removed a bunch more DEBUGPOINT()s.
[synfig.git] / synfig-studio / trunk / src / gtkmm / state_normal.cpp
index e9ee361..26dc853 100644 (file)
@@ -1,20 +1,21 @@
 /* === S Y N F I G ========================================================= */
-/*!    \file template.cpp
+/*!    \file state_normal.cpp
 **     \brief Template File
 **
-**     $Id: state_normal.cpp,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
+**     $Id$
 **
 **     \legal
-**     Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
 **
-**     This software and associated documentation
-**     are CONFIDENTIAL and PROPRIETARY property of
-**     the above-mentioned copyright holder.
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
 **
-**     You may not copy, print, publish, or in any
-**     other way distribute this software without
-**     a prior written agreement with
-**     the copyright holder.
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
 **     \endlegal
 */
 /* ========================================================================= */
@@ -40,6 +41,8 @@
 #include <synfig/valuenode_composite.h>
 #include <synfig/valuenode_const.h>
 #include "canvasview.h"
+#include "general.h"
+
 #endif
 
 /* === U S I N G =========================================================== */
@@ -56,16 +59,16 @@ using namespace studio;
 class studio::StateNormal_Context : public sigc::trackable
 {
        CanvasView *canvas_view;
-       
+
        CanvasView* get_canvas_view() { return canvas_view; }
        Canvas::Handle get_canvas() { return canvas_view->get_canvas(); }
        WorkArea* get_work_area() { return canvas_view->get_work_area(); }
        etl::handle<synfigapp::CanvasInterface> get_canvas_interface() { return canvas_view->canvas_interface(); }
-       
+
 public:
        StateNormal_Context(CanvasView *canvas_view);
        ~StateNormal_Context();
-       
+
        Smach::event_result event_stop_handler(const Smach::event& x);
 
        Smach::event_result event_refresh_handler(const Smach::event& x);
@@ -107,9 +110,9 @@ StateNormal::StateNormal():
        insert(event_def(EVENT_REDO,&StateNormal_Context::event_redo_handler));
        insert(event_def(EVENT_WORKAREA_MOUSE_BUTTON_DOWN,&StateNormal_Context::event_mouse_button_down_handler));
        insert(event_def(EVENT_WORKAREA_MULTIPLE_DUCKS_CLICKED,&StateNormal_Context::event_multiple_ducks_clicked_handler));
-       insert(event_def(EVENT_REFRESH_TOOL_OPTIONS,&StateNormal_Context::event_refresh_tool_options)); 
-       insert(event_def(EVENT_WORKAREA_LAYER_CLICKED,&StateNormal_Context::event_layer_click));        
-}      
+       insert(event_def(EVENT_REFRESH_TOOL_OPTIONS,&StateNormal_Context::event_refresh_tool_options));
+       insert(event_def(EVENT_WORKAREA_LAYER_CLICKED,&StateNormal_Context::event_layer_click));
+}
 
 StateNormal::~StateNormal()
 {
@@ -118,7 +121,7 @@ StateNormal::~StateNormal()
 StateNormal_Context::StateNormal_Context(CanvasView *canvas_view):
        canvas_view(canvas_view)
 {
-       synfig::info("Enterted Normal State");
+       synfig::info("Entered Normal State");
 }
 
 StateNormal_Context::~StateNormal_Context()
@@ -134,14 +137,14 @@ StateNormal_Context::refresh_tool_options()
 }
 
 Smach::event_result
-StateNormal_Context::event_refresh_tool_options(const Smach::event& x)
+StateNormal_Context::event_refresh_tool_options(const Smach::event& /*x*/)
 {
        refresh_tool_options();
        return Smach::RESULT_ACCEPT;
 }
 
 Smach::event_result
-StateNormal_Context::event_stop_handler(const Smach::event& x)
+StateNormal_Context::event_stop_handler(const Smach::event& /*x*/)
 {
        synfig::info("STATE NORMAL: Received Stop Event");
        canvas_view->stop();
@@ -149,7 +152,7 @@ StateNormal_Context::event_stop_handler(const Smach::event& x)
 }
 
 Smach::event_result
-StateNormal_Context::event_refresh_handler(const Smach::event& x)
+StateNormal_Context::event_refresh_handler(const Smach::event& /*x*/)
 {
        synfig::info("STATE NORMAL: Received Refresh Event");
        canvas_view->rebuild_tables();
@@ -158,7 +161,7 @@ StateNormal_Context::event_refresh_handler(const Smach::event& x)
 }
 
 Smach::event_result
-StateNormal_Context::event_refresh_ducks_handler(const Smach::event& x)
+StateNormal_Context::event_refresh_ducks_handler(const Smach::event& /*x*/)
 {
        synfig::info("STATE NORMAL: Received Refresh Ducks");
        canvas_view->queue_rebuild_ducks();
@@ -166,7 +169,7 @@ StateNormal_Context::event_refresh_ducks_handler(const Smach::event& x)
 }
 
 Smach::event_result
-StateNormal_Context::event_undo_handler(const Smach::event& x)
+StateNormal_Context::event_undo_handler(const Smach::event& /*x*/)
 {
        synfig::info("STATE NORMAL: Received Undo Event");
        canvas_view->get_instance()->undo();
@@ -174,7 +177,7 @@ StateNormal_Context::event_undo_handler(const Smach::event& x)
 }
 
 Smach::event_result
-StateNormal_Context::event_redo_handler(const Smach::event& x)
+StateNormal_Context::event_redo_handler(const Smach::event& /*x*/)
 {
        synfig::info("STATE NORMAL: Received Redo Event");
        canvas_view->get_instance()->redo();
@@ -202,7 +205,7 @@ Smach::event_result
 StateNormal_Context::event_layer_click(const Smach::event& x)
 {
        const EventLayerClick& event(*reinterpret_cast<const EventLayerClick*>(&x));
-       
+
        if(event.layer)
        {
                synfig::info("STATE NORMAL: Received layer click Event, \"%s\"",event.layer->get_name().c_str());
@@ -211,7 +214,7 @@ StateNormal_Context::event_layer_click(const Smach::event& x)
        {
                synfig::info("STATE NORMAL: Received layer click Event with an empty layer.");
        }
-       
+
        switch(event.button)
        {
        case BUTTON_LEFT:
@@ -256,28 +259,26 @@ StateNormal_Context::edit_several_waypoints(std::list<synfigapp::ValueDesc> valu
        widget_waypoint_model.show();
 
        dialog.get_vbox()->pack_start(widget_waypoint_model);
-       
-       
+
+
        dialog.add_button(Gtk::StockID("gtk-apply"),1);
        dialog.add_button(Gtk::StockID("gtk-cancel"),0);
        dialog.show();
-       
-       DEBUGPOINT();
+
        if(dialog.run()==0)
                return;
-       DEBUGPOINT();
        synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("Set Waypoints"));
 
        std::list<synfigapp::ValueDesc>::iterator iter;
        for(iter=value_desc_list.begin();iter!=value_desc_list.end();++iter)
        {
                synfigapp::ValueDesc value_desc(*iter);
-               
+
                if(!value_desc.is_valid())
                        continue;
 
                ValueNode_Animated::Handle value_node;
-               
+
                // If this value isn't a ValueNode_Animated, but
                // it is somewhat constant, then go ahead and convert
                // it to a ValueNode_Animated.
@@ -288,11 +289,11 @@ StateNormal_Context::edit_several_waypoints(std::list<synfigapp::ValueDesc> valu
                                value=ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node())->get_value();
                        else
                                value=value_desc.get_value();
-                       
+
                        value_node=ValueNode_Animated::create(value,get_canvas()->get_time());
-                       
+
                        synfigapp::Action::Handle action;
-                       
+
                        if(!value_desc.is_value_node())
                        {
                                action=synfigapp::Action::create("value_desc_connect");
@@ -305,11 +306,11 @@ StateNormal_Context::edit_several_waypoints(std::list<synfigapp::ValueDesc> valu
                                action->set_param("dest",value_desc.get_value_node());
                                action->set_param("src",ValueNode::Handle(value_node));
                        }
-                       
+
                        action->set_param("canvas",get_canvas());
                        action->set_param("canvas_interface",get_canvas_interface());
-                       
-       
+
+
                        if(!get_canvas_interface()->get_instance()->perform_action(action))
                        {
                                get_canvas_view()->get_ui_interface()->error(_("Unable to convert to animated waypoint"));
@@ -322,11 +323,11 @@ StateNormal_Context::edit_several_waypoints(std::list<synfigapp::ValueDesc> valu
                        if(value_desc.is_value_node())
                                value_node=ValueNode_Animated::Handle::cast_dynamic(value_desc.get_value_node());
                }
-               
-               
+
+
                if(value_node)
                {
-                       
+
                        synfigapp::Action::Handle action(synfigapp::Action::create("waypoint_set_smart"));
 
                        if(!action)
@@ -335,14 +336,14 @@ StateNormal_Context::edit_several_waypoints(std::list<synfigapp::ValueDesc> valu
                                group.cancel();
                                return;
                        }
-                               
 
-                       action->set_param("canvas",get_canvas());                       
-                       action->set_param("canvas_interface",get_canvas_interface());                   
-                       action->set_param("value_node",ValueNode::Handle(value_node));                  
-                       action->set_param("time",get_canvas()->get_time());                                             
+
+                       action->set_param("canvas",get_canvas());
+                       action->set_param("canvas_interface",get_canvas_interface());
+                       action->set_param("value_node",ValueNode::Handle(value_node));
+                       action->set_param("time",get_canvas()->get_time());
                        action->set_param("model",widget_waypoint_model.get_waypoint_model());
-               
+
                        if(!get_canvas_interface()->get_instance()->perform_action(action))
                        {
                                get_canvas_view()->get_ui_interface()->error(_("Unable to set a specific waypoint"));
@@ -356,30 +357,30 @@ StateNormal_Context::edit_several_waypoints(std::list<synfigapp::ValueDesc> valu
                        //group.cancel();
                        //return;
                }
-                       
+
        }
 }
 */
 
 Smach::event_result
-StateNormal_Context::event_multiple_ducks_clicked_handler(const Smach::event& x)
+StateNormal_Context::event_multiple_ducks_clicked_handler(const Smach::event& /*x*/)
 {
        synfig::info("STATE NORMAL: Received multiple duck click event");
 
        //const EventMouse& event(*reinterpret_cast<const EventMouse*>(&x));
 
        std::list<synfigapp::ValueDesc> value_desc_list;
-       
+
        // Create a list of value_descs associated with selection
        const DuckList selected_ducks(get_work_area()->get_selected_ducks());
        DuckList::const_iterator iter;
        for(iter=selected_ducks.begin();iter!=selected_ducks.end();++iter)
        {
                synfigapp::ValueDesc value_desc((*iter)->get_value_desc());
-               
+
                if(!value_desc.is_valid())
                        continue;
-               
+
                if(value_desc.get_value_type()==ValueBase::TYPE_BLINEPOINT && value_desc.is_value_node() && ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node()))
                {
                        value_desc_list.push_back(
@@ -394,9 +395,10 @@ StateNormal_Context::event_multiple_ducks_clicked_handler(const Smach::event& x)
        }
 
        Gtk::Menu *menu=manage(new Gtk::Menu());
-       
+       menu->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), menu));
+
        canvas_view->get_instance()->make_param_menu(menu,canvas_view->get_canvas(),value_desc_list);
-       
+
        /*
        synfigapp::Action::ParamList param_list;
        param_list=get_canvas_interface()->generate_param_list(value_desc_list);