From: Carlos Lopez Date: Wed, 13 Jan 2010 17:36:15 +0000 (+0100) Subject: Enable stop button and escape key to return to normal tool for smooth move, rotate... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=fb4c7c2d507d4bb86a73ca184232937d36844d7e;p=synfig.git Enable stop button and escape key to return to normal tool for smooth move, rotate, scale and mirror tools --- diff --git a/synfig-studio/src/gtkmm/mod_mirror/state_mirror.cpp b/synfig-studio/src/gtkmm/mod_mirror/state_mirror.cpp index 5843a6a..a2594ad 100644 --- a/synfig-studio/src/gtkmm/mod_mirror/state_mirror.cpp +++ b/synfig-studio/src/gtkmm/mod_mirror/state_mirror.cpp @@ -37,6 +37,7 @@ #include #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 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("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() { diff --git a/synfig-studio/src/gtkmm/state_rotate.cpp b/synfig-studio/src/gtkmm/state_rotate.cpp index 1635500..64d2e35 100644 --- a/synfig-studio/src/gtkmm/state_rotate.cpp +++ b/synfig-studio/src/gtkmm/state_rotate.cpp @@ -37,6 +37,7 @@ #include #include "state_rotate.h" +#include "state_normal.h" #include "canvasview.h" #include "workarea.h" #include "app.h" @@ -106,6 +107,7 @@ public: class studio::StateRotate_Context : public sigc::trackable { etl::handle canvas_view_; + CanvasView::IsWorking is_working; synfigapp::Settings& settings; @@ -120,7 +122,7 @@ public: bool get_scale_flag()const { return checkbutton_scale.get_active(); } void set_scale_flag(bool x) { return checkbutton_scale.set_active(x); refresh_scale_flag(); } - + 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(); @@ -146,6 +148,7 @@ StateRotate::StateRotate(): Smach::state("rotate") { insert(event_def(EVENT_REFRESH_TOOL_OPTIONS,&StateRotate_Context::event_refresh_tool_options)); + insert(event_def(EVENT_STOP,&StateRotate_Context::event_stop_handler)); } StateRotate::~StateRotate() @@ -171,6 +174,7 @@ StateRotate_Context::save_settings() StateRotate_Context::StateRotate_Context(CanvasView* canvas_view): canvas_view_(canvas_view), + is_working(*canvas_view), settings(synfigapp::Main::get_selected_input_device()->settings()), duck_dragger_(new DuckDrag_Rotate()), checkbutton_scale(_("Allow Scale")) @@ -216,6 +220,13 @@ StateRotate_Context::event_refresh_tool_options(const Smach::event& /*x*/) return Smach::RESULT_ACCEPT; } +Smach::event_result +StateRotate_Context::event_stop_handler(const Smach::event& /*x*/) +{ + throw &state_normal; + return Smach::RESULT_OK; +} + StateRotate_Context::~StateRotate_Context() { save_settings(); diff --git a/synfig-studio/src/gtkmm/state_scale.cpp b/synfig-studio/src/gtkmm/state_scale.cpp index 300ff4b..bd2305b 100644 --- a/synfig-studio/src/gtkmm/state_scale.cpp +++ b/synfig-studio/src/gtkmm/state_scale.cpp @@ -37,6 +37,7 @@ #include #include "state_scale.h" +#include "state_normal.h" #include "canvasview.h" #include "workarea.h" #include "app.h" @@ -94,6 +95,7 @@ public: class studio::StateScale_Context : public sigc::trackable { etl::handle canvas_view_; + CanvasView::IsWorking is_working; synfigapp::Settings& settings; @@ -111,6 +113,7 @@ public: void refresh_aspect_lock_flag() { if(duck_dragger_)duck_dragger_->lock_aspect=get_aspect_lock_flag(); } + 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(); @@ -134,6 +137,7 @@ StateScale::StateScale(): Smach::state("scale") { insert(event_def(EVENT_REFRESH_TOOL_OPTIONS,&StateScale_Context::event_refresh_tool_options)); + insert(event_def(EVENT_STOP,&StateScale_Context::event_stop_handler)); } StateScale::~StateScale() @@ -159,6 +163,7 @@ StateScale_Context::save_settings() StateScale_Context::StateScale_Context(CanvasView* canvas_view): canvas_view_(canvas_view), + is_working(*canvas_view), settings(synfigapp::Main::get_selected_input_device()->settings()), duck_dragger_(new DuckDrag_Scale()), checkbutton_aspect_lock(_("Lock Aspect Ratio")) @@ -201,6 +206,13 @@ StateScale_Context::event_refresh_tool_options(const Smach::event& /*x*/) return Smach::RESULT_ACCEPT; } +Smach::event_result +StateScale_Context::event_stop_handler(const Smach::event& /*x*/) +{ + throw &state_normal; + return Smach::RESULT_OK; +} + StateScale_Context::~StateScale_Context() { save_settings(); diff --git a/synfig-studio/src/gtkmm/state_smoothmove.cpp b/synfig-studio/src/gtkmm/state_smoothmove.cpp index 85442cf..57862d8 100644 --- a/synfig-studio/src/gtkmm/state_smoothmove.cpp +++ b/synfig-studio/src/gtkmm/state_smoothmove.cpp @@ -40,6 +40,7 @@ #include #include "state_smoothmove.h" +#include "state_normal.h" #include "canvasview.h" #include "workarea.h" #include "app.h" @@ -98,6 +99,7 @@ public: class studio::StateSmoothMove_Context : public sigc::trackable { etl::handle canvas_view_; + CanvasView::IsWorking is_working; //Duckmatic::Push duckmatic_push; @@ -143,6 +145,7 @@ StateSmoothMove::StateSmoothMove(): Smach::state("smooth_move") { insert(event_def(EVENT_REFRESH_TOOL_OPTIONS,&StateSmoothMove_Context::event_refresh_tool_options)); + insert(event_def(EVENT_STOP,&StateSmoothMove_Context::event_stop_handler)); } StateSmoothMove::~StateSmoothMove() @@ -168,6 +171,7 @@ StateSmoothMove_Context::save_settings() StateSmoothMove_Context::StateSmoothMove_Context(CanvasView* canvas_view): canvas_view_(canvas_view), + is_working(*canvas_view), // duckmatic_push(get_work_area()), settings(synfigapp::Main::get_selected_input_device()->settings()), duck_dragger_(new DuckDrag_SmoothMove()), @@ -215,6 +219,13 @@ StateSmoothMove_Context::event_refresh_tool_options(const Smach::event& /*x*/) return Smach::RESULT_ACCEPT; } +Smach::event_result +StateSmoothMove_Context::event_stop_handler(const Smach::event& /*x*/) +{ + throw &state_normal; + return Smach::RESULT_OK; +} + StateSmoothMove_Context::~StateSmoothMove_Context() { save_settings();