** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
** Copyright (c) 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
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
+#include <synfig/valuenode_blinecalcvertex.h>
+#include <synfig/valuenode_composite.h>
#include <synfig/valuenode_dynamiclist.h>
#include <synfigapp/action_system.h>
#include "state_smoothmove.h"
+#include "state_normal.h"
#include "canvasview.h"
#include "workarea.h"
#include "app.h"
class studio::StateSmoothMove_Context : public sigc::trackable
{
etl::handle<CanvasView> canvas_view_;
+ CanvasView::IsWorking is_working;
//Duckmatic::Push duckmatic_push;
Smach::state<StateSmoothMove_Context>("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()
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()),
App::toolbox->refresh();
-// get_canvas_view()->work_area->set_cursor(Gdk::CROSSHAIR);
- get_canvas_view()->work_area->reset_cursor();
+ get_work_area()->set_cursor(Gdk::FLEUR);
+ //get_work_area()->reset_cursor();
load_settings();
}
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();
get_work_area()->clear_duck_dragger();
- get_canvas_view()->work_area->reset_cursor();
+ get_work_area()->reset_cursor();
App::dialog_tool_options->clear();
int i;
+ Time time(duckmatic->get_time());
+
// process vertex and position ducks first
for(i=0,iter=selected_ducks.begin();iter!=selected_ducks.end();++iter,i++)
{
dist=0;
last_[i]=vect*dist;
- (*iter)->set_trans_point(p+last_[i]);
+ (*iter)->set_trans_point(p+last_[i], time);
}
// then process non vertex and non position ducks
dist=0;
last_[i]=vect*dist;
- (*iter)->set_trans_point(p+last_[i]);
+ (*iter)->set_trans_point(p+last_[i], time);
}
+ // then patch up the tangents for the vertices we've moved
+ duckmatic->update_ducks();
+
last_translate_=vect;
//snap=Vector(0,0);
}
for(i=0,iter=selected_ducks.begin();iter!=selected_ducks.end();++iter,i++)
{
if(last_[i].mag()>0.0001)
- if(!(*iter)->signal_edited()((*iter)->get_point()))
{
- throw String("Bad Move");
+ if ((*iter)->get_type() == Duck::TYPE_ANGLE)
+ {
+ if(!(*iter)->signal_edited_angle()((*iter)->get_rotations()))
+ {
+ throw String("Bad edit");
+ }
+ }
+ else if (App::restrict_radius_ducks &&
+ (*iter)->is_radius())
+ {
+ Point point((*iter)->get_point());
+ bool changed = false;
+
+ if (point[0] < 0)
+ {
+ point[0] = 0;
+ changed = true;
+ }
+ if (point[1] < 0)
+ {
+ point[1] = 0;
+ changed = true;
+ }
+
+ if (changed) (*iter)->set_point(point);
+
+ if(!(*iter)->signal_edited()(point))
+ {
+ throw String("Bad edit");
+ }
+ }
+ else
+ {
+ if(!(*iter)->signal_edited()((*iter)->get_point()))
+ {
+ throw String("Bad edit");
+ }
+ }
}
}
//duckmatic->get_selected_ducks()=new_set;