Get rid of null state
authorNikita Kitaev <nikitakit@gmail.com>
Sun, 10 Jan 2010 06:21:25 +0000 (22:21 -0800)
committerNikita Kitaev <nikitakit@gmail.com>
Sun, 10 Jan 2010 06:21:25 +0000 (22:21 -0800)
synfig-studio/images/Makefile.am
synfig-studio/images/null_icon.sif [deleted file]
synfig-studio/src/gtkmm/Makefile.am
synfig-studio/src/gtkmm/canvasview.cpp
synfig-studio/src/gtkmm/dialog_tooloptions.cpp
synfig-studio/src/gtkmm/iconcontroller.cpp
synfig-studio/src/gtkmm/state_normal.cpp
synfig-studio/src/gtkmm/state_null.cpp [deleted file]
synfig-studio/src/gtkmm/state_null.h [deleted file]

index 77fac06..e0fae57 100644 (file)
@@ -41,7 +41,6 @@ EXTRA_DIST = \
        mirror_icon.sif \
        navigator_icon.sif \
        normal_icon.sif \
-       null_icon.sif \
        pastecanvas_icon.sif \
        polygon_icon.sif \
        real_icon.sif \
@@ -119,7 +118,6 @@ IMAGES = \
        sketch_icon.$(EXT) \
        fill_icon.$(EXT) \
        normal_icon.$(EXT) \
-       null_icon.$(EXT) \
        select_all_child_layers_icon.$(EXT) \
        sif_icon.$(EXT) \
        synfig_icon.$(EXT) \
diff --git a/synfig-studio/images/null_icon.sif b/synfig-studio/images/null_icon.sif
deleted file mode 100644 (file)
index 079b1d2..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0"?>
-<canvas version="0.1" width="128" height="128" xres="2952.755900" yres="2952.755900" view-box="-2.000000 2.000000 2.000000 -2.000000" antialias="1" fps="30.000" begin-time="0f" end-time="0f" bgcolor="0.500000 0.500000 0.500000 1.000000">
-  <name>Untitled0</name>
-  <layer type="PasteCanvas" active="true" version="0.1">
-    <param name="z_depth">
-      <real value="0.0000000000"/>
-    </param>
-    <param name="amount">
-      <real value="1.0000000000"/>
-    </param>
-    <param name="blend_method">
-      <integer value="0"/>
-    </param>
-    <param name="origin">
-      <vector>
-        <x>0.0000000000</x>
-        <y>0.0500000007</y>
-      </vector>
-    </param>
-    <param name="canvas" use="logo.sif#"/>
-    <param name="zoom">
-      <real value="0.2750000000"/>
-    </param>
-    <param name="time_offset">
-      <time value="0f"/>
-    </param>
-  </layer>
-  <layer type="shade" active="true" version="0.2">
-    <param name="z_depth">
-      <real value="0.0000000000"/>
-    </param>
-    <param name="amount">
-      <real value="0.7500000000"/>
-    </param>
-    <param name="blend_method">
-      <integer value="12"/>
-    </param>
-    <param name="color">
-      <color>
-        <r>0.000000</r>
-        <g>0.000000</g>
-        <b>0.000000</b>
-        <a>1.000000</a>
-      </color>
-    </param>
-    <param name="offset">
-      <vector>
-        <x>0.1000000015</x>
-        <y>-0.1000000015</y>
-      </vector>
-    </param>
-    <param name="size">
-      <vector>
-        <x>0.2000000030</x>
-        <y>0.2000000030</y>
-      </vector>
-    </param>
-    <param name="type">
-      <integer value="1"/>
-    </param>
-    <param name="invert">
-      <bool value="false"/>
-    </param>
-  </layer>
-</canvas>
index f7fd175..1197712 100644 (file)
@@ -170,7 +170,6 @@ STATE_HH = \
        state_fill.h \
        state_gradient.h \
        state_normal.h \
-       state_null.h \
        state_polygon.h \
        state_rectangle.h \
        state_sketch.h \
@@ -189,7 +188,6 @@ STATE_CC = \
        state_fill.cpp \
        state_gradient.cpp \
        state_normal.cpp \
-       state_null.cpp \
        state_polygon.cpp \
        state_rectangle.cpp \
        state_sketch.cpp \
index 6c7b38a..f520ced 100644 (file)
@@ -83,7 +83,6 @@
 #include "dialog_color.h"
 #include "eventkey.h"
 
-#include "state_null.h"
 #include "state_polygon.h"
 #include "state_bline.h"
 #include "state_normal.h"
@@ -721,8 +720,6 @@ CanvasView::CanvasView(etl::loose_handle<Instance> instance,etl::handle<synfigap
        toggling_snap_grid=false;
        toggling_onion_skin=false;
 
-       smach_.set_default_state(&state_null);
-
        disp_audio = new Widget_Sound();
 
        //synfig::info("Canvasview: Entered constructor");
@@ -768,6 +765,8 @@ CanvasView::CanvasView(etl::loose_handle<Instance> instance,etl::handle<synfigap
 
        //set_transient_for(*App::toolbox);
 
+       smach_.set_default_state(&state_normal);
+
        //synfig::info("Canvasview: Before Signals");
        /*
  --    ** -- Signals -------------------------------------------------------------
index 87ef6f9..b31fe6c 100644 (file)
@@ -54,7 +54,7 @@ using namespace studio;
 /* === M E T H O D S ======================================================= */
 
 Dialog_ToolOptions::Dialog_ToolOptions():
-       Dockable("tool_options",_("Tool Options"),Gtk::StockID("synfig-null")),
+       Dockable("tool_options",_("Tool Options"),Gtk::StockID("synfig-about")),
        empty_label(_("This tool has no options"))
 {
        //scrolled_.add(sub_vbox_);
@@ -81,7 +81,7 @@ Dialog_ToolOptions::clear()
        set_widget(empty_label);
        empty_label.show();
 
-       set_stock_id(Gtk::StockID("synfig-null"));
+       set_stock_id(Gtk::StockID("synfig-about"));
 }
 
 void
index 730cbbf..be34be4 100644 (file)
@@ -221,7 +221,6 @@ IconController::IconController(const synfig::String& /*basepath*/)
        INIT_STOCK_ICON_CLONE(cvs_revert,"gtk-revert",_("CVS Revert"));
 
        // Tools
-       INIT_STOCK_ICON(null,"null_icon."IMAGE_EXT,_("Null Tool"));
        INIT_STOCK_ICON(normal,"normal_icon."IMAGE_EXT,_("Normal Tool"));
        INIT_STOCK_ICON(transform,"transform_icon."IMAGE_EXT,_("Transform Tool"));
        INIT_STOCK_ICON(polygon,"polyline_icon."IMAGE_EXT,_("Polygon Tool"));
index 15a7b43..8228921 100644 (file)
@@ -140,9 +140,6 @@ public:
        void set_constrain_flag(bool x) { checkbutton_constrain.set_active(x); refresh_constrain_flag(); }
        void refresh_constrain_flag() { if(duck_dragger_)duck_dragger_->constrain=get_constrain_flag(); }
 
-       Smach::event_result event_refresh_tool_options(const Smach::event& x);
-       void refresh_tool_options();
-
        StateNormal_Context(CanvasView* canvas_view);
 
        ~StateNormal_Context();
@@ -158,6 +155,18 @@ public:
        bool key_pressed(GdkEventKey *event);
        bool key_released(GdkEventKey *event);
 
+       Smach::event_result event_stop_handler(const Smach::event& x);
+       Smach::event_result event_refresh_handler(const Smach::event& x);
+       Smach::event_result event_refresh_ducks_handler(const Smach::event& x);
+       Smach::event_result event_undo_handler(const Smach::event& x);
+       Smach::event_result event_redo_handler(const Smach::event& x);
+       Smach::event_result event_mouse_button_down_handler(const Smach::event& x);
+       Smach::event_result event_multiple_ducks_clicked_handler(const Smach::event& x);
+       Smach::event_result event_refresh_tool_options(const Smach::event& x);
+       void refresh_tool_options();
+       Smach::event_result event_layer_click(const Smach::event& x);
+
+
 };     // END of class StateNormal_Context
 
 /* === M E T H O D S ======================================================= */
@@ -165,7 +174,16 @@ public:
 StateNormal::StateNormal():
        Smach::state<StateNormal_Context>("normal")
 {
+       insert(event_def(EVENT_STOP,&StateNormal_Context::event_stop_handler));
+       insert(event_def(EVENT_REFRESH,&StateNormal_Context::event_refresh_handler));
+       insert(event_def(EVENT_REFRESH_DUCKS,&StateNormal_Context::event_refresh_ducks_handler));
+       insert(event_def(EVENT_UNDO,&StateNormal_Context::event_undo_handler));
+       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));
+
 }
 
 StateNormal::~StateNormal()
@@ -234,8 +252,9 @@ StateNormal_Context::StateNormal_Context(CanvasView* canvas_view):
        keypress_connect=get_work_area()->signal_key_press_event().connect(sigc::mem_fun(*this,&StateNormal_Context::key_pressed),false);
        keyrelease_connect=get_work_area()->signal_key_release_event().connect(sigc::mem_fun(*this,&StateNormal_Context::key_released),false);
 
+       //these will segfault
 //     get_canvas_view()->work_area->set_cursor(Gdk::CROSSHAIR);
-       get_canvas_view()->work_area->reset_cursor();
+//     get_work_area()->reset_cursor();
 
        App::toolbox->refresh();
 
@@ -315,14 +334,6 @@ StateNormal_Context::~StateNormal_Context()
        App::toolbox->refresh();
 }
 
-
-Smach::event_result
-StateNormal_Context::event_refresh_tool_options(const Smach::event& /*x*/)
-{
-       refresh_tool_options();
-       return Smach::RESULT_ACCEPT;
-}
-
 DuckDrag_Combo::DuckDrag_Combo():
        scale(false),
        rotate(false),
@@ -524,3 +535,290 @@ DuckDrag_Combo::end_duck_drag(Duckmatic* duckmatic)
                return false;
        }
 }
+
+Smach::event_result
+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*/)
+{
+       // synfig::info("STATE NORMAL: Received Stop Event");
+       canvas_view_->stop();
+       return Smach::RESULT_ACCEPT;
+}
+
+Smach::event_result
+StateNormal_Context::event_refresh_handler(const Smach::event& /*x*/)
+{
+       // synfig::info("STATE NORMAL: Received Refresh Event");
+       canvas_view_->rebuild_tables();
+       canvas_view_->work_area->queue_render_preview();
+       return Smach::RESULT_ACCEPT;
+}
+
+Smach::event_result
+StateNormal_Context::event_refresh_ducks_handler(const Smach::event& /*x*/)
+{
+       // synfig::info("STATE NORMAL: Received Refresh Ducks");
+       canvas_view_->queue_rebuild_ducks();
+       return Smach::RESULT_ACCEPT;
+}
+
+Smach::event_result
+StateNormal_Context::event_undo_handler(const Smach::event& /*x*/)
+{
+       // synfig::info("STATE NORMAL: Received Undo Event");
+       canvas_view_->get_instance()->undo();
+       return Smach::RESULT_ACCEPT;
+}
+
+Smach::event_result
+StateNormal_Context::event_redo_handler(const Smach::event& /*x*/)
+{
+       // synfig::info("STATE NORMAL: Received Redo Event");
+       canvas_view_->get_instance()->redo();
+       return Smach::RESULT_ACCEPT;
+}
+
+Smach::event_result
+StateNormal_Context::event_mouse_button_down_handler(const Smach::event& x)
+{
+       // synfig::info("STATE NORMAL: Received mouse button down Event");
+
+       const EventMouse& event(*reinterpret_cast<const EventMouse*>(&x));
+
+       switch(event.button)
+       {
+       case BUTTON_RIGHT:
+               canvas_view_->popup_main_menu();
+               return Smach::RESULT_ACCEPT;
+       default:
+               return Smach::RESULT_OK;
+       }
+}
+
+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());
+       }
+       else
+       {
+               // synfig::info("STATE NORMAL: Received layer click Event with an empty layer.");
+       }
+
+       switch(event.button)
+       {
+       case BUTTON_LEFT:
+               if(!(event.modifier&Gdk::CONTROL_MASK))
+                       canvas_view_->get_selection_manager()->clear_selected_layers();
+               if(event.layer)
+               {
+                       std::list<Layer::Handle> layer_list(canvas_view_->get_selection_manager()->get_selected_layers());
+                       std::set<Layer::Handle> layers(layer_list.begin(),layer_list.end());
+                       if(layers.count(event.layer))
+                       {
+                               layers.erase(event.layer);
+                               layer_list=std::list<Layer::Handle>(layers.begin(),layers.end());
+                               canvas_view_->get_selection_manager()->clear_selected_layers();
+                               canvas_view_->get_selection_manager()->set_selected_layers(layer_list);
+                       }
+                       else
+                       {
+                               canvas_view_->get_selection_manager()->set_selected_layer(event.layer);
+                       }
+               }
+               return Smach::RESULT_ACCEPT;
+       case BUTTON_RIGHT:
+               canvas_view_->popup_layer_menu(event.layer);
+               return Smach::RESULT_ACCEPT;
+       default:
+               return Smach::RESULT_OK;
+       }
+}
+
+/*
+void
+StateNormal_Context::edit_several_waypoints(std::list<synfigapp::ValueDesc> value_desc_list)
+{
+       Gtk::Dialog dialog(
+               "Edit Multiple Waypoints",              // Title
+               true,           // Modal
+               true            // use_separator
+       );
+
+       Widget_WaypointModel widget_waypoint_model;
+       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();
+
+       if(dialog.run()==0)
+               return;
+       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.
+               if(!value_desc.is_value_node() || ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node()))
+               {
+                       ValueBase value;
+                       if(value_desc.is_value_node())
+                               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("ValueDescConnect");
+                               action->set_param("dest",value_desc);
+                               action->set_param("src",ValueNode::Handle(value_node));
+                       }
+                       else
+                       {
+                               action=synfigapp::Action::create("ValueNodeReplace");
+                               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"));
+                               group.cancel();
+                               return;
+                       }
+               }
+               else
+               {
+                       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("WaypointSetSmart"));
+
+                       if(!action)
+                       {
+                               get_canvas_view()->get_ui_interface()->error(_("Unable to find WaypointSetSmart action"));
+                               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("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"));
+                               group.cancel();
+                               return;
+                       }
+               }
+               else
+               {
+                       //get_canvas_view()->get_ui_interface()->error(_("Unable to animate a specific valuedesc"));
+                       //group.cancel();
+                       //return;
+               }
+
+       }
+}
+*/
+
+Smach::event_result
+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(
+                               synfigapp::ValueDesc(
+                                       ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node())
+                                       ,ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node())
+                                                               ->get_link_index_from_name("point")
+                               )
+                       );
+               }
+               else
+                       value_desc_list.push_back(value_desc);
+       }
+
+       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);
+
+       canvas_view_->add_actions_to_menu(menu, param_list,synfigapp::Action::CATEGORY_VALUEDESC|synfigapp::Action::CATEGORY_VALUENODE);
+
+       menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Edit Waypoints"),
+               sigc::bind(
+                       sigc::mem_fun(
+                               *this,
+                               &studio::StateNormal_Context::edit_several_waypoints
+                       ),
+                       value_desc_list
+               )
+       ));
+       */
+       menu->popup(3,gtk_get_current_event_time());
+
+       return Smach::RESULT_ACCEPT;
+}
+
+
diff --git a/synfig-studio/src/gtkmm/state_null.cpp b/synfig-studio/src/gtkmm/state_null.cpp
deleted file mode 100644 (file)
index 4bbf96b..0000000
+++ /dev/null
@@ -1,425 +0,0 @@
-/* === S Y N F I G ========================================================= */
-/*!    \file state_null.cpp
-**     \brief Null State File
-**
-**     $Id$
-**
-**     \legal
-**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**     Copyright (c) 2007, 2008 Chris Moore
-**     Copyright (c) 2009 Nikita Kitaev
-**
-**     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.
-**
-**     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
-*/
-/* ========================================================================= */
-
-/* === H E A D E R S ======================================================= */
-
-#ifdef USING_PCH
-#      include "pch.h"
-#else
-#ifdef HAVE_CONFIG_H
-#      include <config.h>
-#endif
-
-#include "state_null.h"
-#include "workarea.h"
-#include "event_mouse.h"
-#include "event_layerclick.h"
-#include "toolbox.h"
-#include "dialog_tooloptions.h"
-#include <gtkmm/dialog.h>
-#include "widget_waypointmodel.h"
-#include <synfig/valuenode_animated.h>
-#include <synfig/valuenode_composite.h>
-#include <synfig/valuenode_const.h>
-#include "canvasview.h"
-#include "general.h"
-
-#endif
-
-/* === U S I N G =========================================================== */
-
-using namespace std;
-using namespace etl;
-using namespace synfig;
-using namespace studio;
-
-/* === M A C R O S ========================================================= */
-
-/* === G L O B A L S ======================================================= */
-
-StateNull studio::state_null;
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-class studio::StateNull_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(); }
-
-       Gtk::Table options_table;
-
-public:
-       StateNull_Context(CanvasView *canvas_view);
-       ~StateNull_Context();
-
-       Smach::event_result event_stop_handler(const Smach::event& x);
-       Smach::event_result event_refresh_handler(const Smach::event& x);
-       Smach::event_result event_refresh_ducks_handler(const Smach::event& x);
-       Smach::event_result event_undo_handler(const Smach::event& x);
-       Smach::event_result event_redo_handler(const Smach::event& x);
-       Smach::event_result event_mouse_button_down_handler(const Smach::event& x);
-       Smach::event_result event_multiple_ducks_clicked_handler(const Smach::event& x);
-       Smach::event_result event_refresh_tool_options(const Smach::event& x);
-       Smach::event_result event_layer_click(const Smach::event& x);
-
-       void refresh_tool_options();
-}; // END of class StateNull_Context
-
-/* === P R O C E D U R E S ================================================= */
-
-/* === M E T H O D S ======================================================= */
-
-StateNull::StateNull():
-       Smach::state<StateNull_Context>("null")
-{
-       insert(event_def(EVENT_STOP,&StateNull_Context::event_stop_handler));
-       insert(event_def(EVENT_REFRESH,&StateNull_Context::event_refresh_handler));
-       insert(event_def(EVENT_REFRESH_DUCKS,&StateNull_Context::event_refresh_ducks_handler));
-       insert(event_def(EVENT_UNDO,&StateNull_Context::event_undo_handler));
-       insert(event_def(EVENT_REDO,&StateNull_Context::event_redo_handler));
-       insert(event_def(EVENT_WORKAREA_MOUSE_BUTTON_DOWN,&StateNull_Context::event_mouse_button_down_handler));
-       insert(event_def(EVENT_WORKAREA_MULTIPLE_DUCKS_CLICKED,&StateNull_Context::event_multiple_ducks_clicked_handler));
-       insert(event_def(EVENT_REFRESH_TOOL_OPTIONS,&StateNull_Context::event_refresh_tool_options));
-       insert(event_def(EVENT_WORKAREA_LAYER_CLICKED,&StateNull_Context::event_layer_click));
-}
-
-StateNull::~StateNull()
-{
-}
-
-StateNull_Context::StateNull_Context(CanvasView *canvas_view):
-       canvas_view(canvas_view)
-{
-       // Synfig Studio's default state is initialized in the canvas view constructor
-       // As a result, it cannot reference canvas view or workarea when created
-       // Other states need to reference the workarea,
-       //    so a null state was created to be the default
-
-       options_table.attach(*manage(new Gtk::Label(_("Welcome to Synfig Studio"))),    0, 2,  0,  1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.show_all();
-       refresh_tool_options();
-}
-
-StateNull_Context::~StateNull_Context()
-{
-}
-
-void
-StateNull_Context::refresh_tool_options()
-{
-       App::dialog_tool_options->clear();
-       App::dialog_tool_options->set_widget(options_table);
-       App::dialog_tool_options->set_local_name(_("Welcome to Synfig Studio"));
-       App::dialog_tool_options->set_name("null");
-}
-
-Smach::event_result
-StateNull_Context::event_refresh_tool_options(const Smach::event& /*x*/)
-{
-       refresh_tool_options();
-       return Smach::RESULT_ACCEPT;
-}
-
-Smach::event_result
-StateNull_Context::event_stop_handler(const Smach::event& /*x*/)
-{
-       // synfig::info("STATE NULL: Received Stop Event");
-       canvas_view->stop();
-       return Smach::RESULT_ACCEPT;
-}
-
-Smach::event_result
-StateNull_Context::event_refresh_handler(const Smach::event& /*x*/)
-{
-       // synfig::info("STATE NULL: Received Refresh Event");
-       canvas_view->rebuild_tables();
-       canvas_view->work_area->queue_render_preview();
-       return Smach::RESULT_ACCEPT;
-}
-
-Smach::event_result
-StateNull_Context::event_refresh_ducks_handler(const Smach::event& /*x*/)
-{
-       // synfig::info("STATE NULL: Received Refresh Ducks");
-       canvas_view->queue_rebuild_ducks();
-       return Smach::RESULT_ACCEPT;
-}
-
-Smach::event_result
-StateNull_Context::event_undo_handler(const Smach::event& /*x*/)
-{
-       // synfig::info("STATE NULL: Received Undo Event");
-       canvas_view->get_instance()->undo();
-       return Smach::RESULT_ACCEPT;
-}
-
-Smach::event_result
-StateNull_Context::event_redo_handler(const Smach::event& /*x*/)
-{
-       // synfig::info("STATE NULL: Received Redo Event");
-       canvas_view->get_instance()->redo();
-       return Smach::RESULT_ACCEPT;
-}
-
-Smach::event_result
-StateNull_Context::event_mouse_button_down_handler(const Smach::event& x)
-{
-       // synfig::info("STATE NULL: Received mouse button down Event");
-
-       const EventMouse& event(*reinterpret_cast<const EventMouse*>(&x));
-
-       switch(event.button)
-       {
-       case BUTTON_RIGHT:
-               canvas_view->popup_main_menu();
-               return Smach::RESULT_ACCEPT;
-       default:
-               return Smach::RESULT_OK;
-       }
-}
-
-Smach::event_result
-StateNull_Context::event_layer_click(const Smach::event& x)
-{
-       const EventLayerClick& event(*reinterpret_cast<const EventLayerClick*>(&x));
-
-       if(event.layer)
-       {
-               // synfig::info("STATE NULL: Received layer click Event, \"%s\"",event.layer->get_name().c_str());
-       }
-       else
-       {
-               // synfig::info("STATE NULL: Received layer click Event with an empty layer.");
-       }
-
-       switch(event.button)
-       {
-       case BUTTON_LEFT:
-               if(!(event.modifier&Gdk::CONTROL_MASK))
-                       canvas_view->get_selection_manager()->clear_selected_layers();
-               if(event.layer)
-               {
-                       std::list<Layer::Handle> layer_list(canvas_view->get_selection_manager()->get_selected_layers());
-                       std::set<Layer::Handle> layers(layer_list.begin(),layer_list.end());
-                       if(layers.count(event.layer))
-                       {
-                               layers.erase(event.layer);
-                               layer_list=std::list<Layer::Handle>(layers.begin(),layers.end());
-                               canvas_view->get_selection_manager()->clear_selected_layers();
-                               canvas_view->get_selection_manager()->set_selected_layers(layer_list);
-                       }
-                       else
-                       {
-                               canvas_view->get_selection_manager()->set_selected_layer(event.layer);
-                       }
-               }
-               return Smach::RESULT_ACCEPT;
-       case BUTTON_RIGHT:
-               canvas_view->popup_layer_menu(event.layer);
-               return Smach::RESULT_ACCEPT;
-       default:
-               return Smach::RESULT_OK;
-       }
-}
-
-/*
-void
-StateNull_Context::edit_several_waypoints(std::list<synfigapp::ValueDesc> value_desc_list)
-{
-       Gtk::Dialog dialog(
-               "Edit Multiple Waypoints",              // Title
-               true,           // Modal
-               true            // use_separator
-       );
-
-       Widget_WaypointModel widget_waypoint_model;
-       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();
-
-       if(dialog.run()==0)
-               return;
-       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.
-               if(!value_desc.is_value_node() || ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node()))
-               {
-                       ValueBase value;
-                       if(value_desc.is_value_node())
-                               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("ValueDescConnect");
-                               action->set_param("dest",value_desc);
-                               action->set_param("src",ValueNode::Handle(value_node));
-                       }
-                       else
-                       {
-                               action=synfigapp::Action::create("ValueNodeReplace");
-                               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"));
-                               group.cancel();
-                               return;
-                       }
-               }
-               else
-               {
-                       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("WaypointSetSmart"));
-
-                       if(!action)
-                       {
-                               get_canvas_view()->get_ui_interface()->error(_("Unable to find WaypointSetSmart action"));
-                               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("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"));
-                               group.cancel();
-                               return;
-                       }
-               }
-               else
-               {
-                       //get_canvas_view()->get_ui_interface()->error(_("Unable to animate a specific valuedesc"));
-                       //group.cancel();
-                       //return;
-               }
-
-       }
-}
-*/
-
-Smach::event_result
-StateNull_Context::event_multiple_ducks_clicked_handler(const Smach::event& /*x*/)
-{
-       // synfig::info("STATE NULL: 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(
-                               synfigapp::ValueDesc(
-                                       ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node())
-                                       ,ValueNode_Composite::Handle::cast_dynamic(value_desc.get_value_node())
-                                                               ->get_link_index_from_name("point")
-                               )
-                       );
-               }
-               else
-                       value_desc_list.push_back(value_desc);
-       }
-
-       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);
-
-       canvas_view->add_actions_to_menu(menu, param_list,synfigapp::Action::CATEGORY_VALUEDESC|synfigapp::Action::CATEGORY_VALUENODE);
-
-       menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Edit Waypoints"),
-               sigc::bind(
-                       sigc::mem_fun(
-                               *this,
-                               &studio::StateNull_Context::edit_several_waypoints
-                       ),
-                       value_desc_list
-               )
-       ));
-       */
-       menu->popup(3,gtk_get_current_event_time());
-
-       return Smach::RESULT_ACCEPT;
-}
-
diff --git a/synfig-studio/src/gtkmm/state_null.h b/synfig-studio/src/gtkmm/state_null.h
deleted file mode 100644 (file)
index 9923154..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/* === S Y N F I G ========================================================= */
-/*!    \file state_null.h
-**     \brief Null State Header
-**
-**     $Id$
-**
-**     \legal
-**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**     Copyright (c) 2009 Nikita Kitaev
-**
-**     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.
-**
-**     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
-*/
-/* ========================================================================= */
-
-/* === S T A R T =========================================================== */
-
-#ifndef __SYNFIG_STATE_NULL_H
-#define __SYNFIG_STATE_NULL_H
-
-/* === H E A D E R S ======================================================= */
-
-#include "smach.h"
-
-
-/* === M A C R O S ========================================================= */
-
-/* === T Y P E D E F S ===================================================== */
-
-/* === C L A S S E S & S T R U C T S ======================================= */
-
-namespace studio {
-
-class StateNull_Context;
-
-class StateNull : public Smach::state<StateNull_Context>
-{
-public:
-       StateNull();
-       ~StateNull();
-}; // END of class StateNull
-
-extern StateNull state_null;
-
-}; // END of namespace studio
-
-/* === E N D =============================================================== */
-
-#endif