X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftags%2Fstable%2Fsrc%2Fgtkmm%2Fstate_polygon.cpp;h=942d6d865efa6b7ee3255be56daf48f8243c328f;hb=47fce282611fbba1044921d22ca887f9b53ad91a;hp=4701913b7be02e8c0fa0c276c44f5d53b3855657;hpb=f6184c2a9c2245aae802c31c8f3300e1b744359c;p=synfig.git diff --git a/synfig-studio/tags/stable/src/gtkmm/state_polygon.cpp b/synfig-studio/tags/stable/src/gtkmm/state_polygon.cpp index 4701913..942d6d8 100644 --- a/synfig-studio/tags/stable/src/gtkmm/state_polygon.cpp +++ b/synfig-studio/tags/stable/src/gtkmm/state_polygon.cpp @@ -6,6 +6,7 @@ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007, 2008 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -47,6 +48,8 @@ #include "dialog_tooloptions.h" #include +#include "general.h" + #endif /* === U S I N G =========================================================== */ @@ -118,10 +121,10 @@ public: void save_settings(); void reset(); void increment_id(); - 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*/) { - if(!no_egress_on_selection_change) + if(egress_on_selection_change) throw Smach::egress_exception(); return Smach::RESULT_OK; } @@ -186,7 +189,10 @@ StatePolygon_Context::increment_id() if(id[id.size()-1]<='9' && id[id.size()-1]>='0') { // 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); + for (digits = 0; + (int)id.size()-1 >= digits && id[id.size()-1-digits] <= '9' && id[id.size()-1-digits] >= '0'; + digits++) + ; String str_number; str_number=String(id,id.size()-digits,id.size()); @@ -215,18 +221,18 @@ StatePolygon_Context::increment_id() StatePolygon_Context::StatePolygon_Context(CanvasView* canvas_view): canvas_view_(canvas_view), is_working(*canvas_view), - prev_workarea_layer_status_(get_work_area()->allow_layer_clicks), + prev_workarea_layer_status_(get_work_area()->get_allow_layer_clicks()), duckmatic_push(get_work_area()), settings(synfigapp::Main::get_selected_input_device()->settings()), entry_id(), button_make(_("Make")) { - no_egress_on_selection_change=false; + egress_on_selection_change=true; load_settings(); // Set up the tool options dialog - //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(*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(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(); @@ -235,7 +241,7 @@ StatePolygon_Context::StatePolygon_Context(CanvasView* canvas_view): // Turn off layer clicking - get_work_area()->allow_layer_clicks=false; + get_work_area()->set_allow_layer_clicks(false); // clear out the ducks get_work_area()->clear_ducks(); @@ -289,7 +295,7 @@ StatePolygon_Context::refresh_tool_options() } Smach::event_result -StatePolygon_Context::event_refresh_tool_options(const Smach::event& x) +StatePolygon_Context::event_refresh_tool_options(const Smach::event& /*x*/) { refresh_tool_options(); return Smach::RESULT_ACCEPT; @@ -301,7 +307,7 @@ StatePolygon_Context::~StatePolygon_Context() save_settings(); // Restore layer clicking - get_work_area()->allow_layer_clicks=prev_workarea_layer_status_; + get_work_area()->set_allow_layer_clicks(prev_workarea_layer_status_); App::dialog_tool_options->clear(); @@ -320,7 +326,7 @@ StatePolygon_Context::~StatePolygon_Context() } Smach::event_result -StatePolygon_Context::event_stop_handler(const Smach::event& x) +StatePolygon_Context::event_stop_handler(const Smach::event& /*x*/) { synfig::info("STATE RotoPolygon: Received Stop Event"); //throw Smach::egress_exception(); @@ -330,7 +336,7 @@ StatePolygon_Context::event_stop_handler(const Smach::event& x) } Smach::event_result -StatePolygon_Context::event_refresh_handler(const Smach::event& x) +StatePolygon_Context::event_refresh_handler(const Smach::event& /*x*/) { synfig::info("STATE RotoPolygon: Received Refresh Event"); refresh_ducks(); @@ -383,6 +389,7 @@ StatePolygon_Context::run() action->set_param("canvas_interface",get_canvas_interface()); action->set_param("value_desc",value_desc); action->set_param("type","dynamic_list"); + action->set_param("time",get_canvas_interface()->get_time()); if(!get_canvas_interface()->get_instance()->perform_action(action)) { group.cancel(); @@ -390,10 +397,14 @@ StatePolygon_Context::run() return; } } - no_egress_on_selection_change=true; + egress_on_selection_change=false; + synfigapp::SelectionManager::LayerList layer_selection; + if (!getenv("SYNFIG_TOOLS_CLEAR_SELECTION")) + layer_selection = get_canvas_view()->get_selection_manager()->get_selected_layers(); get_canvas_interface()->get_selection_manager()->clear_selected_layers(); - get_canvas_interface()->get_selection_manager()->set_selected_layer(layer); - no_egress_on_selection_change=false; + layer_selection.push_back(layer); + get_canvas_interface()->get_selection_manager()->set_selected_layers(layer_selection); + egress_on_selection_change=true; //get_canvas_interface()->signal_dirty_preview()(); } /* @@ -422,8 +433,9 @@ StatePolygon_Context::event_mouse_click_handler(const Smach::event& x) 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; + 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: return Smach::RESULT_OK;