Enable stop button and escape key to return to normal tool for smooth move, rotate...
[synfig.git] / synfig-studio / src / gtkmm / mod_mirror / state_mirror.cpp
index 5843a6a..a2594ad 100644 (file)
@@ -37,6 +37,7 @@
 #include <synfigapp/action_system.h>
 
 #include "state_mirror.h"
+#include "../state_normal.h"
 #include "../canvasview.h"
 #include "../workarea.h"
 #include "../app.h"
@@ -92,6 +93,7 @@ public:
 class studio::StateMirror_Context : public sigc::trackable
 {
        etl::handle<CanvasView> canvas_view_;
+       CanvasView::IsWorking is_working;
 
        synfigapp::Settings& settings;
 
@@ -124,6 +126,7 @@ public:
                duck_dragger_->axis=get_axis();
        }
 
+       Smach::event_result event_stop_handler(const Smach::event& x);
        Smach::event_result event_refresh_tool_options(const Smach::event& x);
 
        void refresh_tool_options();
@@ -149,6 +152,7 @@ StateMirror::StateMirror():
        Smach::state<StateMirror_Context>("mirror")
 {
        insert(event_def(EVENT_REFRESH_TOOL_OPTIONS,&StateMirror_Context::event_refresh_tool_options));
+       insert(event_def(EVENT_STOP,&StateMirror_Context::event_stop_handler));
 }
 
 StateMirror::~StateMirror()
@@ -172,6 +176,7 @@ StateMirror_Context::save_settings()
 
 StateMirror_Context::StateMirror_Context(CanvasView* canvas_view):
        canvas_view_(canvas_view),
+       is_working(*canvas_view),
        settings(synfigapp::Main::get_selected_input_device()->settings()),
        duck_dragger_(new DuckDrag_Mirror()),
        radiobutton_axis_x(radiobutton_group,_("Horizontal")),
@@ -230,6 +235,12 @@ StateMirror_Context::event_refresh_tool_options(const Smach::event& /*x*/)
        return Smach::RESULT_ACCEPT;
 }
 
+Smach::event_result
+StateMirror_Context::event_stop_handler(const Smach::event& /*x*/)
+{
+       throw &state_normal;
+       return Smach::RESULT_OK;
+}
 
 StateMirror_Context::~StateMirror_Context()
 {