etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
synfig::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
WorkArea * get_work_area()const{return canvas_view_->get_work_area();}
etl::handle<synfigapp::CanvasInterface> get_canvas_interface()const{return canvas_view_->canvas_interface();}
synfig::Canvas::Handle get_canvas()const{return canvas_view_->get_canvas();}
WorkArea * get_work_area()const{return canvas_view_->get_work_area();}
- bool no_egress_on_selection_change;
- Smach::event_result event_layer_selection_changed_handler(const Smach::event& x)
+ bool egress_on_selection_change;
+ Smach::event_result event_layer_selection_changed_handler(const Smach::event& /*x*/)
insert(event_def(EVENT_REFRESH_DUCKS,&StatePolygon_Context::event_refresh_handler));
insert(event_def(EVENT_WORKAREA_MOUSE_BUTTON_DOWN,&StatePolygon_Context::event_mouse_click_handler));
insert(event_def(EVENT_REFRESH_TOOL_OPTIONS,&StatePolygon_Context::event_refresh_tool_options));
insert(event_def(EVENT_REFRESH_DUCKS,&StatePolygon_Context::event_refresh_handler));
insert(event_def(EVENT_WORKAREA_MOUSE_BUTTON_DOWN,&StatePolygon_Context::event_mouse_click_handler));
insert(event_def(EVENT_REFRESH_TOOL_OPTIONS,&StatePolygon_Context::event_refresh_tool_options));
{
// figure out how many digits it is
for(digits=0;(int)id.size()-1>=digits && id[id.size()-1-digits]<='9' && id[id.size()-1-digits]>='0';digits++)while(false);
{
// figure out how many digits it is
for(digits=0;(int)id.size()-1>=digits && id[id.size()-1-digits]<='9' && id[id.size()-1-digits]>='0';digits++)while(false);
String str_number;
str_number=String(id,id.size()-digits,id.size());
id=String(id,0,id.size()-digits);
String str_number;
str_number=String(id,id.size()-digits,id.size());
id=String(id,0,id.size()-digits);
// Add the number back onto the id
{
const String format(strprintf("%%0%dd",digits));
id+=strprintf(format.c_str(),number);
}
// Add the number back onto the id
{
const String format(strprintf("%%0%dd",digits));
id+=strprintf(format.c_str(),number);
}
StatePolygon_Context::StatePolygon_Context(CanvasView* canvas_view):
canvas_view_(canvas_view),
is_working(*canvas_view),
StatePolygon_Context::StatePolygon_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()),
entry_id(),
button_make(_("Make"))
{
duckmatic_push(get_work_area()),
settings(synfigapp::Main::get_selected_input_device()->settings()),
entry_id(),
button_make(_("Make"))
{
- //options_table.attach(*manage(new Gtk::Label(_("Polygon Tool"))), 0, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+ //options_table.attach(*manage(new Gtk::Label(_("Polygon Tool"))), 0, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
options_table.attach(entry_id, 0, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
options_table.attach(entry_id, 0, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
- //options_table.attach(button_make, 0, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+ //options_table.attach(button_make, 0, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
button_make.signal_pressed().connect(sigc::mem_fun(*this,&StatePolygon_Context::run));
options_table.show_all();
refresh_tool_options();
button_make.signal_pressed().connect(sigc::mem_fun(*this,&StatePolygon_Context::run));
options_table.show_all();
refresh_tool_options();
// Hide the tables if they are showing
prev_table_status=get_canvas_view()->tables_are_visible();
if(prev_table_status)get_canvas_view()->hide_tables();
// Hide the tables if they are showing
prev_table_status=get_canvas_view()->tables_are_visible();
if(prev_table_status)get_canvas_view()->hide_tables();
// Bring back the tables if they were out before
if(prev_table_status)get_canvas_view()->show_tables();
// Bring back the tables if they were out before
if(prev_table_status)get_canvas_view()->show_tables();
{
synfig::info("STATE RotoPolygon: Received Stop Event");
//throw Smach::egress_exception();
reset();
return Smach::RESULT_ACCEPT;
{
synfig::info("STATE RotoPolygon: Received Stop Event");
//throw Smach::egress_exception();
reset();
return Smach::RESULT_ACCEPT;
if(polygon_point_list.size()<3)
{
get_canvas_view()->get_ui_interface()->error("You need at least 3 points to create a polygon");
if(polygon_point_list.size()<3)
{
get_canvas_view()->get_ui_interface()->error("You need at least 3 points to create a polygon");
// we are temporarily using the layer to hold something
layer=get_canvas_view()->get_selection_manager()->get_selected_layer();
if(layer)
// we are temporarily using the layer to hold something
layer=get_canvas_view()->get_selection_manager()->get_selected_layer();
if(layer)
{
synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("New Polygon"));
synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
{
synfigapp::Action::PassiveGrouper group(get_canvas_interface()->get_instance().get(),_("New Polygon"));
synfigapp::PushMode push_mode(get_canvas_interface(),synfigapp::MODE_NORMAL);
Layer::Handle layer(get_canvas_interface()->add_layer_to("polygon",canvas,depth));
layer->set_description(get_id());
get_canvas_interface()->signal_layer_new_description()(layer,layer->get_description());
Layer::Handle layer(get_canvas_interface()->add_layer_to("polygon",canvas,depth));
layer->set_description(get_id());
get_canvas_interface()->signal_layer_new_description()(layer,layer->get_description());
layer->disconnect_dynamic_param("vector_list");
if(!layer->set_param("vector_list",polygon_point_list))
{
layer->disconnect_dynamic_param("vector_list");
if(!layer->set_param("vector_list",polygon_point_list))
{
{
synfigapp::Action::Handle action(synfigapp::Action::create("value_desc_convert"));
synfigapp::ValueDesc value_desc(layer,"vector_list");
{
synfigapp::Action::Handle action(synfigapp::Action::create("value_desc_convert"));
synfigapp::ValueDesc value_desc(layer,"vector_list");
- action->set_param("canvas",get_canvas());
- action->set_param("canvas_interface",get_canvas_interface());
- action->set_param("value_desc",value_desc);
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("value_desc",value_desc);
action->set_param("type","dynamic_list");
if(!get_canvas_interface()->get_instance()->perform_action(action))
{
action->set_param("type","dynamic_list");
if(!get_canvas_interface()->get_instance()->perform_action(action))
{
get_canvas_interface()->get_selection_manager()->clear_selected_layers();
get_canvas_interface()->get_selection_manager()->set_selected_layer(layer);
get_canvas_interface()->get_selection_manager()->clear_selected_layers();
get_canvas_interface()->get_selection_manager()->set_selected_layer(layer);
polygon_point_list.push_back(get_work_area()->snap_point_to_grid(event.pos));
refresh_ducks();
return Smach::RESULT_ACCEPT;
polygon_point_list.push_back(get_work_area()->snap_point_to_grid(event.pos));
refresh_ducks();
return Smach::RESULT_ACCEPT;
-
- case BUTTON_RIGHT: // Intercept the right-button click to short-circut the pop-up menu
- return Smach::RESULT_ACCEPT;
-
- default:
+
+ case BUTTON_RIGHT: // Intercept the right-button click to short-circuit the pop-up menu
+ if (!getenv("SYNFIG_ENABLE_POPUP_MENU_IN_ALL_TOOLS"))
+ return Smach::RESULT_ACCEPT;
+
+ default:
if(polygon_point_list.empty()) return;
std::list<synfig::Point>::iterator iter=polygon_point_list.begin();
if(polygon_point_list.empty()) return;
std::list<synfig::Point>::iterator iter=polygon_point_list.begin();
etl::handle<WorkArea::Duck> duck;
duck=new WorkArea::Duck(*iter);
duck->set_editable(true);
etl::handle<WorkArea::Duck> duck;
duck=new WorkArea::Duck(*iter);
duck->set_editable(true);
sigc::bind(sigc::mem_fun(*this,&studio::StatePolygon_Context::on_polygon_duck_change),iter)
);
duck->signal_user_click(0).connect(sigc::mem_fun(*this,&StatePolygon_Context::run));
sigc::bind(sigc::mem_fun(*this,&studio::StatePolygon_Context::on_polygon_duck_change),iter)
);
duck->signal_user_click(0).connect(sigc::mem_fun(*this,&StatePolygon_Context::run));
duck->set_name(strprintf("%x",&*iter));
duck->signal_edited().connect(
sigc::bind(sigc::mem_fun(*this,&studio::StatePolygon_Context::on_polygon_duck_change),iter)
duck->set_name(strprintf("%x",&*iter));
duck->signal_edited().connect(
sigc::bind(sigc::mem_fun(*this,&studio::StatePolygon_Context::on_polygon_duck_change),iter)