From: Nikita Kitaev Date: Sat, 17 Apr 2010 00:23:00 +0000 (-0700) Subject: Move modules into subfolder X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=eca839040348e9de1b8150eb9d835658f8b3fea6;p=synfig.git Move modules into subfolder Move state_mirror out of modules --- diff --git a/synfig-studio/src/gui/Makefile.am b/synfig-studio/src/gui/Makefile.am index 384a865..def8451 100644 --- a/synfig-studio/src/gui/Makefile.am +++ b/synfig-studio/src/gui/Makefile.am @@ -42,23 +42,14 @@ WORKAREARENDERER_CC = \ PALETTE_HH = \ - mod_palette/dock_palbrowse.h \ - mod_palette/dock_paledit.h \ - mod_palette/mod_palette.h + modules/mod_palette/dock_palbrowse.h \ + modules/mod_palette/dock_paledit.h \ + modules/mod_palette/mod_palette.h PALETTE_CC = \ - mod_palette/dock_palbrowse.cpp \ - mod_palette/dock_paledit.cpp \ - mod_palette/mod_palette.cpp - - -MOD_MIRROR_HH = \ - mod_mirror/mod_mirror.h \ - mod_mirror/state_mirror.h - -MOD_MIRROR_CC = \ - mod_mirror/mod_mirror.cpp \ - mod_mirror/state_mirror.cpp + modules/mod_palette/dock_palbrowse.cpp \ + modules/mod_palette/dock_paledit.cpp \ + modules/mod_palette/mod_palette.cpp DIALOG_HH = \ @@ -171,6 +162,7 @@ STATE_HH = \ state_eyedrop.h \ state_fill.h \ state_gradient.h \ + state_mirror.h \ state_normal.h \ state_polygon.h \ state_rectangle.h \ @@ -191,6 +183,7 @@ STATE_CC = \ state_eyedrop.cpp \ state_fill.cpp \ state_gradient.cpp \ + state_mirror.cpp \ state_normal.cpp \ state_polygon.cpp \ state_rectangle.cpp \ @@ -286,7 +279,7 @@ OTHER_HH = \ instance.h \ ipc.h \ keymapsettings.h \ - module.h \ + modules/module.h \ onemoment.h \ preview.h \ renddesc.h \ @@ -320,7 +313,7 @@ OTHER_CC = \ instance.cpp \ ipc.cpp \ keymapsettings.cpp \ - module.cpp \ + modules/module.cpp \ onemoment.cpp \ preview.cpp \ renddesc.cpp \ @@ -342,8 +335,6 @@ INCLUDES = \ bin_PROGRAMS = synfigstudio synfigstudio_SOURCES = \ - $(MOD_MIRROR_CC) \ - $(MOD_MIRROR_HH) \ $(PALETTE_CC) \ $(PALETTE_HH) \ $(WORKAREARENDERER_CC) \ diff --git a/synfig-studio/src/gui/app.cpp b/synfig-studio/src/gui/app.cpp index 01a4f8f..9f2fa22 100644 --- a/synfig-studio/src/gui/app.cpp +++ b/synfig-studio/src/gui/app.cpp @@ -80,6 +80,7 @@ #include "state_eyedrop.h" #include "state_normal.h" +#include "state_mirror.h" #include "state_draw.h" #include "state_fill.h" #include "state_bline.h" @@ -116,15 +117,13 @@ #include "dock_timetrack.h" #include "dock_curves.h" -#include "mod_palette/mod_palette.h" -#include "mod_mirror/mod_mirror.h" +#include "modules/module.h" +#include "modules/mod_palette/mod_palette.h" #include #include "ipc.h" -#include "module.h" - #include "statemanager.h" #ifdef WITH_FMOD @@ -1266,7 +1265,7 @@ App::App(int *argc, char ***argv): state_manager->add_state(&state_smooth_move); state_manager->add_state(&state_scale); state_manager->add_state(&state_rotate); - studio_init_cb.task(_("Init ModMirror...")); module_list_.push_back(new ModMirror()); module_list_.back()->start(); + state_manager->add_state(&state_mirror); if(!getenv("SYNFIG_DISABLE_WIDTH" )) state_manager->add_state(&state_width); // Enabled since 0.61.09 /* new objects */ diff --git a/synfig-studio/src/gui/canvasview.cpp b/synfig-studio/src/gui/canvasview.cpp index f520ced..ffa7f6c 100644 --- a/synfig-studio/src/gui/canvasview.cpp +++ b/synfig-studio/src/gui/canvasview.cpp @@ -87,7 +87,6 @@ #include "state_bline.h" #include "state_normal.h" #include "state_eyedrop.h" -#include "state_draw.h" #include "ducktransform_scale.h" #include "ducktransform_translate.h" diff --git a/synfig-studio/src/gui/mod_mirror/mod_mirror.cpp b/synfig-studio/src/gui/mod_mirror/mod_mirror.cpp deleted file mode 100644 index 03667bf..0000000 --- a/synfig-studio/src/gui/mod_mirror/mod_mirror.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file mod_mirror.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "mod_mirror.h" -#include "state_mirror.h" - -#include "../app.h" -#include "../statemanager.h" - -#include "../general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -using namespace studio; - -/* === M A C R O S ========================================================= */ - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -bool -studio::ModMirror::start_vfunc() -{ - App::get_state_manager()->add_state(&state_mirror); - return true; -} - -bool -studio::ModMirror::stop_vfunc() -{ - return true; -} diff --git a/synfig-studio/src/gui/mod_mirror/mod_mirror.h b/synfig-studio/src/gui/mod_mirror/mod_mirror.h deleted file mode 100644 index 25240f5..0000000 --- a/synfig-studio/src/gui/mod_mirror/mod_mirror.h +++ /dev/null @@ -1,59 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file mod_mirror.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_MOD_MIRROR_H -#define __SYNFIG_MOD_MIRROR_H - -/* === H E A D E R S ======================================================= */ - -#include -#include "../module.h" - -/* === M A C R O S ========================================================= */ - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace studio { - -class State_Mirror; - -class ModMirror : public Module -{ - friend class State_Mirror; - -protected: - virtual bool start_vfunc(); - virtual bool stop_vfunc(); - -public: - virtual ~ModMirror() { stop(); } -}; - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/mod_mirror/state_mirror.cpp b/synfig-studio/src/gui/mod_mirror/state_mirror.cpp deleted file mode 100644 index bcb0a3a..0000000 --- a/synfig-studio/src/gui/mod_mirror/state_mirror.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file state_mirror.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** 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 -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include - -#include -#include - -#include "state_mirror.h" -#include "../state_normal.h" -#include "../canvasview.h" -#include "../workarea.h" -#include "../app.h" - -#include -#include "../event_mouse.h" -#include "../event_layerclick.h" -#include "../toolbox.h" -#include "../dialog_tooloptions.h" -#include -#include "../duck.h" -#include - -#include "../general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -using namespace studio; - -/* === M A C R O S ========================================================= */ - -enum Axis { - AXIS_X, - AXIS_Y -} ; - -/* === G L O B A L S ======================================================= */ - -StateMirror studio::state_mirror; - -/* === C L A S S E S & S T R U C T S ======================================= */ - -class DuckDrag_Mirror : public DuckDrag_Base -{ - synfig::Vector center; - - std::vector positions; - -public: - Axis axis; - - DuckDrag_Mirror(); - void begin_duck_drag(Duckmatic* duckmatic, const synfig::Vector& begin); - bool end_duck_drag(Duckmatic* duckmatic); - void duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector); -}; - -class studio::StateMirror_Context : public sigc::trackable -{ - etl::handle canvas_view_; - CanvasView::IsWorking is_working; - - synfigapp::Settings& settings; - - sigc::connection keypress_connect; - sigc::connection keyrelease_connect; - - etl::handle duck_dragger_; - - Gtk::Table options_table; - - Gtk::RadioButton::Group radiobutton_group; - Gtk::RadioButton radiobutton_axis_x; - Gtk::RadioButton radiobutton_axis_y; - -public: - - Axis get_axis()const { return radiobutton_axis_x.get_active()?AXIS_X:AXIS_Y; } - void set_axis(Axis a) - { - if(a==AXIS_X) - radiobutton_axis_x.set_active(true); - else - radiobutton_axis_y.set_active(true); - - duck_dragger_->axis=get_axis(); - } - - void update_axes() - { - duck_dragger_->axis=get_axis(); - get_work_area()->set_cursor(get_axis() == AXIS_X?Gdk::SB_H_DOUBLE_ARROW:Gdk::SB_V_DOUBLE_ARROW); - } - - 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(); - - StateMirror_Context(CanvasView* canvas_view); - - ~StateMirror_Context(); - - const etl::handle& get_canvas_view()const{return canvas_view_;} - etl::handle 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();} - - void load_settings(); - void save_settings(); - - bool key_event(GdkEventKey *event); -}; // END of class StateMirror_Context - -/* === M E T H O D S ======================================================= */ - -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() -{ -} - -void -StateMirror_Context::load_settings() -{ - String value; - - settings.get_value("mirror.axis",value); - set_axis((Axis)atoi(value.c_str())); -} - -void -StateMirror_Context::save_settings() -{ - settings.set_value("mirror.lock_aspect",strprintf("%d",(int)get_axis())); -} - -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")), - radiobutton_axis_y(radiobutton_group,_("Vertical")) -{ - // Set up the tool options dialog - options_table.attach(*manage(new Gtk::Label(_("Mirror Tool"))), 0, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - options_table.attach(radiobutton_axis_x, 0, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - options_table.attach(radiobutton_axis_y, 0, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - options_table.attach(*manage(new Gtk::Label(_("(Shift key toggles axis)"))), 0, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - - radiobutton_axis_x.signal_toggled().connect(sigc::mem_fun(*this,&StateMirror_Context::update_axes)); - radiobutton_axis_y.signal_toggled().connect(sigc::mem_fun(*this,&StateMirror_Context::update_axes)); - - options_table.show_all(); - refresh_tool_options(); - App::dialog_tool_options->present(); - - get_work_area()->set_allow_layer_clicks(true); - get_work_area()->set_duck_dragger(duck_dragger_); - - keypress_connect=get_work_area()->signal_key_press_event().connect(sigc::mem_fun(*this,&StateMirror_Context::key_event),false); - keyrelease_connect=get_work_area()->signal_key_release_event().connect(sigc::mem_fun(*this,&StateMirror_Context::key_event),false); - - get_work_area()->set_cursor(Gdk::SB_H_DOUBLE_ARROW); -// get_work_area()->reset_cursor(); - - App::toolbox->refresh(); - - set_axis(AXIS_X); - load_settings(); -} - -bool -StateMirror_Context::key_event(GdkEventKey *event) -{ - if (event->keyval==GDK_Shift_L || event->keyval==GDK_Shift_R ) - { - set_axis(get_axis()==AXIS_X ? AXIS_Y:AXIS_X); - get_work_area()->set_cursor(get_axis() == AXIS_X?Gdk::SB_H_DOUBLE_ARROW:Gdk::SB_V_DOUBLE_ARROW); - } - - return false; //Pass on the event to other handlers, just in case -} - -void -StateMirror_Context::refresh_tool_options() -{ - App::dialog_tool_options->clear(); - App::dialog_tool_options->set_widget(options_table); - App::dialog_tool_options->set_local_name(_("Mirror Tool")); - App::dialog_tool_options->set_name("mirror"); -} - -Smach::event_result -StateMirror_Context::event_refresh_tool_options(const Smach::event& /*x*/) -{ - refresh_tool_options(); - 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() -{ - save_settings(); - - get_work_area()->clear_duck_dragger(); - get_work_area()->reset_cursor(); - - keypress_connect.disconnect(); - keyrelease_connect.disconnect(); - - App::dialog_tool_options->clear(); - - App::toolbox->refresh(); -} - -DuckDrag_Mirror::DuckDrag_Mirror(): - axis(AXIS_X) -{ -} - -#ifndef EPSILON -#define EPSILON 0.0000001 -#endif - -void -DuckDrag_Mirror::begin_duck_drag(Duckmatic* duckmatic, const synfig::Vector& /*offset*/) -{ - const DuckList selected_ducks(duckmatic->get_selected_ducks()); - DuckList::const_iterator iter; - - positions.clear(); - int i; - for(i=0,iter=selected_ducks.begin();iter!=selected_ducks.end();++iter,i++) - { - Point p((*iter)->get_trans_point()); - positions.push_back(p); - } - -} - -void -DuckDrag_Mirror::duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector) -{ - center=vector; - int i; - - const DuckList selected_ducks(duckmatic->get_selected_ducks()); - DuckList::const_iterator iter; - - Time time(duckmatic->get_time()); - - // do the Vertex and Position ducks first - for(i=0,iter=selected_ducks.begin();iter!=selected_ducks.end();++iter,i++) - if ((*iter)->get_type() == Duck::TYPE_VERTEX || - (*iter)->get_type() == Duck::TYPE_POSITION) - { - Vector p(positions[i]); - - if (axis==AXIS_X) p[0] = -(p[0]-center[0]) + center[0]; - else if (axis==AXIS_Y) p[1] = -(p[1]-center[1]) + center[1]; - - (*iter)->set_trans_point(p); - } - - // then do the other ducks - for(i=0,iter=selected_ducks.begin();iter!=selected_ducks.end();++iter,i++) - if ((*iter)->get_type() != Duck::TYPE_VERTEX && - (*iter)->get_type() != Duck::TYPE_POSITION) - { - // we don't need to mirror radius ducks - they're one-dimensional - if ((*iter)->is_radius()) - continue; - - Vector p(positions[i]); - - if (axis==AXIS_X) p[0] = -(p[0]-center[0]) + center[0]; - else if (axis==AXIS_Y) p[1] = -(p[1]-center[1]) + center[1]; - - (*iter)->set_trans_point(p); - } -} - -bool -DuckDrag_Mirror::end_duck_drag(Duckmatic* duckmatic) -{ - duckmatic->signal_edited_selected_ducks(); - return true; -} diff --git a/synfig-studio/src/gui/mod_mirror/state_mirror.h b/synfig-studio/src/gui/mod_mirror/state_mirror.h deleted file mode 100644 index f1a6364..0000000 --- a/synfig-studio/src/gui/mod_mirror/state_mirror.h +++ /dev/null @@ -1,55 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file state_mirror.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_STUDIO_STATE_MIRROR_H -#define __SYNFIG_STUDIO_STATE_MIRROR_H - -/* === H E A D E R S ======================================================= */ - -#include "../smach.h" - -/* === M A C R O S ========================================================= */ - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace studio { - -class StateMirror_Context; - -class StateMirror : public Smach::state -{ -public: - StateMirror(); - ~StateMirror(); -}; // END of class StateMirror - -extern StateMirror state_mirror; - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/mod_palette/dock_palbrowse.cpp b/synfig-studio/src/gui/mod_palette/dock_palbrowse.cpp deleted file mode 100644 index dbaff71..0000000 --- a/synfig-studio/src/gui/mod_palette/dock_palbrowse.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_palbrowse.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "dock_palbrowse.h" -#include "dock_paledit.h" -#include "mod_palette.h" - -#include "../general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -using namespace studio; - -/* === M A C R O S ========================================================= */ - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -Dock_PalBrowse::Dock_PalBrowse(): - Dockable("pal_browse",_("Palette Browser")/*,Gtk::StockID("gtk-select-color")*/) -{ -} - -Dock_PalBrowse::~Dock_PalBrowse() -{ -} diff --git a/synfig-studio/src/gui/mod_palette/dock_palbrowse.h b/synfig-studio/src/gui/mod_palette/dock_palbrowse.h deleted file mode 100644 index 9e039d3..0000000 --- a/synfig-studio/src/gui/mod_palette/dock_palbrowse.h +++ /dev/null @@ -1,65 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_palbrowse.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_STUDIO_DOCK_PAL_BROWSE_H -#define __SYNFIG_STUDIO_DOCK_PAL_BROWSE_H - -/* === H E A D E R S ======================================================= */ - -#include "../dockable.h" -#include - -/* === M A C R O S ========================================================= */ - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace synfigapp { -class CanvasInterface; -}; - -namespace studio { - -/* - -The palette browser was intended to be a way to manage and select a single -palette from a set of palettes that you could save to files. The palette -editor was for editing individual palettes. Unfortunately the palette -browser was never implemented. - -*/ - -class Dock_PalBrowse : public Dockable -{ -public: - Dock_PalBrowse(); - ~Dock_PalBrowse(); -}; // END of Dock_PalBrowse - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/mod_palette/dock_paledit.cpp b/synfig-studio/src/gui/mod_palette/dock_paledit.cpp deleted file mode 100644 index 718bdee..0000000 --- a/synfig-studio/src/gui/mod_palette/dock_paledit.cpp +++ /dev/null @@ -1,396 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_paledit.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2007 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 -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "dock_paledit.h" -#include "../widget_color.h" -#include -#include -#include -#include -#include -#include -#include "../widget_color.h" -#include -#include -#include -#include "../app.h" -#include "../dialog_color.h" - -#include "../general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -using namespace studio; - -/* === M A C R O S ========================================================= */ - -/* === G L O B A L S ======================================================= */ -/* -class studio::PaletteSettings : public synfigapp::Settings -{ - Dock_PalEdit* dialog_palette; - synfig::String name; -public: - PaletteSettings(Dock_PalEdit* window,const synfig::String& name): - dialog_palette(window), - name(name) - { - dialog_palette->dialog_settings.add_domain(this,name); - } - - virtual ~PaletteSettings() - { - dialog_palette->dialog_settings.remove_domain(name); - } - - virtual bool get_value(const synfig::String& key, synfig::String& value)const - { - int i(atoi(key.c_str())); - if(i<0 || i>=dialog_palette->size()) - return false; - Color c(dialog_palette->get_color(i)); - value=strprintf("%f %f %f %f",c.get_r(),c.get_g(),c.get_b(),c.get_a()); - return true; - } - - virtual bool set_value(const synfig::String& key,const synfig::String& value) - { - int i(atoi(key.c_str())); - if(i<0) - return false; - if(i>=dialog_palette->size()) - dialog_palette->palette_.resize(i+1); - float r,g,b,a; - if(!strscanf(value,"%f %f %f %f",&r,&g,&b,&a)) - return false; - dialog_palette->set_color(Color(r,g,b,a),i); - return true; - } - - virtual KeyList get_key_list()const - { - synfigapp::Settings::KeyList ret(synfigapp::Settings::get_key_list()); - - int i; - for(i=0;isize();i++) - ret.push_back(strprintf("%03d",i)); - return ret; - } -}; -*/ -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -Dock_PalEdit::Dock_PalEdit(): - Dockable("pal_edit",_("Palette Editor"),Gtk::StockID("gtk-select-color")), - //palette_settings(new PaletteSettings(this,"colors")), - table(2,2,false) -{ - action_group=Gtk::ActionGroup::create("action_group_pal_edit"); - action_group->add(Gtk::Action::create( - "palette-add-color", - Gtk::StockID("gtk-add"), - _("Add Color"), - _("Add current outline color\nto the palette") - ), - sigc::mem_fun( - *this, - &Dock_PalEdit::on_add_pressed - ) - ); - - App::ui_manager()->insert_action_group(action_group); - - Glib::ustring ui_info = - "" - " " - " " - " " - "" - ; - - App::ui_manager()->add_ui_from_string(ui_info); - - set_toolbar(*dynamic_cast(App::ui_manager()->get_widget("/toolbar-palette"))); - - /* - add_button( - Gtk::StockID("gtk-add"), - _("Add current outline color\nto the palette") - )->signal_clicked().connect( - sigc::mem_fun( - *this, - &Dock_PalEdit::on_add_pressed - ) - ); - */ - - add(table); - table.set_homogeneous(true); - - set_default_palette(); - - show_all_children(); -} - -Dock_PalEdit::~Dock_PalEdit() -{ - //delete palette_settings; -} - -void -Dock_PalEdit::set_palette(const synfig::Palette& x) -{ - palette_=x; - refresh(); -} - -void -Dock_PalEdit::on_add_pressed() -{ - add_color(synfigapp::Main::get_outline_color()); -} - -void -Dock_PalEdit::show_menu(int i) -{ - Gtk::Menu* menu(manage(new Gtk::Menu())); - menu->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), menu)); - - menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-select-color"), - sigc::bind( - sigc::mem_fun(*this,&studio::Dock_PalEdit::edit_color), - i - ) - )); - - menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-delete"), - sigc::bind( - sigc::mem_fun(*this,&studio::Dock_PalEdit::erase_color), - i - ) - )); - - menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); - - menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Load Default Palette"), - sigc::mem_fun(*this,&studio::Dock_PalEdit::set_default_palette) - )); - - menu->popup(3,gtk_get_current_event_time()); -} - -int -Dock_PalEdit::add_color(const synfig::Color& x) -{ - palette_.push_back(x); - signal_changed()(); - refresh(); - return size()-1; -} - -void -Dock_PalEdit::set_color(synfig::Color x, int i) -{ - palette_[i].color=x; - signal_changed()(); - refresh(); -} - -Color -Dock_PalEdit::get_color(int i)const -{ - return palette_[i].color; -} - -void -Dock_PalEdit::erase_color(int i) -{ - palette_.erase(palette_.begin()+i); - signal_changed()(); - refresh(); -} - -void -Dock_PalEdit::refresh() -{ - const int width(12); - - // Clear the table - table.foreach(sigc::mem_fun(table,&Gtk::Table::remove)); - - for(int i=0;iset_value(get_color(i)); - widget_color->set_size_request(12,12); - widget_color->signal_activate().connect( - sigc::bind( - sigc::mem_fun(*this,&studio::Dock_PalEdit::select_fill_color), - i - ) - ); - widget_color->signal_middle_click().connect( - sigc::bind( - sigc::mem_fun(*this,&studio::Dock_PalEdit::select_outline_color), - i - ) - ); - widget_color->signal_right_click().connect( - sigc::bind( - sigc::mem_fun(*this,&studio::Dock_PalEdit::show_menu), - i - ) - ); - int c(i%width),r(i/width); - table.attach(*widget_color, c, c+1, r, r+1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - } - table.show_all(); - queue_draw(); -} - - -void -Dock_PalEdit::edit_color(int i) -{ - App::dialog_color->reset(); - App::dialog_color->set_color(get_color(i)); - App::dialog_color->signal_edited().connect( - sigc::bind( - sigc::mem_fun(*this,&studio::Dock_PalEdit::set_color), - i - ) - ); - App::dialog_color->present(); -} - -void -Dock_PalEdit::select_fill_color(int i) -{ - synfigapp::Main::set_fill_color(get_color(i)); -} - -void -Dock_PalEdit::select_outline_color(int i) -{ - synfigapp::Main::set_outline_color(get_color(i)); -} - -void -Dock_PalEdit::set_default_palette() -{ - int width=12; - - palette_.clear(); - - // Greys - palette_.push_back(Color::alpha()); - for(int i=0;i -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "../widget_coloredit.h" - -#include -#include - -#include "../dockable.h" -#include -#include - -#include - -/* === M A C R O S ========================================================= */ - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace synfigapp { -class CanvasInterface; -}; - -namespace studio { - -class Widget_Color; -class PaletteSettings; - -class Dock_PalEdit : public Dockable -{ - friend class PaletteSettings; - - Glib::RefPtr action_group; - - synfig::Palette palette_; - - Gtk::Table table; - - void on_add_pressed(); - - void show_menu(int i); - - sigc::signal signal_changed_; - - -private: - int add_color(const synfig::Color& x); - void set_color(synfig::Color x, int i); - void erase_color(int i); - - void select_fill_color(int i); - void select_outline_color(int i); - synfig::Color get_color(int i)const; - void edit_color(int i); -public: - void set_palette(const synfig::Palette& x); - const synfig::Palette& get_palette()const { return palette_; } - - int size()const; - - void set_default_palette(); - - void refresh(); - - const sigc::signal& signal_changed() { return signal_changed_; } - - Dock_PalEdit(); - ~Dock_PalEdit(); -}; // END of Dock_PalEdit - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/mod_palette/mod_palette.cpp b/synfig-studio/src/gui/mod_palette/mod_palette.cpp deleted file mode 100644 index 53d5fc5..0000000 --- a/synfig-studio/src/gui/mod_palette/mod_palette.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file mod_palette.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "mod_palette.h" -#include "dock_paledit.h" -#include "dock_palbrowse.h" - -#include "../app.h" -#include "../dockmanager.h" - -#include "../general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -using namespace studio; - -/* === M A C R O S ========================================================= */ - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -bool -studio::ModPalette::start_vfunc() -{ - dock_pal_edit=new Dock_PalEdit(); - App::get_dock_manager()->register_dockable(*dock_pal_edit); - - //dock_pal_browse=new Dock_PalBrowse(); - //App::get_dock_manager()->register_dockable(*dock_pal_browse); - - return true; -} - -bool -studio::ModPalette::stop_vfunc() -{ - //App::get_dock_manager()->unregister_dockable(*dock_pal_browse); - App::get_dock_manager()->unregister_dockable(*dock_pal_edit); - - delete dock_pal_edit; - //delete dock_pal_browse; - - return true; -} diff --git a/synfig-studio/src/gui/mod_palette/mod_palette.h b/synfig-studio/src/gui/mod_palette/mod_palette.h deleted file mode 100644 index 7b18442..0000000 --- a/synfig-studio/src/gui/mod_palette/mod_palette.h +++ /dev/null @@ -1,64 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file mod_palette.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_MOD_PALETTE_H -#define __SYNFIG_MOD_PALETTE_H - -/* === H E A D E R S ======================================================= */ - -#include -#include "../module.h" - -/* === M A C R O S ========================================================= */ - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace studio { - -class Dock_PalEdit; -class Dock_PalBrowse; - -class ModPalette : public Module -{ - friend class Dock_PalEdit; - friend class Dock_PalBrowse; - - Dock_PalEdit* dock_pal_edit; - Dock_PalBrowse* dock_pal_browse; - -protected: - virtual bool start_vfunc(); - virtual bool stop_vfunc(); - -public: - virtual ~ModPalette() { stop(); } -}; - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/module.cpp b/synfig-studio/src/gui/module.cpp deleted file mode 100644 index ad95ae4..0000000 --- a/synfig-studio/src/gui/module.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file gtkmm/module.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "module.h" - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -//using namespace synfig; -using namespace studio; - -/* === M A C R O S ========================================================= */ - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -Module::Module():status_(false) -{ -} - -Module::~Module() -{ - stop(); -} - -bool -Module::get_status()const -{ - return status_; -} - -bool -Module::start() -{ - if(!get_status()) - status_=start_vfunc(); - return get_status(); -} - -bool -Module::stop() -{ - if(get_status() && count()<=1 && stop_vfunc()) - { - status_=false; - return true; - } - return false; -} diff --git a/synfig-studio/src/gui/module.h b/synfig-studio/src/gui/module.h deleted file mode 100644 index e814bc4..0000000 --- a/synfig-studio/src/gui/module.h +++ /dev/null @@ -1,67 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file gtkmm/module.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_MODULE_H -#define __SYNFIG_MODULE_H - -/* === H E A D E R S ======================================================= */ - -#include - -/* === M A C R O S ========================================================= */ - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace studio { - -class Module : public etl::shared_object -{ - bool status_; - -protected: - Module(); - -public: - virtual ~Module(); - - bool start(); - - bool stop(); - - bool get_status()const; - -protected: - - virtual bool start_vfunc()=0; - virtual bool stop_vfunc()=0; -}; - - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/modules/mod_palette/dock_palbrowse.cpp b/synfig-studio/src/gui/modules/mod_palette/dock_palbrowse.cpp new file mode 100644 index 0000000..d7b9b9f --- /dev/null +++ b/synfig-studio/src/gui/modules/mod_palette/dock_palbrowse.cpp @@ -0,0 +1,62 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dock_palbrowse.cpp +** \brief Template File +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. +** +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** \endlegal +*/ +/* ========================================================================= */ + +/* === H E A D E R S ======================================================= */ + +#ifdef USING_PCH +# include "pch.h" +#else +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "dock_palbrowse.h" +#include "dock_paledit.h" +#include "mod_palette.h" + +#include "../../general.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +using namespace etl; +using namespace synfig; +using namespace studio; + +/* === M A C R O S ========================================================= */ + +/* === G L O B A L S ======================================================= */ + +/* === P R O C E D U R E S ================================================= */ + +/* === M E T H O D S ======================================================= */ + +Dock_PalBrowse::Dock_PalBrowse(): + Dockable("pal_browse",_("Palette Browser")/*,Gtk::StockID("gtk-select-color")*/) +{ +} + +Dock_PalBrowse::~Dock_PalBrowse() +{ +} diff --git a/synfig-studio/src/gui/modules/mod_palette/dock_palbrowse.h b/synfig-studio/src/gui/modules/mod_palette/dock_palbrowse.h new file mode 100644 index 0000000..0b95ba8 --- /dev/null +++ b/synfig-studio/src/gui/modules/mod_palette/dock_palbrowse.h @@ -0,0 +1,65 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dock_palbrowse.h +** \brief Template Header +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. +** +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** \endlegal +*/ +/* ========================================================================= */ + +/* === S T A R T =========================================================== */ + +#ifndef __SYNFIG_STUDIO_DOCK_PAL_BROWSE_H +#define __SYNFIG_STUDIO_DOCK_PAL_BROWSE_H + +/* === H E A D E R S ======================================================= */ + +#include "../../dockable.h" +#include + +/* === M A C R O S ========================================================= */ + +/* === T Y P E D E F S ===================================================== */ + +/* === C L A S S E S & S T R U C T S ======================================= */ + +namespace synfigapp { +class CanvasInterface; +}; + +namespace studio { + +/* + +The palette browser was intended to be a way to manage and select a single +palette from a set of palettes that you could save to files. The palette +editor was for editing individual palettes. Unfortunately the palette +browser was never implemented. + +*/ + +class Dock_PalBrowse : public Dockable +{ +public: + Dock_PalBrowse(); + ~Dock_PalBrowse(); +}; // END of Dock_PalBrowse + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/modules/mod_palette/dock_paledit.cpp b/synfig-studio/src/gui/modules/mod_palette/dock_paledit.cpp new file mode 100644 index 0000000..1c39a2a --- /dev/null +++ b/synfig-studio/src/gui/modules/mod_palette/dock_paledit.cpp @@ -0,0 +1,396 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dock_paledit.cpp +** \brief Template File +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007 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 +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. +** +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** \endlegal +*/ +/* ========================================================================= */ + +/* === H E A D E R S ======================================================= */ + +#ifdef USING_PCH +# include "pch.h" +#else +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "dock_paledit.h" +#include "../../widget_color.h" +#include +#include +#include +#include +#include +#include +#include "../../widget_color.h" +#include +#include +#include +#include "../../app.h" +#include "../../dialog_color.h" + +#include "../../general.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +using namespace etl; +using namespace synfig; +using namespace studio; + +/* === M A C R O S ========================================================= */ + +/* === G L O B A L S ======================================================= */ +/* +class studio::PaletteSettings : public synfigapp::Settings +{ + Dock_PalEdit* dialog_palette; + synfig::String name; +public: + PaletteSettings(Dock_PalEdit* window,const synfig::String& name): + dialog_palette(window), + name(name) + { + dialog_palette->dialog_settings.add_domain(this,name); + } + + virtual ~PaletteSettings() + { + dialog_palette->dialog_settings.remove_domain(name); + } + + virtual bool get_value(const synfig::String& key, synfig::String& value)const + { + int i(atoi(key.c_str())); + if(i<0 || i>=dialog_palette->size()) + return false; + Color c(dialog_palette->get_color(i)); + value=strprintf("%f %f %f %f",c.get_r(),c.get_g(),c.get_b(),c.get_a()); + return true; + } + + virtual bool set_value(const synfig::String& key,const synfig::String& value) + { + int i(atoi(key.c_str())); + if(i<0) + return false; + if(i>=dialog_palette->size()) + dialog_palette->palette_.resize(i+1); + float r,g,b,a; + if(!strscanf(value,"%f %f %f %f",&r,&g,&b,&a)) + return false; + dialog_palette->set_color(Color(r,g,b,a),i); + return true; + } + + virtual KeyList get_key_list()const + { + synfigapp::Settings::KeyList ret(synfigapp::Settings::get_key_list()); + + int i; + for(i=0;isize();i++) + ret.push_back(strprintf("%03d",i)); + return ret; + } +}; +*/ +/* === P R O C E D U R E S ================================================= */ + +/* === M E T H O D S ======================================================= */ + +Dock_PalEdit::Dock_PalEdit(): + Dockable("pal_edit",_("Palette Editor"),Gtk::StockID("gtk-select-color")), + //palette_settings(new PaletteSettings(this,"colors")), + table(2,2,false) +{ + action_group=Gtk::ActionGroup::create("action_group_pal_edit"); + action_group->add(Gtk::Action::create( + "palette-add-color", + Gtk::StockID("gtk-add"), + _("Add Color"), + _("Add current outline color\nto the palette") + ), + sigc::mem_fun( + *this, + &Dock_PalEdit::on_add_pressed + ) + ); + + App::ui_manager()->insert_action_group(action_group); + + Glib::ustring ui_info = + "" + " " + " " + " " + "" + ; + + App::ui_manager()->add_ui_from_string(ui_info); + + set_toolbar(*dynamic_cast(App::ui_manager()->get_widget("/toolbar-palette"))); + + /* + add_button( + Gtk::StockID("gtk-add"), + _("Add current outline color\nto the palette") + )->signal_clicked().connect( + sigc::mem_fun( + *this, + &Dock_PalEdit::on_add_pressed + ) + ); + */ + + add(table); + table.set_homogeneous(true); + + set_default_palette(); + + show_all_children(); +} + +Dock_PalEdit::~Dock_PalEdit() +{ + //delete palette_settings; +} + +void +Dock_PalEdit::set_palette(const synfig::Palette& x) +{ + palette_=x; + refresh(); +} + +void +Dock_PalEdit::on_add_pressed() +{ + add_color(synfigapp::Main::get_outline_color()); +} + +void +Dock_PalEdit::show_menu(int i) +{ + Gtk::Menu* menu(manage(new Gtk::Menu())); + menu->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), menu)); + + menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-select-color"), + sigc::bind( + sigc::mem_fun(*this,&studio::Dock_PalEdit::edit_color), + i + ) + )); + + menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-delete"), + sigc::bind( + sigc::mem_fun(*this,&studio::Dock_PalEdit::erase_color), + i + ) + )); + + menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); + + menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Load Default Palette"), + sigc::mem_fun(*this,&studio::Dock_PalEdit::set_default_palette) + )); + + menu->popup(3,gtk_get_current_event_time()); +} + +int +Dock_PalEdit::add_color(const synfig::Color& x) +{ + palette_.push_back(x); + signal_changed()(); + refresh(); + return size()-1; +} + +void +Dock_PalEdit::set_color(synfig::Color x, int i) +{ + palette_[i].color=x; + signal_changed()(); + refresh(); +} + +Color +Dock_PalEdit::get_color(int i)const +{ + return palette_[i].color; +} + +void +Dock_PalEdit::erase_color(int i) +{ + palette_.erase(palette_.begin()+i); + signal_changed()(); + refresh(); +} + +void +Dock_PalEdit::refresh() +{ + const int width(12); + + // Clear the table + table.foreach(sigc::mem_fun(table,&Gtk::Table::remove)); + + for(int i=0;iset_value(get_color(i)); + widget_color->set_size_request(12,12); + widget_color->signal_activate().connect( + sigc::bind( + sigc::mem_fun(*this,&studio::Dock_PalEdit::select_fill_color), + i + ) + ); + widget_color->signal_middle_click().connect( + sigc::bind( + sigc::mem_fun(*this,&studio::Dock_PalEdit::select_outline_color), + i + ) + ); + widget_color->signal_right_click().connect( + sigc::bind( + sigc::mem_fun(*this,&studio::Dock_PalEdit::show_menu), + i + ) + ); + int c(i%width),r(i/width); + table.attach(*widget_color, c, c+1, r, r+1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + } + table.show_all(); + queue_draw(); +} + + +void +Dock_PalEdit::edit_color(int i) +{ + App::dialog_color->reset(); + App::dialog_color->set_color(get_color(i)); + App::dialog_color->signal_edited().connect( + sigc::bind( + sigc::mem_fun(*this,&studio::Dock_PalEdit::set_color), + i + ) + ); + App::dialog_color->present(); +} + +void +Dock_PalEdit::select_fill_color(int i) +{ + synfigapp::Main::set_fill_color(get_color(i)); +} + +void +Dock_PalEdit::select_outline_color(int i) +{ + synfigapp::Main::set_outline_color(get_color(i)); +} + +void +Dock_PalEdit::set_default_palette() +{ + int width=12; + + palette_.clear(); + + // Greys + palette_.push_back(Color::alpha()); + for(int i=0;i +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "../../widget_coloredit.h" + +#include +#include + +#include "../../dockable.h" +#include +#include + +#include + +/* === M A C R O S ========================================================= */ + +/* === T Y P E D E F S ===================================================== */ + +/* === C L A S S E S & S T R U C T S ======================================= */ + +namespace synfigapp { +class CanvasInterface; +}; + +namespace studio { + +class Widget_Color; +class PaletteSettings; + +class Dock_PalEdit : public Dockable +{ + friend class PaletteSettings; + + Glib::RefPtr action_group; + + synfig::Palette palette_; + + Gtk::Table table; + + void on_add_pressed(); + + void show_menu(int i); + + sigc::signal signal_changed_; + + +private: + int add_color(const synfig::Color& x); + void set_color(synfig::Color x, int i); + void erase_color(int i); + + void select_fill_color(int i); + void select_outline_color(int i); + synfig::Color get_color(int i)const; + void edit_color(int i); +public: + void set_palette(const synfig::Palette& x); + const synfig::Palette& get_palette()const { return palette_; } + + int size()const; + + void set_default_palette(); + + void refresh(); + + const sigc::signal& signal_changed() { return signal_changed_; } + + Dock_PalEdit(); + ~Dock_PalEdit(); +}; // END of Dock_PalEdit + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/modules/mod_palette/mod_palette.cpp b/synfig-studio/src/gui/modules/mod_palette/mod_palette.cpp new file mode 100644 index 0000000..80580be --- /dev/null +++ b/synfig-studio/src/gui/modules/mod_palette/mod_palette.cpp @@ -0,0 +1,80 @@ +/* === S Y N F I G ========================================================= */ +/*! \file mod_palette.cpp +** \brief Template File +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. +** +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** \endlegal +*/ +/* ========================================================================= */ + +/* === H E A D E R S ======================================================= */ + +#ifdef USING_PCH +# include "pch.h" +#else +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "mod_palette.h" +#include "dock_paledit.h" +#include "dock_palbrowse.h" + +#include "../../app.h" +#include "../../dockmanager.h" + +#include "../../general.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +using namespace etl; +using namespace synfig; +using namespace studio; + +/* === M A C R O S ========================================================= */ + +/* === G L O B A L S ======================================================= */ + +/* === P R O C E D U R E S ================================================= */ + +/* === M E T H O D S ======================================================= */ + +bool +studio::ModPalette::start_vfunc() +{ + dock_pal_edit=new Dock_PalEdit(); + App::get_dock_manager()->register_dockable(*dock_pal_edit); + + //dock_pal_browse=new Dock_PalBrowse(); + //App::get_dock_manager()->register_dockable(*dock_pal_browse); + + return true; +} + +bool +studio::ModPalette::stop_vfunc() +{ + //App::get_dock_manager()->unregister_dockable(*dock_pal_browse); + App::get_dock_manager()->unregister_dockable(*dock_pal_edit); + + delete dock_pal_edit; + //delete dock_pal_browse; + + return true; +} diff --git a/synfig-studio/src/gui/modules/mod_palette/mod_palette.h b/synfig-studio/src/gui/modules/mod_palette/mod_palette.h new file mode 100644 index 0000000..7b18442 --- /dev/null +++ b/synfig-studio/src/gui/modules/mod_palette/mod_palette.h @@ -0,0 +1,64 @@ +/* === S Y N F I G ========================================================= */ +/*! \file mod_palette.h +** \brief Template Header +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. +** +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** \endlegal +*/ +/* ========================================================================= */ + +/* === S T A R T =========================================================== */ + +#ifndef __SYNFIG_MOD_PALETTE_H +#define __SYNFIG_MOD_PALETTE_H + +/* === H E A D E R S ======================================================= */ + +#include +#include "../module.h" + +/* === M A C R O S ========================================================= */ + +/* === T Y P E D E F S ===================================================== */ + +/* === C L A S S E S & S T R U C T S ======================================= */ + +namespace studio { + +class Dock_PalEdit; +class Dock_PalBrowse; + +class ModPalette : public Module +{ + friend class Dock_PalEdit; + friend class Dock_PalBrowse; + + Dock_PalEdit* dock_pal_edit; + Dock_PalBrowse* dock_pal_browse; + +protected: + virtual bool start_vfunc(); + virtual bool stop_vfunc(); + +public: + virtual ~ModPalette() { stop(); } +}; + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/modules/module.cpp b/synfig-studio/src/gui/modules/module.cpp new file mode 100644 index 0000000..ad95ae4 --- /dev/null +++ b/synfig-studio/src/gui/modules/module.cpp @@ -0,0 +1,85 @@ +/* === S Y N F I G ========================================================= */ +/*! \file gtkmm/module.cpp +** \brief Template File +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. +** +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** \endlegal +*/ +/* ========================================================================= */ + +/* === H E A D E R S ======================================================= */ + +#ifdef USING_PCH +# include "pch.h" +#else +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "module.h" + +#include "general.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +using namespace etl; +//using namespace synfig; +using namespace studio; + +/* === M A C R O S ========================================================= */ + +/* === G L O B A L S ======================================================= */ + +/* === P R O C E D U R E S ================================================= */ + +/* === M E T H O D S ======================================================= */ + +Module::Module():status_(false) +{ +} + +Module::~Module() +{ + stop(); +} + +bool +Module::get_status()const +{ + return status_; +} + +bool +Module::start() +{ + if(!get_status()) + status_=start_vfunc(); + return get_status(); +} + +bool +Module::stop() +{ + if(get_status() && count()<=1 && stop_vfunc()) + { + status_=false; + return true; + } + return false; +} diff --git a/synfig-studio/src/gui/modules/module.h b/synfig-studio/src/gui/modules/module.h new file mode 100644 index 0000000..e814bc4 --- /dev/null +++ b/synfig-studio/src/gui/modules/module.h @@ -0,0 +1,67 @@ +/* === S Y N F I G ========================================================= */ +/*! \file gtkmm/module.h +** \brief Template Header +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. +** +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** \endlegal +*/ +/* ========================================================================= */ + +/* === S T A R T =========================================================== */ + +#ifndef __SYNFIG_MODULE_H +#define __SYNFIG_MODULE_H + +/* === H E A D E R S ======================================================= */ + +#include + +/* === M A C R O S ========================================================= */ + +/* === T Y P E D E F S ===================================================== */ + +/* === C L A S S E S & S T R U C T S ======================================= */ + +namespace studio { + +class Module : public etl::shared_object +{ + bool status_; + +protected: + Module(); + +public: + virtual ~Module(); + + bool start(); + + bool stop(); + + bool get_status()const; + +protected: + + virtual bool start_vfunc()=0; + virtual bool stop_vfunc()=0; +}; + + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/state_mirror.cpp b/synfig-studio/src/gui/state_mirror.cpp new file mode 100644 index 0000000..59fc759 --- /dev/null +++ b/synfig-studio/src/gui/state_mirror.cpp @@ -0,0 +1,336 @@ +/* === S Y N F I G ========================================================= */ +/*! \file state_mirror.cpp +** \brief Template File +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** 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 +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. +** +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** \endlegal +*/ +/* ========================================================================= */ + +/* === H E A D E R S ======================================================= */ + +#ifdef USING_PCH +# include "pch.h" +#else +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include +#include + +#include "state_mirror.h" +#include "state_normal.h" +#include "canvasview.h" +#include "workarea.h" +#include "app.h" + +#include +#include "event_mouse.h" +#include "event_layerclick.h" +#include "toolbox.h" +#include "dialog_tooloptions.h" +#include +#include "duck.h" +#include + +#include "general.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +using namespace etl; +using namespace synfig; +using namespace studio; + +/* === M A C R O S ========================================================= */ + +enum Axis { + AXIS_X, + AXIS_Y +} ; + +/* === G L O B A L S ======================================================= */ + +StateMirror studio::state_mirror; + +/* === C L A S S E S & S T R U C T S ======================================= */ + +class DuckDrag_Mirror : public DuckDrag_Base +{ + synfig::Vector center; + + std::vector positions; + +public: + Axis axis; + + DuckDrag_Mirror(); + void begin_duck_drag(Duckmatic* duckmatic, const synfig::Vector& begin); + bool end_duck_drag(Duckmatic* duckmatic); + void duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector); +}; + +class studio::StateMirror_Context : public sigc::trackable +{ + etl::handle canvas_view_; + CanvasView::IsWorking is_working; + + synfigapp::Settings& settings; + + sigc::connection keypress_connect; + sigc::connection keyrelease_connect; + + etl::handle duck_dragger_; + + Gtk::Table options_table; + + Gtk::RadioButton::Group radiobutton_group; + Gtk::RadioButton radiobutton_axis_x; + Gtk::RadioButton radiobutton_axis_y; + +public: + + Axis get_axis()const { return radiobutton_axis_x.get_active()?AXIS_X:AXIS_Y; } + void set_axis(Axis a) + { + if(a==AXIS_X) + radiobutton_axis_x.set_active(true); + else + radiobutton_axis_y.set_active(true); + + duck_dragger_->axis=get_axis(); + } + + void update_axes() + { + duck_dragger_->axis=get_axis(); + get_work_area()->set_cursor(get_axis() == AXIS_X?Gdk::SB_H_DOUBLE_ARROW:Gdk::SB_V_DOUBLE_ARROW); + } + + 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(); + + StateMirror_Context(CanvasView* canvas_view); + + ~StateMirror_Context(); + + const etl::handle& get_canvas_view()const{return canvas_view_;} + etl::handle 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();} + + void load_settings(); + void save_settings(); + + bool key_event(GdkEventKey *event); +}; // END of class StateMirror_Context + +/* === M E T H O D S ======================================================= */ + +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() +{ +} + +void +StateMirror_Context::load_settings() +{ + String value; + + settings.get_value("mirror.axis",value); + set_axis((Axis)atoi(value.c_str())); +} + +void +StateMirror_Context::save_settings() +{ + settings.set_value("mirror.lock_aspect",strprintf("%d",(int)get_axis())); +} + +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")), + radiobutton_axis_y(radiobutton_group,_("Vertical")) +{ + // Set up the tool options dialog + options_table.attach(*manage(new Gtk::Label(_("Mirror Tool"))), 0, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + options_table.attach(radiobutton_axis_x, 0, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + options_table.attach(radiobutton_axis_y, 0, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + options_table.attach(*manage(new Gtk::Label(_("(Shift key toggles axis)"))), 0, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + + radiobutton_axis_x.signal_toggled().connect(sigc::mem_fun(*this,&StateMirror_Context::update_axes)); + radiobutton_axis_y.signal_toggled().connect(sigc::mem_fun(*this,&StateMirror_Context::update_axes)); + + options_table.show_all(); + refresh_tool_options(); + App::dialog_tool_options->present(); + + get_work_area()->set_allow_layer_clicks(true); + get_work_area()->set_duck_dragger(duck_dragger_); + + keypress_connect=get_work_area()->signal_key_press_event().connect(sigc::mem_fun(*this,&StateMirror_Context::key_event),false); + keyrelease_connect=get_work_area()->signal_key_release_event().connect(sigc::mem_fun(*this,&StateMirror_Context::key_event),false); + + get_work_area()->set_cursor(Gdk::SB_H_DOUBLE_ARROW); +// get_work_area()->reset_cursor(); + + App::toolbox->refresh(); + + set_axis(AXIS_X); + load_settings(); +} + +bool +StateMirror_Context::key_event(GdkEventKey *event) +{ + if (event->keyval==GDK_Shift_L || event->keyval==GDK_Shift_R ) + { + set_axis(get_axis()==AXIS_X ? AXIS_Y:AXIS_X); + get_work_area()->set_cursor(get_axis() == AXIS_X?Gdk::SB_H_DOUBLE_ARROW:Gdk::SB_V_DOUBLE_ARROW); + } + + return false; //Pass on the event to other handlers, just in case +} + +void +StateMirror_Context::refresh_tool_options() +{ + App::dialog_tool_options->clear(); + App::dialog_tool_options->set_widget(options_table); + App::dialog_tool_options->set_local_name(_("Mirror Tool")); + App::dialog_tool_options->set_name("mirror"); +} + +Smach::event_result +StateMirror_Context::event_refresh_tool_options(const Smach::event& /*x*/) +{ + refresh_tool_options(); + 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() +{ + save_settings(); + + get_work_area()->clear_duck_dragger(); + get_work_area()->reset_cursor(); + + keypress_connect.disconnect(); + keyrelease_connect.disconnect(); + + App::dialog_tool_options->clear(); + + App::toolbox->refresh(); +} + +DuckDrag_Mirror::DuckDrag_Mirror(): + axis(AXIS_X) +{ +} + +#ifndef EPSILON +#define EPSILON 0.0000001 +#endif + +void +DuckDrag_Mirror::begin_duck_drag(Duckmatic* duckmatic, const synfig::Vector& /*offset*/) +{ + const DuckList selected_ducks(duckmatic->get_selected_ducks()); + DuckList::const_iterator iter; + + positions.clear(); + int i; + for(i=0,iter=selected_ducks.begin();iter!=selected_ducks.end();++iter,i++) + { + Point p((*iter)->get_trans_point()); + positions.push_back(p); + } + +} + +void +DuckDrag_Mirror::duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector) +{ + center=vector; + int i; + + const DuckList selected_ducks(duckmatic->get_selected_ducks()); + DuckList::const_iterator iter; + + Time time(duckmatic->get_time()); + + // do the Vertex and Position ducks first + for(i=0,iter=selected_ducks.begin();iter!=selected_ducks.end();++iter,i++) + if ((*iter)->get_type() == Duck::TYPE_VERTEX || + (*iter)->get_type() == Duck::TYPE_POSITION) + { + Vector p(positions[i]); + + if (axis==AXIS_X) p[0] = -(p[0]-center[0]) + center[0]; + else if (axis==AXIS_Y) p[1] = -(p[1]-center[1]) + center[1]; + + (*iter)->set_trans_point(p); + } + + // then do the other ducks + for(i=0,iter=selected_ducks.begin();iter!=selected_ducks.end();++iter,i++) + if ((*iter)->get_type() != Duck::TYPE_VERTEX && + (*iter)->get_type() != Duck::TYPE_POSITION) + { + // we don't need to mirror radius ducks - they're one-dimensional + if ((*iter)->is_radius()) + continue; + + Vector p(positions[i]); + + if (axis==AXIS_X) p[0] = -(p[0]-center[0]) + center[0]; + else if (axis==AXIS_Y) p[1] = -(p[1]-center[1]) + center[1]; + + (*iter)->set_trans_point(p); + } +} + +bool +DuckDrag_Mirror::end_duck_drag(Duckmatic* duckmatic) +{ + duckmatic->signal_edited_selected_ducks(); + return true; +} diff --git a/synfig-studio/src/gui/state_mirror.h b/synfig-studio/src/gui/state_mirror.h new file mode 100644 index 0000000..4ac878e --- /dev/null +++ b/synfig-studio/src/gui/state_mirror.h @@ -0,0 +1,55 @@ +/* === S Y N F I G ========================================================= */ +/*! \file state_mirror.h +** \brief Template Header +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. +** +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** \endlegal +*/ +/* ========================================================================= */ + +/* === S T A R T =========================================================== */ + +#ifndef __SYNFIG_STUDIO_STATE_MIRROR_H +#define __SYNFIG_STUDIO_STATE_MIRROR_H + +/* === H E A D E R S ======================================================= */ + +#include "smach.h" + +/* === M A C R O S ========================================================= */ + +/* === T Y P E D E F S ===================================================== */ + +/* === C L A S S E S & S T R U C T S ======================================= */ + +namespace studio { + +class StateMirror_Context; + +class StateMirror : public Smach::state +{ +public: + StateMirror(); + ~StateMirror(); +}; // END of class StateMirror + +extern StateMirror state_mirror; + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif