From 5fe12ee93aaca62d4d1e4007a5e94b97c1135d2c Mon Sep 17 00:00:00 2001 From: Nikita Kitaev Date: Fri, 16 Apr 2010 21:59:56 -0700 Subject: [PATCH] Move docks into subfolder --- synfig-studio/src/gui/Makefile.am | 72 +-- synfig-studio/src/gui/app.cpp | 28 +- synfig-studio/src/gui/dialog_tooloptions.cpp | 97 ---- synfig-studio/src/gui/dialog_tooloptions.h | 62 --- synfig-studio/src/gui/dialogs/dialog_soundselect.h | 2 +- synfig-studio/src/gui/dock_canvases.cpp | 251 --------- synfig-studio/src/gui/dock_canvases.h | 88 ---- synfig-studio/src/gui/dock_canvasspecific.cpp | 175 ------- synfig-studio/src/gui/dock_canvasspecific.h | 73 --- synfig-studio/src/gui/dock_children.cpp | 107 ---- synfig-studio/src/gui/dock_children.h | 60 --- synfig-studio/src/gui/dock_curves.cpp | 194 ------- synfig-studio/src/gui/dock_curves.h | 74 --- synfig-studio/src/gui/dock_history.cpp | 447 ---------------- synfig-studio/src/gui/dock_history.h | 90 ---- synfig-studio/src/gui/dock_info.cpp | 144 ------ synfig-studio/src/gui/dock_info.h | 62 --- synfig-studio/src/gui/dock_keyframes.cpp | 138 ----- synfig-studio/src/gui/dock_keyframes.h | 79 --- synfig-studio/src/gui/dock_layergroups.cpp | 136 ----- synfig-studio/src/gui/dock_layergroups.h | 71 --- synfig-studio/src/gui/dock_layers.cpp | 295 ----------- synfig-studio/src/gui/dock_layers.h | 79 --- synfig-studio/src/gui/dock_metadata.cpp | 144 ------ synfig-studio/src/gui/dock_metadata.h | 71 --- synfig-studio/src/gui/dock_navigator.cpp | 522 ------------------- synfig-studio/src/gui/dock_navigator.h | 121 ----- synfig-studio/src/gui/dock_params.cpp | 126 ----- synfig-studio/src/gui/dock_params.h | 64 --- synfig-studio/src/gui/dock_timetrack.cpp | 494 ------------------ synfig-studio/src/gui/dock_timetrack.h | 71 --- synfig-studio/src/gui/dockable.cpp | 380 -------------- synfig-studio/src/gui/dockable.h | 144 ------ synfig-studio/src/gui/dockbook.cpp | 253 --------- synfig-studio/src/gui/dockbook.h | 89 ---- synfig-studio/src/gui/dockdialog.cpp | 564 --------------------- synfig-studio/src/gui/dockdialog.h | 128 ----- synfig-studio/src/gui/dockmanager.cpp | 328 ------------ synfig-studio/src/gui/dockmanager.h | 82 --- synfig-studio/src/gui/docks/dialog_tooloptions.cpp | 97 ++++ synfig-studio/src/gui/docks/dialog_tooloptions.h | 62 +++ synfig-studio/src/gui/docks/dock_canvases.cpp | 251 +++++++++ synfig-studio/src/gui/docks/dock_canvases.h | 88 ++++ .../src/gui/docks/dock_canvasspecific.cpp | 175 +++++++ synfig-studio/src/gui/docks/dock_canvasspecific.h | 73 +++ synfig-studio/src/gui/docks/dock_children.cpp | 107 ++++ synfig-studio/src/gui/docks/dock_children.h | 60 +++ synfig-studio/src/gui/docks/dock_curves.cpp | 194 +++++++ synfig-studio/src/gui/docks/dock_curves.h | 74 +++ synfig-studio/src/gui/docks/dock_history.cpp | 447 ++++++++++++++++ synfig-studio/src/gui/docks/dock_history.h | 90 ++++ synfig-studio/src/gui/docks/dock_info.cpp | 144 ++++++ synfig-studio/src/gui/docks/dock_info.h | 62 +++ synfig-studio/src/gui/docks/dock_keyframes.cpp | 138 +++++ synfig-studio/src/gui/docks/dock_keyframes.h | 79 +++ synfig-studio/src/gui/docks/dock_layergroups.cpp | 136 +++++ synfig-studio/src/gui/docks/dock_layergroups.h | 71 +++ synfig-studio/src/gui/docks/dock_layers.cpp | 295 +++++++++++ synfig-studio/src/gui/docks/dock_layers.h | 79 +++ synfig-studio/src/gui/docks/dock_metadata.cpp | 144 ++++++ synfig-studio/src/gui/docks/dock_metadata.h | 71 +++ synfig-studio/src/gui/docks/dock_navigator.cpp | 522 +++++++++++++++++++ synfig-studio/src/gui/docks/dock_navigator.h | 121 +++++ synfig-studio/src/gui/docks/dock_params.cpp | 126 +++++ synfig-studio/src/gui/docks/dock_params.h | 64 +++ synfig-studio/src/gui/docks/dock_timetrack.cpp | 494 ++++++++++++++++++ synfig-studio/src/gui/docks/dock_timetrack.h | 71 +++ synfig-studio/src/gui/docks/dockable.cpp | 380 ++++++++++++++ synfig-studio/src/gui/docks/dockable.h | 144 ++++++ synfig-studio/src/gui/docks/dockbook.cpp | 253 +++++++++ synfig-studio/src/gui/docks/dockbook.h | 89 ++++ synfig-studio/src/gui/docks/dockdialog.cpp | 564 +++++++++++++++++++++ synfig-studio/src/gui/docks/dockdialog.h | 128 +++++ synfig-studio/src/gui/docks/dockmanager.cpp | 328 ++++++++++++ synfig-studio/src/gui/docks/dockmanager.h | 82 +++ synfig-studio/src/gui/layergrouptreestore.cpp | 4 +- .../src/gui/modules/mod_palette/dock_palbrowse.h | 4 +- .../src/gui/modules/mod_palette/dock_paledit.h | 4 +- .../src/gui/modules/mod_palette/mod_palette.cpp | 2 +- synfig-studio/src/gui/states/state_bline.cpp | 2 +- synfig-studio/src/gui/states/state_circle.cpp | 2 +- synfig-studio/src/gui/states/state_draw.cpp | 2 +- synfig-studio/src/gui/states/state_gradient.cpp | 2 +- synfig-studio/src/gui/states/state_mirror.cpp | 2 +- synfig-studio/src/gui/states/state_normal.cpp | 2 +- synfig-studio/src/gui/states/state_polygon.cpp | 2 +- synfig-studio/src/gui/states/state_rectangle.cpp | 2 +- synfig-studio/src/gui/states/state_rotate.cpp | 2 +- synfig-studio/src/gui/states/state_scale.cpp | 2 +- synfig-studio/src/gui/states/state_sketch.cpp | 2 +- synfig-studio/src/gui/states/state_smoothmove.cpp | 2 +- synfig-studio/src/gui/states/state_star.cpp | 2 +- synfig-studio/src/gui/states/state_text.cpp | 2 +- synfig-studio/src/gui/states/state_width.cpp | 2 +- synfig-studio/src/gui/toolbox.cpp | 8 +- 95 files changed, 6380 insertions(+), 6380 deletions(-) delete mode 100644 synfig-studio/src/gui/dialog_tooloptions.cpp delete mode 100644 synfig-studio/src/gui/dialog_tooloptions.h delete mode 100644 synfig-studio/src/gui/dock_canvases.cpp delete mode 100644 synfig-studio/src/gui/dock_canvases.h delete mode 100644 synfig-studio/src/gui/dock_canvasspecific.cpp delete mode 100644 synfig-studio/src/gui/dock_canvasspecific.h delete mode 100644 synfig-studio/src/gui/dock_children.cpp delete mode 100644 synfig-studio/src/gui/dock_children.h delete mode 100644 synfig-studio/src/gui/dock_curves.cpp delete mode 100644 synfig-studio/src/gui/dock_curves.h delete mode 100644 synfig-studio/src/gui/dock_history.cpp delete mode 100644 synfig-studio/src/gui/dock_history.h delete mode 100644 synfig-studio/src/gui/dock_info.cpp delete mode 100644 synfig-studio/src/gui/dock_info.h delete mode 100644 synfig-studio/src/gui/dock_keyframes.cpp delete mode 100644 synfig-studio/src/gui/dock_keyframes.h delete mode 100644 synfig-studio/src/gui/dock_layergroups.cpp delete mode 100644 synfig-studio/src/gui/dock_layergroups.h delete mode 100644 synfig-studio/src/gui/dock_layers.cpp delete mode 100644 synfig-studio/src/gui/dock_layers.h delete mode 100644 synfig-studio/src/gui/dock_metadata.cpp delete mode 100644 synfig-studio/src/gui/dock_metadata.h delete mode 100644 synfig-studio/src/gui/dock_navigator.cpp delete mode 100644 synfig-studio/src/gui/dock_navigator.h delete mode 100644 synfig-studio/src/gui/dock_params.cpp delete mode 100644 synfig-studio/src/gui/dock_params.h delete mode 100644 synfig-studio/src/gui/dock_timetrack.cpp delete mode 100644 synfig-studio/src/gui/dock_timetrack.h delete mode 100644 synfig-studio/src/gui/dockable.cpp delete mode 100644 synfig-studio/src/gui/dockable.h delete mode 100644 synfig-studio/src/gui/dockbook.cpp delete mode 100644 synfig-studio/src/gui/dockbook.h delete mode 100644 synfig-studio/src/gui/dockdialog.cpp delete mode 100644 synfig-studio/src/gui/dockdialog.h delete mode 100644 synfig-studio/src/gui/dockmanager.cpp delete mode 100644 synfig-studio/src/gui/dockmanager.h create mode 100644 synfig-studio/src/gui/docks/dialog_tooloptions.cpp create mode 100644 synfig-studio/src/gui/docks/dialog_tooloptions.h create mode 100644 synfig-studio/src/gui/docks/dock_canvases.cpp create mode 100644 synfig-studio/src/gui/docks/dock_canvases.h create mode 100644 synfig-studio/src/gui/docks/dock_canvasspecific.cpp create mode 100644 synfig-studio/src/gui/docks/dock_canvasspecific.h create mode 100644 synfig-studio/src/gui/docks/dock_children.cpp create mode 100644 synfig-studio/src/gui/docks/dock_children.h create mode 100644 synfig-studio/src/gui/docks/dock_curves.cpp create mode 100644 synfig-studio/src/gui/docks/dock_curves.h create mode 100644 synfig-studio/src/gui/docks/dock_history.cpp create mode 100644 synfig-studio/src/gui/docks/dock_history.h create mode 100644 synfig-studio/src/gui/docks/dock_info.cpp create mode 100644 synfig-studio/src/gui/docks/dock_info.h create mode 100644 synfig-studio/src/gui/docks/dock_keyframes.cpp create mode 100644 synfig-studio/src/gui/docks/dock_keyframes.h create mode 100644 synfig-studio/src/gui/docks/dock_layergroups.cpp create mode 100644 synfig-studio/src/gui/docks/dock_layergroups.h create mode 100644 synfig-studio/src/gui/docks/dock_layers.cpp create mode 100644 synfig-studio/src/gui/docks/dock_layers.h create mode 100644 synfig-studio/src/gui/docks/dock_metadata.cpp create mode 100644 synfig-studio/src/gui/docks/dock_metadata.h create mode 100644 synfig-studio/src/gui/docks/dock_navigator.cpp create mode 100644 synfig-studio/src/gui/docks/dock_navigator.h create mode 100644 synfig-studio/src/gui/docks/dock_params.cpp create mode 100644 synfig-studio/src/gui/docks/dock_params.h create mode 100644 synfig-studio/src/gui/docks/dock_timetrack.cpp create mode 100644 synfig-studio/src/gui/docks/dock_timetrack.h create mode 100644 synfig-studio/src/gui/docks/dockable.cpp create mode 100644 synfig-studio/src/gui/docks/dockable.h create mode 100644 synfig-studio/src/gui/docks/dockbook.cpp create mode 100644 synfig-studio/src/gui/docks/dockbook.h create mode 100644 synfig-studio/src/gui/docks/dockdialog.cpp create mode 100644 synfig-studio/src/gui/docks/dockdialog.h create mode 100644 synfig-studio/src/gui/docks/dockmanager.cpp create mode 100644 synfig-studio/src/gui/docks/dockmanager.h diff --git a/synfig-studio/src/gui/Makefile.am b/synfig-studio/src/gui/Makefile.am index f4442d3..caeb8e1 100644 --- a/synfig-studio/src/gui/Makefile.am +++ b/synfig-studio/src/gui/Makefile.am @@ -74,44 +74,44 @@ DIALOG_CC = \ DOCK_HH = \ - dialog_tooloptions.h \ - dock_canvases.h \ - dock_canvasspecific.h \ - dock_children.h \ - dock_curves.h \ - dock_history.h \ - dock_info.h \ - dock_keyframes.h \ - dock_layergroups.h \ - dock_layers.h \ - dock_metadata.h \ - dock_navigator.h \ - dock_params.h \ - dock_timetrack.h \ - dockable.h \ - dockbook.h \ - dockdialog.h \ - dockmanager.h + docks/dialog_tooloptions.h \ + docks/dock_canvases.h \ + docks/dock_canvasspecific.h \ + docks/dock_children.h \ + docks/dock_curves.h \ + docks/dock_history.h \ + docks/dock_info.h \ + docks/dock_keyframes.h \ + docks/dock_layergroups.h \ + docks/dock_layers.h \ + docks/dock_metadata.h \ + docks/dock_navigator.h \ + docks/dock_params.h \ + docks/dock_timetrack.h \ + docks/dockable.h \ + docks/dockbook.h \ + docks/dockdialog.h \ + docks/dockmanager.h DOCK_CC = \ - dialog_tooloptions.cpp \ - dock_canvases.cpp \ - dock_canvasspecific.cpp \ - dock_children.cpp \ - dock_curves.cpp \ - dock_history.cpp \ - dock_info.cpp \ - dock_keyframes.cpp \ - dock_layergroups.cpp \ - dock_layers.cpp \ - dock_metadata.cpp \ - dock_navigator.cpp \ - dock_params.cpp \ - dock_timetrack.cpp \ - dockable.cpp \ - dockbook.cpp \ - dockdialog.cpp \ - dockmanager.cpp + docks/dialog_tooloptions.cpp \ + docks/dock_canvases.cpp \ + docks/dock_canvasspecific.cpp \ + docks/dock_children.cpp \ + docks/dock_curves.cpp \ + docks/dock_history.cpp \ + docks/dock_info.cpp \ + docks/dock_keyframes.cpp \ + docks/dock_layergroups.cpp \ + docks/dock_layers.cpp \ + docks/dock_metadata.cpp \ + docks/dock_navigator.cpp \ + docks/dock_params.cpp \ + docks/dock_timetrack.cpp \ + docks/dockable.cpp \ + docks/dockbook.cpp \ + docks/dockdialog.cpp \ + docks/dockmanager.cpp WIDGET_HH = \ diff --git a/synfig-studio/src/gui/app.cpp b/synfig-studio/src/gui/app.cpp index c27f7fc..51fc6bd 100644 --- a/synfig-studio/src/gui/app.cpp +++ b/synfig-studio/src/gui/app.cpp @@ -76,7 +76,7 @@ #include "toolbox.h" #include "onemoment.h" -#include "dockmanager.h" +#include "docks/dockmanager.h" #include "states/state_eyedrop.h" #include "states/state_normal.h" @@ -98,24 +98,24 @@ #include "states/state_zoom.h" #include "devicetracker.h" -#include "dialog_tooloptions.h" +#include "docks/dialog_tooloptions.h" #include "widgets/widget_enum.h" #include "autorecover.h" #include -#include "dock_history.h" -#include "dock_canvases.h" -#include "dock_keyframes.h" -#include "dock_layers.h" -#include "dock_params.h" -#include "dock_metadata.h" -#include "dock_children.h" -#include "dock_info.h" -#include "dock_navigator.h" -#include "dock_layergroups.h" -#include "dock_timetrack.h" -#include "dock_curves.h" +#include "docks/dock_history.h" +#include "docks/dock_canvases.h" +#include "docks/dock_keyframes.h" +#include "docks/dock_layers.h" +#include "docks/dock_params.h" +#include "docks/dock_metadata.h" +#include "docks/dock_children.h" +#include "docks/dock_info.h" +#include "docks/dock_navigator.h" +#include "docks/dock_layergroups.h" +#include "docks/dock_timetrack.h" +#include "docks/dock_curves.h" #include "modules/module.h" #include "modules/mod_palette/mod_palette.h" diff --git a/synfig-studio/src/gui/dialog_tooloptions.cpp b/synfig-studio/src/gui/dialog_tooloptions.cpp deleted file mode 100644 index da759c8..0000000 --- a/synfig-studio/src/gui/dialog_tooloptions.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dialog_tooloptions.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 "dialog_tooloptions.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 ======================================================= */ - -Dialog_ToolOptions::Dialog_ToolOptions(): - Dockable("tool_options",_("Tool Options"),Gtk::StockID("synfig-about")), - empty_label(_("This tool has no options")) -{ - add(sub_vbox_); - - set_widget(empty_label); - empty_label.show(); -} - -Dialog_ToolOptions::~Dialog_ToolOptions() -{ -} - -void -Dialog_ToolOptions::clear() -{ - Dockable::clear(); - set_local_name(_("Tool Options")); - add(sub_vbox_); - set_widget(empty_label); - empty_label.show(); - - set_stock_id(Gtk::StockID("synfig-about")); -} - -void -Dialog_ToolOptions::set_widget(Gtk::Widget&x) -{ - if(!sub_vbox_.children().empty()) - sub_vbox_.children().clear(); - - sub_vbox_.show(); - sub_vbox_.pack_start(x,false,false); - x.show(); -} - -void -Dialog_ToolOptions::set_name(const synfig::String& name) -{ - set_stock_id(Gtk::StockID("synfig-"+name)); -} diff --git a/synfig-studio/src/gui/dialog_tooloptions.h b/synfig-studio/src/gui/dialog_tooloptions.h deleted file mode 100644 index 69680e0..0000000 --- a/synfig-studio/src/gui/dialog_tooloptions.h +++ /dev/null @@ -1,62 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dialog_tooloptions.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_DIALOG_TOOLOPTIONS_H -#define __SYNFIG_STUDIO_DIALOG_TOOLOPTIONS_H - -/* === H E A D E R S ======================================================= */ - -#include -#include -#include -#include "dockable.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 Dialog_ToolOptions : public Dockable -{ - Gtk::Label empty_label; - Gtk::VBox sub_vbox_; - -public: - - void clear(); - void set_widget(Gtk::Widget&); - void set_name(const synfig::String& name); - - Dialog_ToolOptions(); - ~Dialog_ToolOptions(); -}; // END of Dialog_ToolOptions - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dialogs/dialog_soundselect.h b/synfig-studio/src/gui/dialogs/dialog_soundselect.h index 50cf018..fe6e371 100644 --- a/synfig-studio/src/gui/dialogs/dialog_soundselect.h +++ b/synfig-studio/src/gui/dialogs/dialog_soundselect.h @@ -27,7 +27,7 @@ #define __SYNFIG_DIALOG_SOUNDSELECT_H /* === H E A D E R S ======================================================= */ -#include "dockdialog.h" +#include "docks/dockdialog.h" #include "widgets/widget_filename.h" #include "widgets/widget_time.h" diff --git a/synfig-studio/src/gui/dock_canvases.cpp b/synfig-studio/src/gui/dock_canvases.cpp deleted file mode 100644 index f230820..0000000 --- a/synfig-studio/src/gui/dock_canvases.cpp +++ /dev/null @@ -1,251 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_canvases.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_canvases.h" -#include "app.h" -#include "canvasview.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_Canvases::Dock_Canvases(): - Dockable("canvases",_("Canvas Browser"),Gtk::StockID("synfig-canvas")) -{ - - App::signal_instance_created().connect(sigc::mem_fun(*this,&studio::Dock_Canvases::new_instance)); - App::signal_instance_deleted().connect(sigc::mem_fun(*this,&studio::Dock_Canvases::delete_instance)); - App::signal_instance_selected().connect(sigc::mem_fun(*this,&studio::Dock_Canvases::set_selected_instance_signal)); - - - add(*create_canvas_tree()); - -/* // \todo Implement canvas management in canvas browser - add_button( - Gtk::StockID("synfig-canvas_new"), - _("Insert a new canvas") - )->signal_clicked().connect( - sigc::mem_fun( - *this, - &Dock_Canvases::menu_new_canvas - ) - ); - - add_button( - Gtk::StockID("gtk-delete"), - _("Remove selected canvas") - )->signal_clicked().connect( - sigc::mem_fun( - *this, - &Dock_Canvases::menu_delete - ) - ); - - add_button( - Gtk::StockID("synfig-rename"), - _("Rename selected canvas") - )->signal_clicked().connect( - sigc::mem_fun( - *this, - &Dock_Canvases::menu_rename - ) - ); -*/ -} - -Dock_Canvases::~Dock_Canvases() -{ -} - -Gtk::Widget* -Dock_Canvases::create_canvas_tree() -{ - studio::Instance::CanvasTreeModel canvas_tree_model; - canvas_tree=manage(new class Gtk::TreeView()); - { - Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("ID")) ); -// Gtk::CellRendererPixbuf* icon_cellrenderer = Gtk::manage( new Gtk::CellRendererPixbuf() ); - - //column->pack_start(*icon_cellrenderer,false); - column->pack_start(canvas_tree_model.icon, false); //false = don't expand. - column->pack_start(canvas_tree_model.label); - -//#ifdef NDEBUG -// column->add_attribute(icon_cellrenderer->property_pixbuf(), canvas_tree_model.icon); -//#endif - - canvas_tree->append_column(*column); - } - canvas_tree->set_rules_hint(); - canvas_tree->signal_row_activated().connect(sigc::mem_fun(*this,&Dock_Canvases::on_row_activate)); - //canvas_tree->signal_event().connect(sigc::mem_fun(*this,&Dock_Canvases::on_tree_event)); - canvas_tree->add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); - canvas_tree->add_events(Gdk::BUTTON1_MOTION_MASK); - canvas_tree->show(); - canvas_tree->set_headers_visible(false); - - Gtk::ScrolledWindow *scrolledwindow = manage(new class Gtk::ScrolledWindow()); - scrolledwindow->set_flags(Gtk::CAN_FOCUS); - scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - scrolledwindow->add(*canvas_tree); - scrolledwindow->set_shadow_type(Gtk::SHADOW_ETCHED_IN); - scrolledwindow->show_all(); - - return scrolledwindow; -} - -etl::loose_handle -Dock_Canvases::get_selected_canvas_view() -{ - return get_selected_instance()->find_canvas_view(get_selected_canvas()); -} - -etl::loose_handle -Dock_Canvases::get_selected_canvas() -{ - Glib::RefPtr selection=canvas_tree->get_selection(); - - if(!selection || !selection->get_selected()) - return 0; - - studio::Instance::CanvasTreeModel canvas_tree_model; - - return static_cast >((*selection->get_selected())[canvas_tree_model.canvas]); -} - - - -void -Dock_Canvases::set_selected_instance_signal(etl::handle x) -{ - set_selected_instance(x); -} - -void -Dock_Canvases::set_selected_instance_(etl::handle instance) -{ - if(studio::App::shutdown_in_progress) - return; - - selected_instance=instance; - if(instance) - { - canvas_tree->set_model(instance->canvas_tree_store()); - canvas_tree->show(); - } - else - { - canvas_tree->set_model(Glib::RefPtr< Gtk::TreeModel >()); - canvas_tree->hide(); - } -} - -void -Dock_Canvases::set_selected_instance(etl::loose_handle x) -{ - if(studio::App::shutdown_in_progress) - return; - - // if it's already selected, don't select it again - if (x==selected_instance) - return; - - set_selected_instance_(x); -} - -void -Dock_Canvases::new_instance(etl::handle instance) -{ - if(studio::App::shutdown_in_progress) - return; - - assert(instance); - - etl::loose_handle loose_instance(instance); - - instance->synfigapp::Instance::signal_filename_changed().connect(sigc::mem_fun(*this,&Dock_Canvases::refresh_instances)); - instance->synfigapp::Instance::signal_filename_changed().connect( - sigc::bind >( - sigc::mem_fun(*this,&Dock_Canvases::set_selected_instance), - loose_instance - ) - ); - - present(); - -} - -void -Dock_Canvases::delete_instance(etl::handle instance) -{ - if(studio::App::shutdown_in_progress) - return; - - refresh_instances(); - - if(selected_instance==instance) - { - set_selected_instance(0); - } -} - -void -Dock_Canvases::refresh_instances() -{ - if(studio::App::shutdown_in_progress) - return; -} - -void -Dock_Canvases::on_row_activate(const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn *) -{ - assert(get_selected_instance()); - studio::Instance::CanvasTreeModel canvas_tree_model; - const Gtk::TreeRow row = *(get_selected_instance()->canvas_tree_store()->get_iter(path)); - if(row[canvas_tree_model.is_canvas]) - get_selected_instance()->focus(row[canvas_tree_model.canvas]); - else - studio::App::dialog_not_implemented(); -} diff --git a/synfig-studio/src/gui/dock_canvases.h b/synfig-studio/src/gui/dock_canvases.h deleted file mode 100644 index 34bdbaa..0000000 --- a/synfig-studio/src/gui/dock_canvases.h +++ /dev/null @@ -1,88 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_canvases.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_DIALOG_CANVASES_H -#define __SYNFIG_STUDIO_DIALOG_CANVASES_H - -/* === H E A D E R S ======================================================= */ - -#include "dockable.h" -#include -#include "instance.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_Canvases : public Dockable -{ - Gtk::TreeView *canvas_tree; - //Gtk::Menu menu; - etl::loose_handle selected_instance; - -private: - - void set_selected_instance_(etl::handle x); - - etl::loose_handle get_selected_instance() { return selected_instance; } - - etl::loose_handle get_selected_canvas(); - - etl::loose_handle get_selected_canvas_view(); - - void set_selected_instance(etl::loose_handle x); - - void set_selected_instance_signal(etl::handle x); - - void new_instance(etl::handle x); - - void delete_instance(etl::handle x); - - void refresh_instances(); - - bool close(); - - void on_row_activate(const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn *); - //bool on_tree_event(GdkEvent *event); - - - - void on_action_toggle(const Glib::ustring& path); - Gtk::Widget* create_canvas_tree(); - -public: - - Dock_Canvases(); - ~Dock_Canvases(); -}; // END of Dock_Canvases - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dock_canvasspecific.cpp b/synfig-studio/src/gui/dock_canvasspecific.cpp deleted file mode 100644 index dc655ef..0000000 --- a/synfig-studio/src/gui/dock_canvasspecific.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_canvasspecific.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 "app.h" -#include "dock_canvasspecific.h" - -#include -#include -#include "instance.h" -#include -#include -//#include -#include -#include "metadatatreestore.h" -#include "canvasview.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 ========================================================= */ - -/* === 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_CanvasSpecific::Dock_CanvasSpecific(const synfig::String& name,const synfig::String& local_name,Gtk::StockID stock_id_): - Dockable(name,local_name,stock_id_) -{ - App::signal_instance_created().connect(sigc::mem_fun(*this,&Dock_CanvasSpecific::init_instance)); -} - -Dock_CanvasSpecific::~Dock_CanvasSpecific() -{ -} - -etl::loose_handle -Dock_CanvasSpecific::get_canvas_view() -{ - return App::get_selected_canvas_view(); -} - -etl::loose_handle -Dock_CanvasSpecific::get_canvas_interface() -{ - if(get_canvas_view()) - return get_canvas_view()->canvas_interface(); - return 0; -} - -void -Dock_CanvasSpecific::init_canvas_view_vfunc(etl::loose_handle /*canvas_view*/) -{ -} - -void -Dock_CanvasSpecific::init_instance_vfunc(etl::loose_handle /*instance*/) -{ -} - -void -Dock_CanvasSpecific::changed_canvas_view_vfunc(etl::loose_handle /*canvas_view*/) -{ -} - -void -Dock_CanvasSpecific::init_instance(etl::handle instance) -{ - etl::clock timer;timer.reset(); - instance->signal_canvas_view_created().connect(sigc::mem_fun(*this,&Dock_CanvasSpecific::init_canvas_view)); - init_instance_vfunc(instance); - // synfig::info("%s init_instance() took %f seconds",get_local_name().c_str(),float(timer())); -} - -void -Dock_CanvasSpecific::delete_instance(etl::handle /*instance*/) -{ - changed_canvas_view_vfunc(0); -} - -void -Dock_CanvasSpecific::init_canvas_view(CanvasView* canvas_view) -{ - /* - canvas_view->signal_focus_in_event().connect( - sigc::hide( - sigc::bind_return( - sigc::mem_fun( - *this, - &Dock_CanvasSpecific::canvas_view_changed - ), - false - ) - ) - ); - */ - // synfig::info("%s init_canvas_view() Starting init...",get_local_name().c_str()); - etl::clock timer;timer.reset(); - App::signal_canvas_view_focus().connect( - sigc::hide( - sigc::mem_fun( - *this, - &Dock_CanvasSpecific::canvas_view_changed - ) - ) - ); - init_canvas_view_vfunc(canvas_view); - // synfig::info("%s init_canvas_view() took %f seconds",get_local_name().c_str(),float(timer())); -} - -void -Dock_CanvasSpecific::canvas_view_changed() -{ - etl::loose_handle canvas_view(App::get_selected_canvas_view()); -/* if(canvas_view) - { - canvas_delete_connection.disconnect(); - canvas_delete_connection=canvas_view->signal_deleted().connect( - sigc::bind( - sigc::mem_fun( - *this, - &Dock_CanvasSpecific::changed_canvas_view - ), - etl::loose_handle(0) - ) - ); - } -*/ - -// #ifdef _DEBUG -// synfig::info("%s canvas_view_changed: start",get_local_name().c_str()); -// #endif - changed_canvas_view_vfunc(canvas_view); -// #ifdef _DEBUG -// synfig::info("%s canvas_view_changed: end",get_local_name().c_str()); -// #endif -} diff --git a/synfig-studio/src/gui/dock_canvasspecific.h b/synfig-studio/src/gui/dock_canvasspecific.h deleted file mode 100644 index 24efc78..0000000 --- a/synfig-studio/src/gui/dock_canvasspecific.h +++ /dev/null @@ -1,73 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_canvasspecific.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_CANVASSPECIFIC_H -#define __SYNFIG_STUDIO_DOCK_CANVASSPECIFIC_H - -/* === H E A D E R S ======================================================= */ - -#include "dockable.h" -#include -#include "instance.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 CanvasView; -class Instance; - -class Dock_CanvasSpecific : public Dockable -{ - sigc::connection canvas_delete_connection; -protected: - virtual void init_instance_vfunc(etl::loose_handle instance); - - virtual void init_canvas_view_vfunc(etl::loose_handle canvas_view); - virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); - -private: - void init_canvas_view(CanvasView* canvas_view); - void init_instance(etl::handle instance); - void delete_instance(etl::handle instance); - void canvas_view_changed(); - void changed_canvas_view(etl::loose_handle canvas_view) { return changed_canvas_view_vfunc(canvas_view); } -public: - - etl::loose_handle get_canvas_view(); - etl::loose_handle get_canvas_interface(); - - Dock_CanvasSpecific(const synfig::String& name,const synfig::String& local_name,Gtk::StockID stock_id_=Gtk::StockID(" ")); - virtual ~Dock_CanvasSpecific(); -}; // END of Dock_CanvasSpecific - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dock_children.cpp b/synfig-studio/src/gui/dock_children.cpp deleted file mode 100644 index 0b65306..0000000 --- a/synfig-studio/src/gui/dock_children.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_children.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_children.h" -#include "app.h" - -#include -#include -#include "instance.h" -#include -#include -#include -#include -#include "childrentreestore.h" -#include "childrentree.h" -#include "canvasview.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_Children::Dock_Children(): - Dock_CanvasSpecific("children",_("Children"),Gtk::StockID("synfig-children")) -{ - //! \todo the combination of set_use_scrolled(false) and - //! add(*tree_view) causes crashes when - //! Dockable::prev_widget_ is left referencing a - //! ChildrenTree that has already been destroyed. - // set_use_scrolled(false); -} - -Dock_Children::~Dock_Children() -{ -} - -void -Dock_Children::init_canvas_view_vfunc(etl::loose_handle canvas_view) -{ - Glib::RefPtr children_tree_store; - children_tree_store=ChildrenTreeStore::create(canvas_view->canvas_interface()); - - ChildrenTree* children_tree(new ChildrenTree()); - children_tree->set_model(children_tree_store); - children_tree->set_time_adjustment(canvas_view->time_adjustment()); - - - canvas_view->set_tree_model(get_name(),children_tree_store); - canvas_view->set_ext_widget(get_name(),children_tree); -} - -void -Dock_Children::changed_canvas_view_vfunc(etl::loose_handle canvas_view) -{ - if(canvas_view) - { - Gtk::Widget* tree_view(canvas_view->get_ext_widget(get_name())); - - add(*tree_view); - tree_view->show(); - } - else clear_previous(); - -} diff --git a/synfig-studio/src/gui/dock_children.h b/synfig-studio/src/gui/dock_children.h deleted file mode 100644 index a65d3da..0000000 --- a/synfig-studio/src/gui/dock_children.h +++ /dev/null @@ -1,60 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_children.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_CHILDREN_H -#define __SYNFIG_STUDIO_DOCK_CHILDREN_H - -/* === H E A D E R S ======================================================= */ - -#include "dockable.h" -#include -#include "instance.h" -#include "dock_canvasspecific.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_Children : public Dock_CanvasSpecific -{ -protected: - virtual void init_canvas_view_vfunc(etl::loose_handle canvas_view); - virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); - -public: - - - Dock_Children(); - ~Dock_Children(); -}; // END of Dock_Children - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dock_curves.cpp b/synfig-studio/src/gui/dock_curves.cpp deleted file mode 100644 index d299246..0000000 --- a/synfig-studio/src/gui/dock_curves.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_curves.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_curves.h" -#include "app.h" - -#include -#include -#include "instance.h" -#include -#include -#include -#include "canvasview.h" -#include "layerparamtreestore.h" -#include "workarea.h" -#include "widgets/widget_curves.h" -#include "layerparamtreestore.h" -#include -#include -#include "widgets/widget_timeslider.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_Curves::Dock_Curves(): - Dock_CanvasSpecific("curves",_("Curves"),Gtk::StockID("synfig-curves")) -{ - last_widget_curves_=0; - table_=0; - - hscrollbar_=new Gtk::HScrollbar(); - vscrollbar_=new Gtk::VScrollbar(); - widget_timeslider_= new Widget_Timeslider(); -} - -Dock_Curves::~Dock_Curves() -{ - if(table_)delete table_; - delete hscrollbar_; - delete vscrollbar_; - delete widget_timeslider_; -} - -static void -_curve_selection_changed(Gtk::TreeView* param_tree_view,Widget_Curves* curves) -{ - LayerParamTreeStore::Model model; - Gtk::TreeIter iter; - if(!param_tree_view->get_selection()->count_selected_rows()) - { - curves->clear(); - curves->refresh(); - return; - } - - std::list value_descs; - - iter=param_tree_view->get_selection()->get_selected(); - value_descs.push_back((*iter)[model.value_desc]); - curves->set_value_descs(value_descs); -} - -void -Dock_Curves::init_canvas_view_vfunc(etl::loose_handle canvas_view) -{ - Widget_Curves* curves(new Widget_Curves()); - curves->set_time_adjustment(canvas_view->time_adjustment()); - - Gtk::TreeView* param_tree_view( - static_cast(canvas_view->get_ext_widget("params")) - ); - - param_tree_view->get_selection()->signal_changed().connect( - sigc::bind( - sigc::bind( - sigc::ptr_fun( - _curve_selection_changed - ),curves - ),param_tree_view - ) - ); - - canvas_view->set_ext_widget(get_name(),curves); -} - -void -Dock_Curves::refresh_selected_param() -{ -/* Gtk::TreeView* tree_view( - static_cast(get_canvas_view()->get_ext_widget(get_name())) - ); - Gtk::TreeModel::iterator iter(tree_view->get_selection()->get_selected()); - - if(iter) - { - LayerParamTreeStore::Model model; - get_canvas_view()->work_area->set_selected_value_node( - (synfig::ValueNode::Handle)(*iter)[model.value_node] - ); - } - else - { - get_canvas_view()->work_area->set_selected_value_node(0); - } -*/ -} - -void -Dock_Curves::changed_canvas_view_vfunc(etl::loose_handle canvas_view) -{ - if(table_) - { - table_->hide(); - delete table_; - hscrollbar_->unset_adjustment(); - vscrollbar_->unset_adjustment(); - //widget_timeslider_->unset_adjustment(); - table_=0; - } - - - if(canvas_view) - { - last_widget_curves_=dynamic_cast( - canvas_view->get_ext_widget(get_name()) - ); - - vscrollbar_->set_adjustment(last_widget_curves_->get_range_adjustment()); - hscrollbar_->set_adjustment(canvas_view->time_window_adjustment()); - widget_timeslider_->set_time_adjustment(&canvas_view->time_adjustment()); - widget_timeslider_->set_bounds_adjustment(&canvas_view->time_window_adjustment()); - widget_timeslider_->set_global_fps(canvas_view->get_canvas()->rend_desc().get_frame_rate()); - - table_=new Gtk::Table(2,2); - table_->attach(*widget_timeslider_, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK); - table_->attach(*last_widget_curves_, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - table_->attach(*hscrollbar_, 0, 1, 2, 3, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK); - table_->attach(*vscrollbar_, 1, 2, 0, 2, Gtk::FILL|Gtk::SHRINK, Gtk::FILL|Gtk::EXPAND); - add(*table_); - - //add(*last_widget_curves_); - last_widget_curves_->show(); - table_->show_all(); - show_all(); - } - else - { - //clear_previous(); - } -} diff --git a/synfig-studio/src/gui/dock_curves.h b/synfig-studio/src/gui/dock_curves.h deleted file mode 100644 index dbe913f..0000000 --- a/synfig-studio/src/gui/dock_curves.h +++ /dev/null @@ -1,74 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_curves.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_CURVES_H -#define __SYNFIG_STUDIO_DOCK_CURVES_H - -/* === H E A D E R S ======================================================= */ - -#include "dockable.h" -#include -#include "instance.h" -#include "dock_canvasspecific.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 Gtk { class Table; class HScrollbar; class VScrollbar; }; - -namespace studio { - -class Widget_Curves; -class Widget_Timeslider; - -class Dock_Curves : public Dock_CanvasSpecific -{ - Gtk::Table* table_; - Gtk::HScrollbar* hscrollbar_; - Gtk::VScrollbar* vscrollbar_; - - Widget_Timeslider* widget_timeslider_; - Widget_Curves* last_widget_curves_; - -protected: - virtual void init_canvas_view_vfunc(etl::loose_handle canvas_view); - virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); - - void refresh_selected_param(); - -public: - - - Dock_Curves(); - ~Dock_Curves(); -}; // END of Dock_Keyframes - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dock_history.cpp b/synfig-studio/src/gui/dock_history.cpp deleted file mode 100644 index cddf07b..0000000 --- a/synfig-studio/src/gui/dock_history.cpp +++ /dev/null @@ -1,447 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_history.cpp -** \brief Template File -** -** $Id$ -** -** \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 -** 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_history.h" -#include "app.h" - - - -#include -#include -#include "instance.h" -#include -#include -#include -#include -#include "historytreestore.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 ========================================================= */ -#define COLUMNID_JUMP (787584) -#define ColumnID int - -/* === 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_History::Dock_History(): - Dock_CanvasSpecific("history",_("History"),Gtk::StockID("gtk-undo")), - action_group(Gtk::ActionGroup::create("action_group_dock_history")) -{ - App::signal_instance_deleted().connect(sigc::mem_fun(*this,&studio::Dock_History::delete_instance)); - App::signal_instance_selected().connect(sigc::mem_fun(*this,&studio::Dock_History::set_selected_instance_signal)); - - action_group->add(Gtk::Action::create( - "clear-undo", - Gtk::StockID("synfig-clear_undo"), - _("Clear Undo Stack"), - _("Clear the undo stack") - ), - sigc::mem_fun( - *this, - &Dock_History::clear_undo - ) - ); - action_group->add(Gtk::Action::create( - "clear-redo", - Gtk::StockID("synfig-clear_redo"), - _("Clear Redo Stack"), - _("Clear the redo stack") - ), - sigc::mem_fun( - *this, - &Dock_History::clear_redo - ) - ); - action_group->add(Gtk::Action::create( - "clear-undo-and-redo", - Gtk::Stock::CLEAR, - _("Clear Undo and Redo Stacks"), - _("Clear the undo and redo stacks") - ), - sigc::mem_fun( - *this, - &Dock_History::clear_undo_and_redo - ) - ); - action_group->add(Gtk::Action::create( - "undo", - Gtk::StockID("gtk-undo"), - _("Undo"), - _("Undo the previous action") - ), - sigc::ptr_fun(studio::App::undo) - ); - action_group->add(Gtk::Action::create( - "redo", - Gtk::StockID("gtk-redo"), - _("Redo"), - _("Redo the previously undone action") - ), - sigc::ptr_fun(studio::App::redo) - ); - - action_group->add( Gtk::Action::create("toolbar-history", _("History")) ); - App::ui_manager()->insert_action_group(action_group); - - Glib::ustring ui_info = - "" - " " - " " - " " - " " - " " - " " - " " - "" - ; - - App::ui_manager()->add_ui_from_string(ui_info); - - action_group->set_sensitive(false); - - set_toolbar(*dynamic_cast(App::ui_manager()->get_widget("/toolbar-history"))); - add(*create_action_tree()); -} - -Dock_History::~Dock_History() -{ -} - -void -Dock_History::init_instance_vfunc(etl::loose_handle instance) -{ - instance->signal_undo_redo_status_changed().connect( - sigc::mem_fun(*this,&Dock_History::update_undo_redo) - ); -} - -Gtk::Widget* -Dock_History::create_action_tree() -{ - studio::HistoryTreeStore::Model history_tree_model; - action_tree=manage(new class Gtk::TreeView()); - { - Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column("") ); - - Gtk::CellRendererToggle* toggle_cr = Gtk::manage( new Gtk::CellRendererToggle() ); - toggle_cr->signal_toggled().connect(sigc::mem_fun(*this, &studio::Dock_History::on_action_toggle) ); - - column->pack_start(*toggle_cr); //false = don't expand. - column->add_attribute(toggle_cr->property_active(),history_tree_model.is_active); - column->set_resizable(); - column->set_clickable(); - - action_tree->append_column(*column); - } - /*{ - Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Canvas")) ); - Gtk::CellRendererText *text_cr=Gtk::manage(new Gtk::CellRendererText()); - text_cr->property_foreground()=Glib::ustring("#7f7f7f"); - - column->pack_start(*text_cr); - column->add_attribute(text_cr->property_text(),history_tree_model.canvas_id); - column->add_attribute(text_cr->property_foreground_set(),history_tree_model.is_redo); - - action_tree->append_column(*column); - }*/ - { - Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Jump")) ); - - Gtk::CellRendererText* cell_renderer_jump=Gtk::manage(new Gtk::CellRendererText()); - column->pack_start(*cell_renderer_jump,true); - - cell_renderer_jump->property_text()=_("(JMP)"); - cell_renderer_jump->property_foreground()="#003a7f"; - - column->set_resizable(); - column->set_clickable(); - - column->set_sort_column(COLUMNID_JUMP); - - action_tree->append_column(*column); - //column->clicked(); - } - { - Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Action")) ); - - Gtk::CellRendererText *text_cr=Gtk::manage(new Gtk::CellRendererText()); - text_cr->property_foreground()=Glib::ustring("#7f7f7f"); - - - - //column->pack_start(history_tree_model.icon, false); //false = don't expand. - column->pack_start(*text_cr); - column->add_attribute(text_cr->property_text(),history_tree_model.name); - column->add_attribute(text_cr->property_foreground_set(),history_tree_model.is_redo); - - action_tree->append_column(*column); - } - - action_tree->set_enable_search(true); - action_tree->set_search_column(history_tree_model.name); - action_tree->set_search_equal_func(sigc::ptr_fun(&studio::HistoryTreeStore::search_func)); - - action_tree->set_rules_hint(); -// action_tree->signal_row_activated().connect(sigc::mem_fun(*this,&Dock_History::on_row_activate)); - action_tree->signal_event().connect(sigc::mem_fun(*this,&Dock_History::on_action_event)); -// action_tree->add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); -// action_tree->add_events(Gdk::BUTTON1_MOTION_MASK); - action_tree->show(); - - Gtk::ScrolledWindow *scrolledwindow = manage(new class Gtk::ScrolledWindow()); - scrolledwindow->set_flags(Gtk::CAN_FOCUS); - scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - scrolledwindow->add(*action_tree); - scrolledwindow->set_shadow_type(Gtk::SHADOW_ETCHED_IN); - scrolledwindow->show_all(); - -/* { - Gtk::Widget& widget(*action_tree); - Pango::FontDescription font(widget.get_modifier_style()->get_font()); - font.set_size(Pango::SCALE*5); - widget.get_modifier_style()->set_font(font); - widget.modify_font(font); - } -*/ - return scrolledwindow; -} - -void -Dock_History::clear_undo() -{ - if(selected_instance && App::dialog_yes_no(_("Clear History"), - _("You will not be able to undo any changes that you have made!\nAre you sure you want to clear the undo stack?"))) - selected_instance->clear_undo_stack(); -} - -void -Dock_History::clear_redo() -{ - if(selected_instance && App::dialog_yes_no(_("Clear History"), - _("You will not be able to redo any changes that you have made!\nAre you sure you want to clear the redo stack?"))) - selected_instance->clear_redo_stack(); -} - -void -Dock_History::clear_undo_and_redo() -{ - if(selected_instance && App::dialog_yes_no(_("Clear History"), - _("You will not be able to undo or redo any changes that you have made!\nAre you sure you want to clear the undo and redo stacks?"))) - { - selected_instance->clear_undo_stack(); - selected_instance->clear_redo_stack(); - } -} - -void -Dock_History::update_undo_redo() -{ - etl::handle instance=App::get_selected_instance(); - if(instance) - { - action_group->get_action("undo")->set_sensitive(instance->get_undo_status()); - action_group->get_action("clear-undo")->set_sensitive(instance->get_undo_status()); - action_group->get_action("redo")->set_sensitive(instance->get_redo_status()); - action_group->get_action("clear-redo")->set_sensitive(instance->get_redo_status()); - action_group->get_action("clear-undo-and-redo")->set_sensitive(instance->get_undo_status() || instance->get_redo_status()); - } -} - -void -Dock_History::on_undo_tree_changed() -{ - Gtk::TreeModel::Children children(selected_instance->history_tree_store()->children()); - - if (!children.size()) - return; - - studio::HistoryTreeStore::Model model; - - Gtk::TreeModel::Children::iterator iter, prev = children.end(); - for (iter = children.begin(); iter != children.end(); prev = iter++) - if ((*iter)[model.is_redo]) - { - if (prev == children.end()) - action_tree->get_selection()->unselect_all(); - else - { - action_tree->scroll_to_row(Gtk::TreePath(prev), 0.5); - action_tree->get_selection()->select(prev); - } - return; - } - - action_tree->scroll_to_row(Gtk::TreePath(prev), 0.5); - action_tree->get_selection()->select(prev); -} - -void -Dock_History::set_selected_instance_(etl::handle instance) -{ - if(studio::App::shutdown_in_progress) - return; - - if (on_undo_tree_changed_connection) - on_undo_tree_changed_connection.disconnect(); - - selected_instance=instance; - if(instance) - { - on_undo_tree_changed_connection = selected_instance->history_tree_store()->signal_undo_tree_changed().connect( - sigc::mem_fun(*this,&Dock_History::on_undo_tree_changed)); - - action_tree->set_model(instance->history_tree_store()); - action_tree->show(); - update_undo_redo(); - action_group->set_sensitive(true); - } - else - { - action_tree->set_model(Glib::RefPtr< Gtk::TreeModel >()); - action_tree->hide(); - action_group->set_sensitive(false); - } -} - -void -Dock_History::set_selected_instance_signal(etl::handle x) -{ - set_selected_instance(x); -} - -void -Dock_History::set_selected_instance(etl::loose_handle x) -{ - if(studio::App::shutdown_in_progress) - return; - - // if it's already selected, don't select it again - if (x==selected_instance) - return; - - std::list >::iterator iter; - - set_selected_instance_(x); -} - -void -Dock_History::delete_instance(etl::handle instance) -{ - if(studio::App::shutdown_in_progress) - return; - - if(selected_instance==instance) - { - set_selected_instance(0); - } -} - -bool -Dock_History::on_action_event(GdkEvent *event) -{ - studio::HistoryTreeStore::Model model; - switch(event->type) - { - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - { - Gtk::TreeModel::Path path; - Gtk::TreeViewColumn *column; - int cell_x, cell_y; - if(!action_tree->get_path_at_pos( - int(event->button.x),int(event->button.y), // x, y - path, // TreeModel::Path& - column, //TreeViewColumn*& - cell_x,cell_y //int&cell_x,int&cell_y - ) - ) break; - const Gtk::TreeRow row = *(action_tree->get_model()->get_iter(path)); - - //signal_user_click()(event->button.button,row,(ColumnID)column->get_sort_column_id()); - if((ColumnID)column->get_sort_column_id()==COLUMNID_JUMP) - { - etl::handle action(row[model.action]); - try{ - if((bool)row[model.is_undo]) - { - while(get_selected_instance()->undo_action_stack().size() && get_selected_instance()->undo_action_stack().front()!=action) - if(get_selected_instance()->undo()==false) - throw int(); - } - else if((bool)row[model.is_redo]) - { - while(get_selected_instance()->redo_action_stack().size() && get_selected_instance()->undo_action_stack().front()!=action) - if(get_selected_instance()->redo()==false) - throw int(); - } - } - catch(int) - { - return true; - } - } - } - - case GDK_BUTTON_RELEASE: - break; - default: - break; - } - return false; -} - -void -Dock_History::on_action_toggle(const Glib::ustring& path_string) -{ - studio::HistoryTreeStore::Model history_tree_model; - - Gtk::TreePath path(path_string); - - const Gtk::TreeRow row = *(selected_instance->history_tree_store()->get_iter(path)); - - handle action=row[history_tree_model.action]; - - selected_instance->synfigapp::Instance::set_action_status(action,!action->is_active()); -} diff --git a/synfig-studio/src/gui/dock_history.h b/synfig-studio/src/gui/dock_history.h deleted file mode 100644 index 00154b2..0000000 --- a/synfig-studio/src/gui/dock_history.h +++ /dev/null @@ -1,90 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_history.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_DIALOG_HISTORY_H -#define __SYNFIG_STUDIO_DIALOG_HISTORY_H - -/* === H E A D E R S ======================================================= */ - -#include "dockable.h" -#include -#include "instance.h" -#include -#include "dock_canvasspecific.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_History : public Dock_CanvasSpecific -{ - Glib::RefPtr action_group; - Gtk::TreeView *action_tree; - - etl::loose_handle selected_instance; - - sigc::connection on_undo_tree_changed_connection; - - void on_undo_tree_changed(); - - void set_selected_instance_(etl::handle x); - - - void set_selected_instance(etl::loose_handle x); - - void set_selected_instance_signal(etl::handle x); - - void delete_instance(etl::handle x); - - Gtk::Widget* create_action_tree(); - -public: - - etl::loose_handle get_selected_instance() { return selected_instance; } - - void clear_undo(); - void clear_redo(); - void clear_undo_and_redo(); - - bool on_action_event(GdkEvent *event); - void on_action_toggle(const Glib::ustring& path); - - void update_undo_redo(); - - Dock_History(); - ~Dock_History(); -protected: - virtual void init_instance_vfunc(etl::loose_handle instance); - -}; // END of Dock_History - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dock_info.cpp b/synfig-studio/src/gui/dock_info.cpp deleted file mode 100644 index 42c8a82..0000000 --- a/synfig-studio/src/gui/dock_info.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_info.cpp -** \brief Dock Info 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_info.h" -#include "canvasview.h" -#include "workarea.h" - -#include -#include // for gamma_in() -#include - -#include -#include - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; - -/* === 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 ======================================================= */ - -/* === E N T R Y P O I N T ================================================= */ - -void studio::Dock_Info::on_mouse_move() -{ - Point pos = get_canvas_view()->work_area->get_cursor_pos(); - - Distance xv(pos[0],Distance::SYSTEM_UNITS); - xv.convert(App::distance_system, get_canvas_view()->get_canvas()->rend_desc()); - - Distance yv(pos[1],Distance::SYSTEM_UNITS); - yv.convert(App::distance_system, get_canvas_view()->get_canvas()->rend_desc()); - - //get the color and set the labels - - x.set_text(xv.get_string(3)); - y.set_text(yv.get_string(3)); - - Color c = get_canvas_view()->get_canvas()->get_context().get_color(pos); - float cr = c.get_r(),cg = c.get_g(), cb = c.get_b(); - - if(use_colorspace_gamma()) - { - cr = gamma_in(cr); - cg = gamma_in(cg); - cb = gamma_in(cb); - } - - r.set_text(strprintf("%.1f%%",cr*100)); - g.set_text(strprintf("%.1f%%",cg*100)); - b.set_text(strprintf("%.1f%%",cb*100)); - a.set_text(strprintf("%.1f%%",c.get_a()*100)); -} - -studio::Dock_Info::Dock_Info() -:Dock_CanvasSpecific("info",_("Info"),Gtk::StockID("synfig-info")) -{ - set_use_scrolled(false); - - Gtk::Table *table = manage(new Gtk::Table); - - //pos labels - table->attach(*manage(new Gtk::Label(_("X: "))),0,1,0,2,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); - table->attach(*manage(new Gtk::Label(_("Y: "))),0,1,2,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); - - //pos - table->attach(x,1,2,0,2,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); - table->attach(y,1,2,2,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); - - //separator - table->attach(*manage(new Gtk::VSeparator),2,3,0,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); - - //color label - table->attach(*manage(new Gtk::Label(_("R: "))),3,4,0,1,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); - table->attach(*manage(new Gtk::Label(_("G: "))),3,4,1,2,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); - table->attach(*manage(new Gtk::Label(_("B: "))),3,4,2,3,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); - table->attach(*manage(new Gtk::Label(_("A: "))),3,4,3,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); - - //color - table->attach(r,4,5,0,1,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); - table->attach(g,4,5,1,2,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); - table->attach(b,4,5,2,3,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); - table->attach(a,4,5,3,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); - - table->attach(*manage(new Gtk::Label),0,5,4,5); - - table->show_all(); - - add(*table); -} - -studio::Dock_Info::~Dock_Info() -{ -} - -void studio::Dock_Info::changed_canvas_view_vfunc(etl::loose_handle canvas_view) -{ - mousecon.disconnect(); - - if(canvas_view && canvas_view->get_work_area()) - { - mousecon = get_canvas_view()->work_area->signal_cursor_moved().connect(sigc::mem_fun(*this,&Dock_Info::on_mouse_move)); - } -} diff --git a/synfig-studio/src/gui/dock_info.h b/synfig-studio/src/gui/dock_info.h deleted file mode 100644 index 83f4d16..0000000 --- a/synfig-studio/src/gui/dock_info.h +++ /dev/null @@ -1,62 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_info.h -** \brief Info Dock 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_DOCK_INFO_H -#define __SYNFIG_DOCK_INFO_H - -/* === H E A D E R S ======================================================= */ -#include "dock_canvasspecific.h" -#include "sigc++/signal.h" - -#include "widgets/widget_distance.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_Info : public Dock_CanvasSpecific -{ - Gtk::Label r,g,b,a; - Gtk::Label x,y; - - sigc::connection mousecon; - - void on_mouse_move(); - -public: - Dock_Info(); - ~Dock_Info(); - - virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); -}; - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dock_keyframes.cpp b/synfig-studio/src/gui/dock_keyframes.cpp deleted file mode 100644 index 44e9893..0000000 --- a/synfig-studio/src/gui/dock_keyframes.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_keyframes.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_keyframes.h" -#include "app.h" - -#include -#include -#include "instance.h" -#include -#include -#include -#include "keyframetreestore.h" -#include "keyframetree.h" -#include "canvasview.h" -#include "keyframeactionmanager.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_Keyframes::Dock_Keyframes(): - Dock_CanvasSpecific("keyframes",_("Keyframes"),Gtk::StockID("synfig-keyframes")), - action_group(Gtk::ActionGroup::create("action_group_dock_keyframes")), - keyframe_action_manager(new KeyframeActionManager) -{ - keyframe_action_manager->set_ui_manager(App::ui_manager()); - keyframe_action_manager->signal_show_keyframe_properties().connect( - sigc::mem_fun(*this,&Dock_Keyframes::show_keyframe_properties) - ); - - Glib::ustring ui_info = - "" - " " - " " - " " - " " - " " - " " - "" - ; - - App::ui_manager()->add_ui_from_string(ui_info); - - set_toolbar(*dynamic_cast(App::ui_manager()->get_widget("/toolbar-keyframe"))); -} - -Dock_Keyframes::~Dock_Keyframes() -{ -} - -void -Dock_Keyframes::show_keyframe_properties() -{ - if(get_canvas_view()) - get_canvas_view()->show_keyframe_dialog(); -} - -void -Dock_Keyframes::init_canvas_view_vfunc(etl::loose_handle canvas_view) -{ - Glib::RefPtr keyframe_tree_store; - keyframe_tree_store=KeyframeTreeStore::create(canvas_view->canvas_interface()); - - KeyframeTree* keyframe_tree(new KeyframeTree()); - keyframe_tree->set_model(keyframe_tree_store); - keyframe_tree->set_editable(true); - - canvas_view->set_tree_model(get_name(),keyframe_tree_store); - canvas_view->set_ext_widget(get_name(),keyframe_tree); -} - -void -Dock_Keyframes::changed_canvas_view_vfunc(etl::loose_handle canvas_view) -{ - if(canvas_view) - { - Gtk::Widget* tree_view(canvas_view->get_ext_widget(get_name())); - - add(*tree_view); - tree_view->show(); - - keyframe_action_manager->set_keyframe_tree(dynamic_cast(canvas_view->get_ext_widget(get_name()))); - keyframe_action_manager->set_canvas_interface(canvas_view->canvas_interface()); - keyframe_action_manager->refresh(); - } - else - { - clear_previous(); - - keyframe_action_manager->set_keyframe_tree(0); - keyframe_action_manager->set_canvas_interface(0); - keyframe_action_manager->refresh(); - } -} diff --git a/synfig-studio/src/gui/dock_keyframes.h b/synfig-studio/src/gui/dock_keyframes.h deleted file mode 100644 index 37c99c4..0000000 --- a/synfig-studio/src/gui/dock_keyframes.h +++ /dev/null @@ -1,79 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_keyframes.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_KEYFRAMES_H -#define __SYNFIG_STUDIO_DOCK_KEYFRAMES_H - -/* === H E A D E R S ======================================================= */ - -#include "dockable.h" -#include "dock_canvasspecific.h" -#include -#include "instance.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 studio { - -class KeyframeTreeStore; -class KeyframeTree; - -class KeyframeActionManager; - -class Dock_Keyframes : public Dock_CanvasSpecific -{ - Glib::RefPtr action_group; - - /* - void add_keyframe_pressed(); - void duplicate_keyframe_pressed(); - void delete_keyframe_pressed(); - */ - - void show_keyframe_properties(); - - KeyframeActionManager* keyframe_action_manager; - -protected: - virtual void init_canvas_view_vfunc(etl::loose_handle canvas_view); - virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); - - -public: - - - Dock_Keyframes(); - ~Dock_Keyframes(); -}; // END of Dock_Keyframes - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dock_layergroups.cpp b/synfig-studio/src/gui/dock_layergroups.cpp deleted file mode 100644 index d847ff7..0000000 --- a/synfig-studio/src/gui/dock_layergroups.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_layergroups.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_layergroups.h" -#include "app.h" - -#include -#include -#include "instance.h" -#include -#include -#include -#include -#include "canvasview.h" - -#include "layergrouptreestore.h" -#include "layergrouptree.h" -#include "groupactionmanager.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_LayerGroups::Dock_LayerGroups(): - Dock_CanvasSpecific("groups",_("Groups"),Gtk::StockID("synfig-group")), - action_group_group_ops(Gtk::ActionGroup::create("action_group_dock_layergroups")), - group_action_manager(new GroupActionManager) -{ - group_action_manager->set_ui_manager(App::ui_manager()); - - action_group_group_ops->add( Gtk::Action::create("toolbar-groups", _("Group Ops")) ); - - action_group_add=Gtk::Action::create("action-group_add", Gtk::Stock::ADD,_("Add a New Group"),_("Add a New Group")); - action_group_group_ops->add(action_group_add); - action_group_add->set_sensitive(false); - - App::ui_manager()->insert_action_group(action_group_group_ops); - - Glib::ustring ui_info = - "" - " " - " " - " " - " " - "" - ; - - App::ui_manager()->add_ui_from_string(ui_info); - - set_toolbar(*dynamic_cast(App::ui_manager()->get_widget("/toolbar-groups"))); -} - -Dock_LayerGroups::~Dock_LayerGroups() -{ - delete group_action_manager; -} - -void -Dock_LayerGroups::init_canvas_view_vfunc(etl::loose_handle canvas_view) -{ - Glib::RefPtr layer_group_tree_store; - layer_group_tree_store=LayerGroupTreeStore::create(canvas_view->canvas_interface()); - - LayerGroupTree* layer_group_tree(new LayerGroupTree()); - layer_group_tree->set_model(layer_group_tree_store); - layer_group_tree->signal_popup_layer_menu().connect(sigc::mem_fun(*canvas_view,&CanvasView::popup_layer_menu)); - - canvas_view->set_tree_model(get_name(),layer_group_tree_store); - canvas_view->set_ext_widget(get_name(),layer_group_tree); -} - -void -Dock_LayerGroups::changed_canvas_view_vfunc(etl::loose_handle canvas_view) -{ - if(canvas_view) - { - Gtk::Widget* tree_view(canvas_view->get_ext_widget(get_name())); - - add(*tree_view); - tree_view->show(); - - group_action_manager->set_group_tree(dynamic_cast(tree_view)); - group_action_manager->set_canvas_interface(canvas_view->canvas_interface()); - group_action_manager->refresh(); - } - else - { - clear_previous(); - group_action_manager->clear(); - group_action_manager->set_canvas_interface(0); - group_action_manager->set_group_tree(0); - } -} diff --git a/synfig-studio/src/gui/dock_layergroups.h b/synfig-studio/src/gui/dock_layergroups.h deleted file mode 100644 index bdb4f22..0000000 --- a/synfig-studio/src/gui/dock_layergroups.h +++ /dev/null @@ -1,71 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_layergroups.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_LAYERGROUPS_H -#define __SYNFIG_STUDIO_DOCK_LAYERGROUPS_H - -/* === H E A D E R S ======================================================= */ - -#include "dockable.h" -#include -#include "instance.h" -#include "dock_canvasspecific.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 Gtk { class HScale; } - -namespace studio { - -class GroupActionManager ; - -class Dock_LayerGroups : public Dock_CanvasSpecific -{ - Glib::RefPtr action_group_group_ops; - Glib::RefPtr action_group_add; - - GroupActionManager *group_action_manager; -protected: - virtual void init_canvas_view_vfunc(etl::loose_handle canvas_view); - virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); - -private: - -public: - - - Dock_LayerGroups(); - ~Dock_LayerGroups(); -}; // END of Dock_LayerGroups - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dock_layers.cpp b/synfig-studio/src/gui/dock_layers.cpp deleted file mode 100644 index 2c75e83..0000000 --- a/synfig-studio/src/gui/dock_layers.cpp +++ /dev/null @@ -1,295 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_layers.cpp -** \brief Template File -** -** $Id$ -** -** \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 -** 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_layers.h" -#include "app.h" - -#include -#include -#include "instance.h" -#include -#include -#include -#include -#include "layertreestore.h" -#include "layertree.h" -#include "canvasview.h" -#include "layeractionmanager.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 ========================================================= */ - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/*static void do_nothing(reference_counter x) -{ - synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,x.count()); -}*/ - -/* === M E T H O D S ======================================================= */ - -Dock_Layers::Dock_Layers(): - Dock_CanvasSpecific("layers",_("Layers"),Gtk::StockID("synfig-layer")), - layer_action_manager(new LayerActionManager) -{ - if(layer_action_manager)layer_action_manager->set_ui_manager(App::ui_manager()); - - action_group_new_layers=Gtk::ActionGroup::create("action_group_new_layers"); - action_group_layer_ops=Gtk::ActionGroup::create("action_group_layer_ops"); - - std::map category_map; - - // Build layer creation actions - synfig::Layer::Book::iterator iter; - for(iter=synfig::Layer::book().begin();iter!=synfig::Layer::book().end();++iter) - { - synfig::Layer::Book::value_type lyr(*iter); - - if(lyr.second.category==CATEGORY_DO_NOT_USE) - continue; - - action_group_new_layers->add(Gtk::Action::create( - strprintf("layer-new-%s",lyr.first.c_str()), - layer_icon(lyr.first.c_str()), - lyr.second.local_name,lyr.second.local_name - ), - sigc::hide_return( - sigc::bind( - sigc::mem_fun(*this,&studio::Dock_Layers::add_layer), - lyr.first - ) - ) - ); - - category_map[lyr.second.category]+=strprintf("",lyr.first.c_str()); - - //(*category_map)[lyr.second.category]->items().push_back(Gtk::Menu_Helpers::MenuElem(lyr.second.local_name, - //)); - } - - { - Glib::RefPtr action_group_categories(Gtk::ActionGroup::create("layer-category")); - synfig::String layer_ui_info; - - layer_ui_info+=""; - - std::map::iterator iter; - for(iter=category_map.begin();iter!=category_map.end();++iter) - { - layer_ui_info+=strprintf("%s",iter->first.c_str(),iter->second.c_str()); - action_group_categories->add(Gtk::Action::create(iter->first.c_str(),dgettext("synfig", iter->first.c_str()))); - } - - layer_ui_info+=""; - - App::ui_manager()->insert_action_group(action_group_categories); - App::ui_manager()->insert_action_group(action_group_new_layers); - - try - { - App::ui_manager()->add_ui_from_string(layer_ui_info); - } - catch(Glib::MarkupError x) - { - error("%s:%d caught MarkupError code %d: %s", __FILE__, __LINE__, x.code(), x.what().c_str()); - error("%s:%d with markup: \"%s\"", __FILE__, __LINE__, layer_ui_info.c_str()); - exit(1); - } - } - - if(layer_action_manager) - action_group_layer_ops->add(layer_action_manager->get_action_select_all_child_layers()); - - action_group_layer_ops->add( Gtk::Action::create("toolbar-layer", _("Layer Ops")) ); - App::ui_manager()->insert_action_group(action_group_layer_ops); - - Glib::ustring ui_info = - "" - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - "" - ; - - App::ui_manager()->add_ui_from_string(ui_info); - - action_group_new_layers->set_sensitive(false); - - set_toolbar(*dynamic_cast(App::ui_manager()->get_widget("/toolbar-layer"))); - - - - - - /* - reference_counter ref_count; - synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); - - { - sigc::signal tmp_signal; - - tmp_signal.connect( - sigc::bind( - sigc::ptr_fun(do_nothing), - ref_count - ) - ); - - synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); - tmp_signal(); - synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); - - tmp_signal.clear(); - synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); - - tmp_signal(); - synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); - tmp_signal.connect( - sigc::bind( - sigc::ptr_fun(do_nothing), - ref_count - ) - ); - synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); - } - synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); - assert(ref_count.count()==1); - */ -} - - -Dock_Layers::~Dock_Layers() -{ - delete layer_action_manager; -} - - -void -Dock_Layers::init_canvas_view_vfunc(etl::loose_handle canvas_view) -{ - Glib::RefPtr layer_tree_store; - layer_tree_store=LayerTreeStore::create(canvas_view->canvas_interface()); - - canvas_view->set_tree_model(get_name(),layer_tree_store); - LayerTree* layer_tree(new LayerTree()); - layer_tree->set_time_adjustment(canvas_view->time_adjustment()); - - layer_tree->signal_edited_value().connect( - sigc::hide_return( - sigc::mem_fun(*canvas_view->canvas_interface(), &synfigapp::CanvasInterface::change_value) - ) - ); - - // (a) should be before (b), (b) should be before (c) - canvas_view->set_ext_widget(get_name()+"_cmp",layer_tree); // (a) - canvas_view->set_ext_widget(get_name(),&layer_tree->get_layer_tree_view()); - canvas_view->set_ext_widget("params",&layer_tree->get_param_tree_view()); - - layer_tree->set_model(layer_tree_store); // (b) - canvas_view->set_tree_model("params",layer_tree->get_param_tree_view().get_model()); // (c) - - /* - canvas_view->layermenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-delete"),Gtk::AccelKey("Delete"), - sigc::mem_fun(*layer_tree, &LayerTree::on_delete_pressed)) - ); - */ - - // Hide the time bar - if(canvas_view->get_canvas()->rend_desc().get_time_start()==canvas_view->get_canvas()->rend_desc().get_time_end()) - canvas_view->hide_timebar(); - layer_tree_store->rebuild(); - present(); -} - -void -Dock_Layers::changed_canvas_view_vfunc(etl::loose_handle canvas_view) -{ - if(canvas_view) - { - Gtk::Widget* tree_view(canvas_view->get_ext_widget(get_name())); - - add(*tree_view); - tree_view->show(); - action_group_new_layers->set_sensitive(true); - if(layer_action_manager) - { - layer_action_manager->set_layer_tree(dynamic_cast(canvas_view->get_ext_widget(get_name()+"_cmp"))); - layer_action_manager->set_canvas_interface(canvas_view->canvas_interface()); - layer_action_manager->refresh(); - } - } - else - { - action_group_new_layers->set_sensitive(false); - if(layer_action_manager) - { - layer_action_manager->clear(); - layer_action_manager->set_canvas_interface(0); - layer_action_manager->set_layer_tree(0); - } - - clear_previous(); - } -} - -void -Dock_Layers::add_layer(synfig::String id) -{ - etl::loose_handle canvas_view(get_canvas_view()); - if(canvas_view) - { - canvas_view->add_layer(id); - } -} diff --git a/synfig-studio/src/gui/dock_layers.h b/synfig-studio/src/gui/dock_layers.h deleted file mode 100644 index b5eda42..0000000 --- a/synfig-studio/src/gui/dock_layers.h +++ /dev/null @@ -1,79 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_layers.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_LAYERS_H -#define __SYNFIG_STUDIO_DOCK_LAYERS_H - -/* === H E A D E R S ======================================================= */ - -#include "dockable.h" -#include -#include "instance.h" -#include "dock_canvasspecific.h" -#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 Gtk { class HScale; } - -namespace studio { - -class LayerActionManager; - -class Dock_Layers : public Dock_CanvasSpecific -{ - Glib::RefPtr action_group_new_layers; - Glib::RefPtr action_group_layer_ops; - - Gtk::HScale *layer_amount_hscale; - - LayerActionManager* layer_action_manager; - -protected: - virtual void init_canvas_view_vfunc(etl::loose_handle canvas_view); - virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); - -private: - - void add_layer(synfig::String id); - void increase_amount(); - void decrease_amount(); - -public: - - - Dock_Layers(); - ~Dock_Layers(); -}; // END of Dock_Layers - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dock_metadata.cpp b/synfig-studio/src/gui/dock_metadata.cpp deleted file mode 100644 index 3dce59a..0000000 --- a/synfig-studio/src/gui/dock_metadata.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_metadata.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_metadata.h" -#include "app.h" - -#include -#include -#include "instance.h" -#include -#include -#include -#include "metadatatreestore.h" -#include "canvasview.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_MetaData::Dock_MetaData(): - Dock_CanvasSpecific("meta_data",_("Canvas MetaData"),Gtk::StockID("synfig-meta_data")), - tree_view(manage(new Gtk::TreeView())) -{ - MetaDataTreeStore::Model model; - - tree_view->append_column(_("Key"),model.key); - tree_view->append_column_editable(_("Data"),model.data); - tree_view->set_rules_hint(); - - Gtk::ScrolledWindow *scrolledwindow = manage(new class Gtk::ScrolledWindow()); - scrolledwindow->set_flags(Gtk::CAN_FOCUS); - scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - scrolledwindow->add(*tree_view); - scrolledwindow->set_shadow_type(Gtk::SHADOW_ETCHED_IN); - scrolledwindow->show(); - - add(*scrolledwindow); - - add_button( - Gtk::StockID("gtk-add"), - _("Add new MetaData entry") - )->signal_clicked().connect( - sigc::mem_fun( - *this, - &Dock_MetaData::on_add_pressed - ) - ); - - add_button( - Gtk::StockID("gtk-delete"), - _("Remove selected MetaData entry") - )->signal_clicked().connect( - sigc::mem_fun( - *this, - &Dock_MetaData::on_delete_pressed - ) - ); -} - -Dock_MetaData::~Dock_MetaData() -{ -} - -void -Dock_MetaData::init_canvas_view_vfunc(etl::loose_handle canvas_view) -{ - canvas_view->set_tree_model(get_name(),MetaDataTreeStore::create(canvas_view->canvas_interface())); -} - -void -Dock_MetaData::changed_canvas_view_vfunc(etl::loose_handle canvas_view) -{ - if(canvas_view) - { - tree_view->set_model(canvas_view->get_tree_model(get_name())); - tree_view->show(); - } - else - { - tree_view->set_model(Glib::RefPtr()); - tree_view->hide(); - } -} - -void -Dock_MetaData::on_add_pressed() -{ - if(get_canvas_interface()) - { - synfig::String key; - if(App::dialog_entry(_("New MetaData Entry"), _("Please enter the name of the key"),key) && !key.empty()) - { - get_canvas_interface()->set_meta_data(key," "); - } - } -} - -void -Dock_MetaData::on_delete_pressed() -{ -} diff --git a/synfig-studio/src/gui/dock_metadata.h b/synfig-studio/src/gui/dock_metadata.h deleted file mode 100644 index 285b845..0000000 --- a/synfig-studio/src/gui/dock_metadata.h +++ /dev/null @@ -1,71 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_metadata.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_METADATA_H -#define __SYNFIG_STUDIO_DOCK_METADATA_H - -/* === H E A D E R S ======================================================= */ - -#include "dockable.h" -#include -#include "instance.h" -#include "dock_canvasspecific.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 CanvasView; -class Instance; - -class Dock_MetaData : public Dock_CanvasSpecific -{ - - Gtk::TreeView *tree_view; - - - void on_add_pressed(); - void on_delete_pressed(); - -protected: - - virtual void init_canvas_view_vfunc(etl::loose_handle canvas_view); - virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); - -public: - - - Dock_MetaData(); - ~Dock_MetaData(); -}; // END of Dock_MetaData - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dock_navigator.cpp b/synfig-studio/src/gui/dock_navigator.cpp deleted file mode 100644 index ad5061e..0000000 --- a/synfig-studio/src/gui/dock_navigator.cpp +++ /dev/null @@ -1,522 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_navigator.cpp -** \brief Dock Nagivator 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_navigator.h" -#include "canvasview.h" -#include "workarea.h" - -#include -#include -#include -#include -#include - -#include - -#include "asyncrenderer.h" - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; - -/* === M A C R O S ========================================================= */ - -const double log_10_2 = log(2.0); - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -/* === E N T R Y P O I N T ================================================= */ -studio::Widget_NavView::Widget_NavView(CanvasView::LooseHandle cv) -:canvview(cv), -adj_zoom(0,-4,4,1,2), -scrolling(false), -surface(new synfig::Surface) -{ - attach(drawto,0,4,0,1); - - attach(*manage(new Gtk::HSeparator),0,4,1,2,Gtk::SHRINK|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); - - //zooming stuff - attach(zoom_print,0,1,2,3,Gtk::SHRINK|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); - zoom_print.set_size_request(40,-1); - - Gtk::HScale *s = manage(new Gtk::HScale(adj_zoom)); - s->set_draw_value(false); - //s->set_update_policy(Gtk::UPDATE_DELAYED); - //s->signal_event().connect(sigc::mem_fun(*this,&Dock_Navigator::on_scroll_event)); - attach(*s,1,4,2,3,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); - - show_all(); - - adj_zoom.signal_value_changed().connect(sigc::mem_fun(*this,&Widget_NavView::on_number_modify)); - - if(cv) - { - drawto.signal_expose_event().connect(sigc::mem_fun(*this,&Widget_NavView::on_expose_draw)); - drawto.signal_event().connect(sigc::mem_fun(*this,&Widget_NavView::on_mouse_event)); - - drawto.add_events(Gdk::BUTTON_MOTION_MASK|Gdk::BUTTON_PRESS_MASK); - - //get_canvas_view()->canvas_interface()->signal_dirty_preview() - // .connect(sigc::mem_fun(*this,&Widget_NavView::on_dirty_preview)); - get_canvas_view()->work_area->signal_rendering() - .connect(sigc::mem_fun(*this,&Widget_NavView::on_dirty_preview)); - - get_canvas_view()->work_area->signal_view_window_changed() - .connect(sigc::mem_fun(*this,&Widget_NavView::on_workarea_view_change)); - - //update with this canvas' view - on_workarea_view_change(); - - dirty = true; - queue_draw(); - } - - adj_zoom.set_value(0); -} - -studio::Widget_NavView::~Widget_NavView() -{ -} - - -static void freegu8(const guint8 *p) -{ - delete [] p; -} - -void studio::Widget_NavView::on_start_render() -{ - if(dirty) - { - //synfig::warning("Nav: Starting render"); - //synfig::warning("Nav: Rendering canvas"); - etl::handle targ = surface_target(surface.get()); - - targ->set_canvas(get_canvas_view()->get_canvas()); - targ->set_remove_alpha(); - targ->set_avoid_time_sync(); - targ->set_quality(get_canvas_view()->get_work_area()->get_quality()); - //synfig::info("Set the quality level to: %d", get_canvas_view()->get_work_area()->get_quality()); - - //this should set it to render a single frame - RendDesc r = get_canvas_view()->get_canvas()->rend_desc(); - r.set_time(get_canvas_view()->canvas_interface()->get_time()); - - //this changes the size of the canvas to the closest thing we can find - int sw = r.get_w(), sh = r.get_h(); - - //synfig::warning("Nav: source image is %d x %d", sw,sh); - - //resize so largest dimension is 128 - int dw = sw > sh ? 128 : sw*128/sh, - dh = sh > sw ? 128 : sh*128/sw; - - //synfig::warning("Nav: dest image is %d x %d", dw,dh); - - r.set_w(dw); - r.set_h(dh); - - //get the pw and ph - //float pw = r.get_pw(); - //float ph = r.get_ph(); - //synfig::warning("Nav: pixel size is %f x %f", pw,ph); - - //this renders that single frame - targ->set_rend_desc(&r); - - //synfig::warning("Nav: Building async renderer and starting it..."); - - renderer = new AsyncRenderer(targ); - renderer->signal_success().connect(sigc::mem_fun(*this,&Widget_NavView::on_finish_render)); - dirty = false; - renderer->start(); - } -} - -void studio::Widget_NavView::on_finish_render() -{ - //convert it into our pixmap - PixelFormat pf(PF_RGB); - - //synfig::warning("Nav: It hath succeeded!!!"); - - //assert(renderer && renderer->has_success()); - //synfig::warning("Nav: now we know it really succeeded"); - if(!*surface) - { - synfig::warning("dock_navigator: Bad surface"); - return; - } - - int w = 0, h = 0; - int dw = surface->get_w(); - int dh = surface->get_h(); - - if(prev) - { - w = prev->get_width(); - h = prev->get_height(); - } - - if(w != dw || h != dh || !prev) - { - const int total_bytes(dw*dh*synfig::channels(pf)); - - //synfig::warning("Nav: Updating the pixbuf to be the right size, etc. (%d bytes)", total_bytes); - - prev.clear(); - guint8 *bytes = new guint8[total_bytes]; //24 bits per pixel - - //convert into our buffered dataS - //synfig::warning("Nav: converting color format into buffer"); - convert_color_format((unsigned char *)bytes, (*surface)[0], dw*dh, pf, App::gamma); - - prev = - Gdk::Pixbuf::create_from_data( - bytes, // pointer to the data - Gdk::COLORSPACE_RGB, // the colorspace - ((pf&PF_A)==PF_A), // has alpha? - 8, // bits per sample - dw, // width - dh, // height - dw*synfig::channels(pf), // stride (pitch) - sigc::ptr_fun(freegu8) - ); - } - else - { - //synfig::warning("Nav: Don't need to resize"); - //convert into our buffered dataS - //synfig::warning("Nav: converting color format into buffer"); - if(prev) //just in case we're stupid - { - convert_color_format((unsigned char *)prev->get_pixels(), (*surface)[0], dw*dh, pf, App::gamma); - } - } - queue_draw(); -} - -/* zoom slider is on exponential scale - - map: -4,4 -> small number,1600 with 100 at 0 - - f(x) = 100*2^x -*/ - -static double unit_to_zoom(double f) -{ - return pow(2.0,f); -} - -static double zoom_to_unit(double f) -{ - if(f > 0) - { - return log(f) / log_10_2; - }else return -999999.0; -} - -bool studio::Widget_NavView::on_expose_draw(GdkEventExpose */*exp*/) -{ -#ifdef SINGLE_THREADED - // don't redraw if the previous redraw is still running single-threaded - // or we end up destroying the renderer that's rendering it - if (App::single_threaded && renderer && renderer->updating) - return false; -#endif - - //print out the zoom - //HACK kind of... - //zoom_print.set_text(strprintf("%.1f%%",100*unit_to_zoom(adj_zoom.get_value()))); - - //draw the good stuff - on_start_render(); - - //if we've got a preview etc. display it... - if(get_canvas_view() && prev) - { - //axis transform from units to pixel coords - float xaxis = 0, yaxis = 0; - - int canvw = get_canvas_view()->get_canvas()->rend_desc().get_w(); - //int canvh = get_canvas_view()->get_canvas()->rend_desc().get_h(); - - float pw = get_canvas_view()->get_canvas()->rend_desc().get_pw(); - float ph = get_canvas_view()->get_canvas()->rend_desc().get_ph(); - - int w = prev->get_width(); - int h = prev->get_height(); - - //scale up/down to the nearest pixel ratio... - //and center in center - int offx=0, offy=0; - - float sx, sy; - int nw,nh; - - sx = drawto.get_width() / (float)w; - sy = drawto.get_height() / (float)h; - - //synfig::warning("Nav redraw: now to scale the bitmap: %.3f x %.3f",sx,sy); - - //round to smallest scale (fit entire thing in window without distortion) - if(sx > sy) sx = sy; - //else sy = sx; - - //scaling and stuff - // the point to navpixel space conversion should be: - // (navpixels / canvpixels) * (canvpixels / canvsize) - // or (navpixels / prevpixels) * (prevpixels / navpixels) - xaxis = sx * w / (float)canvw; - yaxis = xaxis/ph; - xaxis /= pw; - - //scale to a new pixmap and then copy over to the window - nw = (int)(w*sx); - nh = (int)(h*sx); - - //must now center to be cool - offx = (drawto.get_width() - nw)/2; - offy = (drawto.get_height() - nh)/2; - - //trivial escape - if(nw == 0 || nh == 0)return true; - - //draw to drawing area - Glib::RefPtr gc = Gdk::GC::create(drawto.get_window()); - - //synfig::warning("Nav: Scaling pixmap to off (%d,%d) with size (%d,%d)", offx,offy,nw, nh); - Glib::RefPtr scalepx = prev->scale_simple(nw,nh,Gdk::INTERP_NEAREST); - - //synfig::warning("Nav: Drawing scaled bitmap"); - drawto.get_window()->draw_pixbuf( - gc, //GC - scalepx, //pixbuf - 0, 0, // Source X and Y - offx, offy, // Dest X and Y - -1,-1, // Width and Height - Gdk::RGB_DITHER_MAX, // RgbDither - 2, 2 // Dither offset X and Y - ); - - //draw fancy red rectangle around focus point - const Point &wtl = get_canvas_view()->work_area->get_window_tl(), - &wbr = get_canvas_view()->work_area->get_window_br(); - - gc->set_rgb_fg_color(Gdk::Color("#ff0000")); - gc->set_line_attributes(2,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER); - - //it must be clamped to the drawing area though - int l=0,rw=0,t=0,rh=0; - const Point fp = -get_canvas_view()->work_area->get_focus_point(); - - //get focus point in normal space - rw = (int)(abs((wtl[0]-wbr[0])*xaxis)); - rh = (int)(abs((wtl[1]-wbr[1])*yaxis)); - - //transform into pixel space - l = (int)(drawto.get_width()/2 + fp[0]*xaxis - rw/2); - t = (int)(drawto.get_height()/2 + fp[1]*yaxis - rh/2); - - //coord system: - // tl : (offx,offy) - // axis multipliers = xaxis,yaxis - //synfig::warning("Nav: tl (%f,%f), br (%f,%f)", wtl[0],wtl[1],wbr[0],wbr[1]); - //synfig::warning("Nav: tl (%f,%f), br (%f,%f)", wtl[0],wtl[1],wbr[0],wbr[1]); - //synfig::warning("Nav: Drawing Rectangle (%d,%d) with dim (%d,%d)", l,t,rw,rh); - drawto.get_window()->draw_rectangle(gc,false,l,t,rw,rh); - } - - return false; //draw everything else too -} - -void studio::Widget_NavView::on_dirty_preview() -{ - dirty = true; - queue_draw(); -} - -bool studio::Widget_NavView::on_scroll_event(GdkEvent *event) -{ - if(get_canvas_view() && get_canvas_view()->get_work_area()) - { - double z = unit_to_zoom(adj_zoom.get_value()); - - switch(event->type) - { - case GDK_BUTTON_PRESS: - { - if(event->button.button == 1) - { - scrolling = true; - get_canvas_view()->get_work_area()->set_zoom(z); - scrolling = false; - } - break; - } - - case GDK_MOTION_NOTIFY: - { - if(Gdk::ModifierType(event->motion.state) & Gdk::BUTTON1_MASK) - { - scrolling = true; - get_canvas_view()->get_work_area()->set_zoom(z); - scrolling = false; - } - break; - } - - default: - break; - } - } - - return false; -} - -void studio::Widget_NavView::on_number_modify() -{ - double z = unit_to_zoom(adj_zoom.get_value()); - zoom_print.set_text(strprintf("%.1f%%",z*100.0)); - //synfig::warning("Updating zoom to %f",adj_zoom.get_value()); - - if(get_canvas_view() && z != get_canvas_view()->get_work_area()->get_zoom()) - { - scrolling = true; - get_canvas_view()->get_work_area()->set_zoom(z); - scrolling = false; - } -} - -void studio::Widget_NavView::on_workarea_view_change() -{ - double wz = get_canvas_view()->get_work_area()->get_zoom(); - double z = zoom_to_unit(wz); - - //synfig::warning("Updating zoom to %f -> %f",wz,z); - if(!scrolling && z != adj_zoom.get_value()) - { - adj_zoom.set_value(z); - //adj_zoom.value_changed(); - } - queue_draw(); -} - -bool studio::Widget_NavView::on_mouse_event(GdkEvent * e) -{ - Point p; - bool setpos = false; - - if(e->type == GDK_BUTTON_PRESS && e->button.button == 1) - { - p[0] = e->button.x - drawto.get_width()/2; - p[1] = e->button.y - drawto.get_height()/2; - - setpos = true; - } - - if(e->type == GDK_MOTION_NOTIFY && (Gdk::ModifierType(e->motion.state) & Gdk::BUTTON1_MASK)) - { - p[0] = e->motion.x - drawto.get_width()/2; - p[1] = e->motion.y - drawto.get_height()/2; - - setpos = true; - } - - if(setpos && prev && get_canvas_view()) - { - const Point &tl = get_canvas_view()->get_canvas()->rend_desc().get_tl(); - const Point &br = get_canvas_view()->get_canvas()->rend_desc().get_br(); - - float max = abs((br[0]-tl[0]) / drawto.get_width()); - - if((float(prev->get_width()) / drawto.get_width()) < (float(prev->get_height()) / drawto.get_height())) - max = abs((br[1]-tl[1]) / drawto.get_height()); - - float signx = (br[0]-tl[0]) < 0 ? -1 : 1; - float signy = (br[1]-tl[1]) < 0 ? -1 : 1; - - Point pos; - - pos[0] = p[0] * max * signx; - pos[1] = p[1] * max * signy; - - get_canvas_view()->get_work_area()->set_focus_point(-pos); - - return true; - } - - return false; -} - -//Navigator Dock Definitions - -studio::Dock_Navigator::Dock_Navigator() -:Dock_CanvasSpecific("navigator",_("Navigator"),Gtk::StockID("synfig-navigator")) -{ - add(dummy); -} - -studio::Dock_Navigator::~Dock_Navigator() -{ -} - -void studio::Dock_Navigator::changed_canvas_view_vfunc(etl::loose_handle canvas_view) -{ - if(canvas_view) - { - Widget *v = canvas_view->get_ext_widget("navview"); - - if(!v) - { - v = new Widget_NavView(canvas_view); - canvas_view->set_ext_widget("navview",v); - } - - add(*v); - }else - { - clear_previous(); - //add(dummy); - } -} diff --git a/synfig-studio/src/gui/dock_navigator.h b/synfig-studio/src/gui/dock_navigator.h deleted file mode 100644 index f27d861..0000000 --- a/synfig-studio/src/gui/dock_navigator.h +++ /dev/null @@ -1,121 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_navigator.h -** \brief Navigator Dock 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_DOCK_NAVIGATOR_H -#define __SYNFIG_DOCK_NAVIGATOR_H - -/* === H E A D E R S ======================================================= */ -#include "sigc++/signal.h" - -#include -#include -#include -#include - -#include - -#include "canvasview.h" -#include "dock_canvasspecific.h" -#include "widgets/widget_distance.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 studio { -class AsyncRenderer; - -class Widget_NavView : public Gtk::Table -{ - //handle to out parent canvas - CanvasView::LooseHandle canvview; - - Glib::RefPtr prev; - bool dirty; - - //The drawing stuff - Gtk::DrawingArea drawto; - - //The input stuff - Gtk::Adjustment adj_zoom; - Gtk::Label zoom_print; - - //zoom window stuff - bool scrolling; - - //asynchronous rendering stuff - etl::handle renderer; - etl::smart_ptr surface; - bool rendering; - - //drawing functionality - void on_start_render(); //breaks out into asynchronous rendering - void on_finish_render(); - void on_draw(); //renders the small thing we have - void on_dirty_preview(); //dirties the preview for rerender - - //for the zoom buttons - void on_zoom_in(); - void on_zoom_out(); - - //handles the zoom scroller - bool on_scroll_event(GdkEvent *event); - void on_number_modify(); - - // - bool on_mouse_event(GdkEvent * e); - - //draws the gotten bitmap on the draw area - bool on_expose_draw(GdkEventExpose *exp=0); - - //for when the canvasview view changes (boolean value scrolling solves cyclic problems) - void on_workarea_view_change(); - -public: - Widget_NavView(CanvasView::LooseHandle cv = CanvasView::LooseHandle()); - ~Widget_NavView(); - - etl::loose_handle get_canvas_view() {return canvview;} -}; - -class Dock_Navigator : public Dock_CanvasSpecific -{ - Widget_NavView dummy; - -public: - Dock_Navigator(); - ~Dock_Navigator(); - - virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); -}; - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dock_params.cpp b/synfig-studio/src/gui/dock_params.cpp deleted file mode 100644 index 7b3d360..0000000 --- a/synfig-studio/src/gui/dock_params.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_params.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_params.h" -#include "app.h" - -#include -#include -#include "instance.h" -#include -#include -#include -#include "canvasview.h" -#include "layerparamtreestore.h" -#include "workarea.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_Params::Dock_Params(): - Dock_CanvasSpecific("params",_("Params"),Gtk::Stock::INDEX/*Gtk::StockID("synfig-params")*/), - action_group(Gtk::ActionGroup::create("action_group_dock_params")) -{ -} - -Dock_Params::~Dock_Params() -{ -} - - -void -Dock_Params::init_canvas_view_vfunc(etl::loose_handle canvas_view) -{ - Gtk::TreeView* tree_view( - static_cast(canvas_view->get_ext_widget(get_name())) - ); - - if(tree_view) - { - tree_view->get_selection()->signal_changed().connect( - sigc::mem_fun( - *this, - &Dock_Params::refresh_selected_param - ) - ); - } -} - -void -Dock_Params::refresh_selected_param() -{ - Gtk::TreeView* tree_view( - static_cast(get_canvas_view()->get_ext_widget(get_name())) - ); - Gtk::TreeModel::iterator iter(tree_view->get_selection()->get_selected()); - - if(iter) - { - LayerParamTreeStore::Model model; - get_canvas_view()->work_area->set_selected_value_node( - (synfig::ValueNode::Handle)(*iter)[model.value_node] - ); - } - else - { - get_canvas_view()->work_area->set_selected_value_node(0); - } -} - -void -Dock_Params::changed_canvas_view_vfunc(etl::loose_handle canvas_view) -{ - if(canvas_view) - { - Gtk::Widget* tree_view(canvas_view->get_ext_widget(get_name())); - - add(*tree_view); - tree_view->show(); - show_all(); - } - else clear_previous(); -} diff --git a/synfig-studio/src/gui/dock_params.h b/synfig-studio/src/gui/dock_params.h deleted file mode 100644 index 7ad9f61..0000000 --- a/synfig-studio/src/gui/dock_params.h +++ /dev/null @@ -1,64 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_params.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_PARAMS_H -#define __SYNFIG_STUDIO_DOCK_PARAMS_H - -/* === H E A D E R S ======================================================= */ - -#include "dockable.h" -#include -#include "instance.h" -#include "dock_canvasspecific.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_Params : public Dock_CanvasSpecific -{ - Glib::RefPtr action_group; - -protected: - virtual void init_canvas_view_vfunc(etl::loose_handle canvas_view); - virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); - - void refresh_selected_param(); - -public: - - - Dock_Params(); - ~Dock_Params(); -}; // END of Dock_Keyframes - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dock_timetrack.cpp b/synfig-studio/src/gui/dock_timetrack.cpp deleted file mode 100644 index 2f88b82..0000000 --- a/synfig-studio/src/gui/dock_timetrack.cpp +++ /dev/null @@ -1,494 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_timetrack.cpp -** \brief Template File -** -** $Id$ -** -** \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 -** 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_timetrack.h" -#include "app.h" - -#include -#include -#include "instance.h" -#include -#include -#include -#include "canvasview.h" -#include "layerparamtreestore.h" -#include "workarea.h" -#include "widgets/widget_timeslider.h" -#include "widgets/widget_keyframe_list.h" -#include "layerparamtreestore.h" -#include "general.h" -#include - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -using namespace studio; - -/* === M A C R O S ========================================================= */ - -/* === C L A S S E S ======================================================= */ - -class TimeTrackView : public Gtk::TreeView -{ - CellRenderer_TimeTrack *cellrenderer_time_track; - - Glib::RefPtr param_tree_store_; - - Gtk::TreeView *mimic_tree_view; -public: - - sigc::signal >,int> signal_waypoint_clicked_timetrackview; - - LayerParamTreeStore::Model model; - - void set_canvas_view(handle canvas_view) - { - cellrenderer_time_track->set_adjustment(canvas_view->time_adjustment()); - } - - TimeTrackView() - { - int label_index(append_column_editable(_("Name"),model.label)); - Gtk::TreeView::Column* label_column = get_column(label_index-1); - - { // --- T I M E T R A C K -------------------------------------------- - Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Time Track")) ); - - // Set up the value-node cell-renderer - cellrenderer_time_track=LayerParamTreeStore::add_cell_renderer_value_node(column); - cellrenderer_time_track->property_mode()=Gtk::CELL_RENDERER_MODE_ACTIVATABLE; - cellrenderer_time_track->signal_waypoint_clicked_cellrenderer().connect(sigc::mem_fun(*this, &TimeTrackView::on_waypoint_clicked_timetrackview)); - cellrenderer_time_track->signal_waypoint_changed().connect(sigc::mem_fun(*this, &TimeTrackView::on_waypoint_changed) ); - column->add_attribute(cellrenderer_time_track->property_value_desc(), model.value_desc); - column->add_attribute(cellrenderer_time_track->property_canvas(), model.canvas); - //column->add_attribute(cellrenderer_time_track->property_visible(), model.is_value_node); - - //column->pack_start(*cellrenderer_time_track); - - // Finish setting up the column - column->set_reorderable(); - column->set_resizable(); - column->set_min_width(200); - - append_column(*column); - } - set_rules_hint(); - - set_expander_column(*label_column); - label_column->set_visible(false); - set_headers_visible(false); - set_size_request(-1,64); - } - - bool - on_event(GdkEvent *event) - { - switch(event->type) - { - case GDK_SCROLL: - if(mimic_tree_view) - { - if(event->scroll.direction==GDK_SCROLL_DOWN) - { - mimic_tree_view->get_vadjustment()->set_value( - std::min( - mimic_tree_view->get_vadjustment()->get_value()+ - mimic_tree_view->get_vadjustment()->get_step_increment(), - mimic_tree_view->get_vadjustment()->get_upper()- - mimic_tree_view->get_vadjustment()->get_page_size() - ) - ); - mimic_tree_view->get_vadjustment()->value_changed(); - } - else if(event->scroll.direction==GDK_SCROLL_UP) - { - mimic_tree_view->get_vadjustment()->set_value( - std::max( - mimic_tree_view->get_vadjustment()->get_value()- - mimic_tree_view->get_vadjustment()->get_step_increment(), - mimic_tree_view->get_vadjustment()->get_lower() - ) - ); - mimic_tree_view->get_vadjustment()->value_changed(); - } - } - break; - case GDK_BUTTON_PRESS: - { - Gtk::TreeModel::Path path; - Gtk::TreeViewColumn *column; - int cell_x, cell_y; - if(!get_path_at_pos( - int(event->button.x),int(event->button.y), // x, y - path, // TreeModel::Path& - column, //TreeViewColumn*& - cell_x,cell_y //int&cell_x,int&cell_y - ) - ) break; - const Gtk::TreeRow row = *(get_model()->get_iter(path)); - - if(column && column->get_first_cell_renderer()==cellrenderer_time_track) - { - Gdk::Rectangle rect; - get_cell_area(path,*column,rect); - cellrenderer_time_track->property_value_desc()=row[model.value_desc]; - cellrenderer_time_track->property_canvas()=row[model.canvas]; - cellrenderer_time_track->activate(event,*this,path.to_string(),rect,rect,Gtk::CellRendererState()); - queue_draw_area(rect.get_x(),rect.get_y(),rect.get_width(),rect.get_height()); - return true; - //return signal_param_user_click()(event->button.button,row,COLUMNID_TIME_TRACK); - } - } - break; - - case GDK_MOTION_NOTIFY: - { - Gtk::TreeModel::Path path; - Gtk::TreeViewColumn *column; - int cell_x, cell_y; - if(!get_path_at_pos( - (int)event->motion.x,(int)event->motion.y, // x, y - path, // TreeModel::Path& - column, //TreeViewColumn*& - cell_x,cell_y //int&cell_x,int&cell_y - ) - ) break; - - if(!get_model()->get_iter(path)) - break; - - Gtk::TreeRow row = *(get_model()->get_iter(path)); - - if ((event->motion.state&GDK_BUTTON1_MASK || event->motion.state&GDK_BUTTON3_MASK) && - column && - cellrenderer_time_track == column->get_first_cell_renderer()) - { - Gdk::Rectangle rect; - get_cell_area(path,*column,rect); - cellrenderer_time_track->property_value_desc()=row[model.value_desc]; - cellrenderer_time_track->property_canvas()=row[model.canvas]; - cellrenderer_time_track->activate(event,*this,path.to_string(),rect,rect,Gtk::CellRendererState()); - queue_draw(); - //queue_draw_area(rect.get_x(),rect.get_y(),rect.get_width(),rect.get_height()); - return true; - } -/* else - if(last_tooltip_path.get_depth()<=0 || path!=last_tooltip_path) - { - tooltips_.unset_tip(*this); - Glib::ustring tooltips_string(row[layer_model.tooltip]); - last_tooltip_path=path; - if(!tooltips_string.empty()) - { - tooltips_.set_tip(*this,tooltips_string); - tooltips_.force_window(); - } - } -*/ - return true; - } - break; - case GDK_BUTTON_RELEASE: - { - Gtk::TreeModel::Path path; - Gtk::TreeViewColumn *column; - int cell_x, cell_y; - if(!get_path_at_pos( - (int)event->button.x,(int)event->button.y, // x, y - path, // TreeModel::Path& - column, //TreeViewColumn*& - cell_x,cell_y //int&cell_x,int&cell_y - ) - ) break; - - if(!get_model()->get_iter(path)) - break; - - Gtk::TreeRow row = *(get_model()->get_iter(path)); - - if(column && cellrenderer_time_track==column->get_first_cell_renderer()) - { - Gdk::Rectangle rect; - get_cell_area(path,*column,rect); - cellrenderer_time_track->property_value_desc()=row[model.value_desc]; - cellrenderer_time_track->property_canvas()=row[model.canvas]; - cellrenderer_time_track->activate(event,*this,path.to_string(),rect,rect,Gtk::CellRendererState()); - queue_draw(); - queue_draw_area(rect.get_x(),rect.get_y(),rect.get_width(),rect.get_height()); - return true; - } - } - break; - default: - break; - } - mimic_resync(); - return Gtk::TreeView::on_event(event); - } - - void - queue_draw_msg() - { - synfig::info("*************QUEUE_DRAW***************** (time track view)"); - Widget::queue_draw(); - } - void set_model(Glib::RefPtr store) - { - Gtk::TreeView::set_model(store); - param_tree_store_=store; - cellrenderer_time_track->set_canvas_interface(param_tree_store_->canvas_interface()); - store->signal_changed().connect(sigc::mem_fun(*this, &TimeTrackView::queue_draw)); - } - - void - on_waypoint_changed( synfig::Waypoint waypoint , synfig::ValueNode::Handle value_node) - { - // \todo is this code used? - assert(0); - - synfigapp::Action::ParamList param_list; - param_list.add("canvas",param_tree_store_->canvas_interface()->get_canvas()); - param_list.add("canvas_interface",param_tree_store_->canvas_interface()); - param_list.add("value_node",value_node); - param_list.add("waypoint",waypoint); - // param_list.add("time",canvas_interface()->get_time()); - - etl::handle::cast_static(param_tree_store_->canvas_interface()->get_instance())->process_action("WaypointSetSmart", param_list); - } - - void mimic(Gtk::TreeView *param_tree_view) - { - mimic_tree_view=param_tree_view; - param_tree_view->signal_row_expanded().connect( - sigc::hide<0>( - sigc::hide_return( - sigc::bind<-1>( - sigc::mem_fun( - *this, - &Gtk::TreeView::expand_row - ), - false - ) - )) - ); - param_tree_view->signal_row_collapsed().connect( - sigc::hide<0>( - sigc::hide_return( - sigc::mem_fun( - *this, - &Gtk::TreeView::collapse_row - ) - )) - ); - mimic_resync(); - } - - void mimic_resync() - { - if(mimic_tree_view) - { - Gtk::Adjustment &adjustment(*mimic_tree_view->get_vadjustment()); - set_vadjustment(adjustment); - - if(adjustment.get_page_size()>get_height()) - adjustment.set_page_size(get_height()); - - int row_height = 0; - if(getenv("SYNFIG_TIMETRACK_ROW_HEIGHT")) - row_height = atoi(getenv("SYNFIG_TIMETRACK_ROW_HEIGHT")); - if (row_height < 3) - row_height = 18; - - cellrenderer_time_track->set_fixed_size(-1,row_height); - } - } - - void - on_waypoint_clicked_timetrackview(const etl::handle& node, - const synfig::Time& time, - const synfig::Time& time_offset __attribute__ ((unused)), - int button) - { - std::set > waypoint_set; - synfig::waypoint_collect(waypoint_set,time,node); - - synfigapp::ValueDesc value_desc; - - if (waypoint_set.size() == 1) - { - ValueNode::Handle value_node(waypoint_set.begin()->get_parent_value_node()); - assert(value_node); - - Gtk::TreeRow row; - if (param_tree_store_->find_first_value_node(value_node, row) && row) - value_desc = static_cast(row[model.value_desc]); - } - - if (!waypoint_set.empty()) - signal_waypoint_clicked_timetrackview(value_desc,waypoint_set,button); - } -}; - -/* === 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_Timetrack::Dock_Timetrack(): - Dock_CanvasSpecific("timetrack",_("Timetrack"),Gtk::StockID("synfig-timetrack")) -{ - table_=0; - widget_timeslider_= new Widget_Timeslider(); - widget_kf_list_= new Widget_Keyframe_List(); - - int header_height = 0; - if(getenv("SYNFIG_TIMETRACK_HEADER_HEIGHT")) - header_height = atoi(getenv("SYNFIG_TIMETRACK_HEADER_HEIGHT")); - if (header_height < 3) - header_height = 24; - - widget_timeslider_->set_size_request(-1,header_height-header_height/3+1); - widget_kf_list_->set_size_request(-1,header_height/3+1); - - hscrollbar_=new Gtk::HScrollbar(); - vscrollbar_=new Gtk::VScrollbar(); -} - -Dock_Timetrack::~Dock_Timetrack() -{ - if(table_)delete table_; - delete hscrollbar_; - delete vscrollbar_; - delete widget_timeslider_; - delete widget_kf_list_; -} - -void -Dock_Timetrack::init_canvas_view_vfunc(etl::loose_handle canvas_view) -{ - LayerParamTreeStore::Model model; - - Glib::RefPtr tree_store( - Glib::RefPtr::cast_dynamic( - canvas_view->get_tree_model("params") - ) - ); - - TimeTrackView* tree_view(new TimeTrackView()); - tree_view->set_canvas_view(canvas_view); - tree_view->set_model(tree_store); - Gtk::TreeView* param_tree_view(dynamic_cast(canvas_view->get_ext_widget("params"))); - tree_view->mimic(param_tree_view); - - tree_view->signal_waypoint_clicked_timetrackview.connect(sigc::mem_fun(*canvas_view, &studio::CanvasView::on_waypoint_clicked_canvasview)); - - canvas_view->time_adjustment().signal_value_changed().connect(sigc::mem_fun(*tree_view,&Gtk::TreeView::queue_draw)); - canvas_view->time_adjustment().signal_changed().connect(sigc::mem_fun(*tree_view,&Gtk::TreeView::queue_draw)); - - canvas_view->set_ext_widget(get_name(),tree_view); -} - -void -Dock_Timetrack::refresh_selected_param() -{ -/* Gtk::TreeView* tree_view( - static_cast(get_canvas_view()->get_ext_widget(get_name())) - ); - Gtk::TreeModel::iterator iter(tree_view->get_selection()->get_selected()); - - if(iter) - { - LayerParamTreeStore::Model model; - get_canvas_view()->work_area->set_selected_value_node( - (synfig::ValueNode::Handle)(*iter)[model.value_node] - ); - } - else - { - get_canvas_view()->work_area->set_selected_value_node(0); - } -*/ -} - -void -Dock_Timetrack::changed_canvas_view_vfunc(etl::loose_handle canvas_view) -{ - if(table_) - { - table_->hide(); - delete table_; - hscrollbar_->unset_adjustment(); - vscrollbar_->unset_adjustment(); - //widget_timeslider_->unset_adjustment(); - table_=0; - } - - if(canvas_view) - { - TimeTrackView* tree_view(dynamic_cast(canvas_view->get_ext_widget(get_name()))); - Gtk::TreeView* param_tree_view(dynamic_cast(canvas_view->get_ext_widget("params"))); - tree_view->set_vadjustment(*param_tree_view->get_vadjustment()); - - assert(tree_view); - - - widget_timeslider_->set_time_adjustment(&canvas_view->time_adjustment()); - widget_timeslider_->set_bounds_adjustment(&canvas_view->time_window_adjustment()); - widget_timeslider_->set_global_fps(canvas_view->get_canvas()->rend_desc().get_frame_rate()); - - widget_kf_list_->set_time_adjustment(&canvas_view->time_adjustment()); - widget_kf_list_->set_canvas_interface(canvas_view->canvas_interface()); - - vscrollbar_->set_adjustment(*tree_view->get_vadjustment()); - hscrollbar_->set_adjustment(canvas_view->time_window_adjustment()); - table_=new Gtk::Table(2,3); - table_->attach(*widget_timeslider_, 0, 1, 1, 2, Gtk::FILL|Gtk::SHRINK, Gtk::FILL|Gtk::SHRINK); - table_->attach(*widget_kf_list_, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK); - table_->attach(*tree_view, 0, 1, 2, 3, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); - table_->attach(*hscrollbar_, 0, 1, 3, 4, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK); - table_->attach(*vscrollbar_, 1, 2, 0, 3, Gtk::FILL|Gtk::SHRINK, Gtk::FILL|Gtk::EXPAND); - add(*table_); - - //add(*last_widget_curves_); - table_->show_all(); - show_all(); - } - else - { - //clear_previous(); - } -} diff --git a/synfig-studio/src/gui/dock_timetrack.h b/synfig-studio/src/gui/dock_timetrack.h deleted file mode 100644 index 9da19fd..0000000 --- a/synfig-studio/src/gui/dock_timetrack.h +++ /dev/null @@ -1,71 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dock_timetrack.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2009 Carlos López -** -** 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_TIMETRACK_H -#define __SYNFIG_STUDIO_DOCK_TIMETRACK_H - -/* === H E A D E R S ======================================================= */ - -#include "dockable.h" -#include -#include "instance.h" -#include "dock_canvasspecific.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 Widget_Timeslider; -class Widget_Keyframe_List; - -class Dock_Timetrack : public Dock_CanvasSpecific -{ - Gtk::HScrollbar* hscrollbar_; - Gtk::VScrollbar* vscrollbar_; - Widget_Timeslider* widget_timeslider_; - Widget_Keyframe_List* widget_kf_list_; - Gtk::Table* table_; - -protected: - virtual void init_canvas_view_vfunc(etl::loose_handle canvas_view); - virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); - - void refresh_selected_param(); - -public: - - - Dock_Timetrack(); - ~Dock_Timetrack(); -}; // END of Dock_Timetrack - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dockable.cpp b/synfig-studio/src/gui/dockable.cpp deleted file mode 100644 index f0a3dce..0000000 --- a/synfig-studio/src/gui/dockable.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dockable.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 "app.h" -#include - -#include "dockable.h" -#include "dockmanager.h" -#include "dockbook.h" -#include "dockdialog.h" -#include -#include -#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 ========================================================= */ - -#ifdef WIN32 -# ifdef IMAGE_DIR -# undef IMAGE_DIR -# define IMAGE_DIR "share\\pixmaps" -# endif -#endif - -#ifndef IMAGE_DIR -# define IMAGE_DIR "/usr/local/share/pixmaps" -#endif - -#ifndef IMAGE_EXT -# define IMAGE_EXT "png" -#endif - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -Dockable::Dockable(const synfig::String& name,const synfig::String& local_name,Gtk::StockID stock_id_): -// Gtk::Window(Gtk::WINDOW_TOPLEVEL), - name_(name), - local_name_(local_name), -// dialog_settings(this,name), - title_label_(local_name,Gtk::ALIGN_LEFT), - stock_id_(stock_id_) -{ - parent_=0; - scrolled_=0; - - use_scrolled_=true; - - attach_dnd_to(title_label_); - - toolbar_=0; - //button_box_.show(); - - Gtk::Table* table(this); - - { - title_label_.set_padding(0,0); - //title_label_.show(); - Gtk::EventBox* event_box(manage(new Gtk::EventBox())); - event_box->set_border_width(0); - event_box->add(title_label_); - //table->attach(*event_box, 0, 1, 0,1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - - header_box_.pack_start(*event_box); - - attach_dnd_to(*event_box); - event_box->show(); - // event_box->set_events(Gdk::ALL_EVENTS_MASK); //!< \todo change this to only allow what is necessary for DnD - - - Gtk::Button* bttn_close(manage(new Gtk::Button(_("X")))); - //table->attach(*bttn_close, 1, 2, 0,1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - header_box_.pack_end(*bttn_close,false,false); - bttn_close->show(); - bttn_close->set_relief(Gtk::RELIEF_NONE); - bttn_close->signal_clicked().connect(sigc::mem_fun(*this,&Dockable::detach)); - bttn_close->set_border_width(0); - dynamic_cast(bttn_close->get_child())->set_padding(0,0); - } - - prev_widget_=manage(new Gtk::Label(" ")); - - //table->attach(header_box_, 0, 1, 0,1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - table->attach(*prev_widget_, 0, 1, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - //table->attach(*toolbar_, 0, 1, 2,3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - set_toolbar(*manage(new Gtk::Toolbar)); - table->show(); - - prev_widget_->show(); - - set_size_request(175,120); - -} - -Dockable::~Dockable() -{ - if(scrolled_) - { - delete scrolled_; - scrolled_=0; - } -} - -void -Dockable::attach_dnd_to(Gtk::Widget& widget) -{ - std::list listTargets; - listTargets.push_back( Gtk::TargetEntry("DOCK") ); - - widget.drag_source_set(listTargets); - widget.drag_source_set_icon(get_stock_id()); - widget.drag_dest_set(listTargets); - - - widget.signal_drag_data_get().connect(sigc::mem_fun(*this,&Dockable::on_drag_data_get)); - widget.signal_drag_end().connect(sigc::mem_fun(*this,&Dockable::on_drag_end)); - widget.signal_drag_begin().connect(sigc::mem_fun(*this,&Dockable::on_drag_begin)); - widget.signal_drag_data_received().connect(sigc::mem_fun(*this,&Dockable::on_drag_data_received)); -} - -void -Dockable::on_drag_data_received(const Glib::RefPtr& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time) -{ - if ((selection_data.get_length() >= 0) && (selection_data.get_format() == 8)) - { - Dockable& dockable(**reinterpret_cast(const_cast(selection_data.get_data()))); - - if(dockable.parent_ != parent_) - parent_->add(dockable,parent_->page_num(*this)); - else - parent_->reorder_child(dockable,parent_->page_num(*this)); - dockable.present(); - context->drag_finish(true, false, time); - return; - } - - context->drag_finish(false, false, time); -} - -void -Dockable::on_drag_end(const Glib::RefPtr&/*context*/) -{ - if(!dnd_success_) - { - detach(); - present(); - } -} - -void -Dockable::on_drag_begin(const Glib::RefPtr&/*context*/) -{ - dnd_success_=false; -} - -void -Dockable::on_drag_data_get(const Glib::RefPtr&, Gtk::SelectionData& selection_data, guint /*info*/, guint /*time*/) -{ - Dockable* tmp(this); - dnd_success_=true; - - selection_data.set(8, reinterpret_cast(&tmp), 4); -} - -void -Dockable::set_local_name(const synfig::String& local_name) -{ - //set_title(local_name); - title_label_.set_text(local_name); -} - -void -Dockable::clear() -{ - //if(!toolbar_->children().empty()) - // toolbar_->children().clear(); - set_toolbar(*manage(new Gtk::Toolbar)); - -} - -void -Dockable::set_toolbar(Gtk::Toolbar& toolbar) -{ - if(toolbar_)remove(*toolbar_); - toolbar_=0; - toolbar_=&toolbar; - if(toolbar_) - { - attach(*toolbar_, 0, 1, 2,3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - gtk_toolbar_set_icon_size(toolbar_->gobj(),GtkIconSize(1)/*GTK_ICON_SIZE_MENU*/); - toolbar_->show(); - } -} - -bool -Dockable::clear_previous() -{ - prev_widget_=0; - prev_widget_delete_connection.disconnect(); - return false; -} - -void -Dockable::add(Gtk::Widget& x) -{ - if(prev_widget_) - { - remove(*prev_widget_); - clear_previous(); - } - - if(scrolled_) - { - delete scrolled_; - scrolled_=0; - } - - if(use_scrolled_) - { - scrolled_=new Gtk::ScrolledWindow; - - scrolled_->add(x); - - attach(*scrolled_, 0, 1, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - - x.show(); - - scrolled_->show(); - - scrolled_->set_shadow_type(Gtk::SHADOW_NONE); - scrolled_->set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC); - prev_widget_=scrolled_; - } - else - { - attach(x, 0, 1, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - x.show(); - prev_widget_=&x; - } - prev_widget_delete_connection=prev_widget_->signal_delete_event().connect( - sigc::hide( - sigc::mem_fun( - *this, - &Dockable::clear_previous - ) - ) - ); -} - -Gtk::ToolButton* -Dockable::add_button(const Gtk::StockID& stock_id, const synfig::String& tooltip) -{ - if(!toolbar_) - set_toolbar(*manage(new Gtk::Toolbar)); - - //Gtk::IconSize iconsize(4); - //Gtk::IconSize iconsize(Gtk::IconSize::from_name("synfig-small_icon")); - - Gtk::ToolButton* ret(manage(new Gtk::ToolButton(stock_id))); - //Gtk::Image* icon(manage(new Gtk::Image(stock_id,iconsize))); - //ret->add(*icon); - //ret->set_relief(Gtk::RELIEF_HALF); - //ret->set_relief(Gtk::RELIEF_NONE); - ret->set_label(tooltip); - if (toolbar_->get_tooltips_object()) - toolbar_->get_tooltips_object()->set_tip(*ret,tooltip); - - ret->show(); - //icon->show(); - toolbar_->set_tooltips(true); - - toolbar_->append(*ret); - //button_box_.pack_start(*ret,false,false); - //get_action_area()->pack_start(*ret,false,false); - //add_action_widget(*ret,1); - return ret; -} - - -void -Dockable::detach() -{ - if(parent_) - parent_->remove(*this); -} - -void -Dockable::present() -{ - if(parent_) - { - parent_->set_current_page(parent_->page_num(*this)); - parent_->present(); - } - else - { - DockDialog* dock_dialog(new DockDialog()); - dock_dialog->get_dock_book().add(*this); -/* //hack: always display composition selector on top of canvas browser - if(get_name()=="canvases") - dock_dialog->set_composition_selector(true); -*/ - dock_dialog->present(); - } -} - -Gtk::Widget* -Dockable::create_tab_label() -{ - Gtk::EventBox* event_box(manage(new Gtk::EventBox())); - - attach_dnd_to(*event_box); - - { - Gtk::StockID stock_id(get_stock_id()); - Gtk::StockItem item; - - // Check to make sure the icon is valid - if(Gtk::Stock::lookup(stock_id,item)) - { - Gtk::Image* icon(manage(new Gtk::Image(stock_id,Gtk::IconSize(4)))); - event_box->add(*icon); - tooltips_.set_tip(*event_box,get_local_name()); - icon->show(); - } - else - { - // Bad icon, try to make a label - - Glib::ustring text(get_local_name()); - - Gtk::Label* label(manage(new Gtk::Label(text))); - event_box->add(*label); - label->show(); - } - } - - return event_box; -} diff --git a/synfig-studio/src/gui/dockable.h b/synfig-studio/src/gui/dockable.h deleted file mode 100644 index e1a2ad1..0000000 --- a/synfig-studio/src/gui/dockable.h +++ /dev/null @@ -1,144 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dockable.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_DOCKABLE_H -#define __SYNFIG_STUDIO_DOCKABLE_H - -/* === H E A D E R S ======================================================= */ - -#include -#include -#include "dialogsettings.h" -#include -#include -#include -#include -#include -#include -#include -#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 studio { - -class DockManager; -class DockBook; - -class Dockable : public Gtk::Table -{ - friend class DockManager; - friend class DockBook; - - - sigc::signal signal_stock_id_changed_; - sigc::connection prev_widget_delete_connection; -protected: - -// DialogSettings dialog_settings; - - -private: - - Gtk::Toolbar *toolbar_; - - synfig::String name_; - synfig::String local_name_; - Gtk::Tooltips tooltips_; - Gtk::Frame frame_; - Gtk::Label title_label_; - //Gtk::HBox button_box_; - Gtk::HBox header_box_; - - //Gtk::HandleBox handle_box_; - Gtk::ScrolledWindow *scrolled_; - Gtk::Widget *prev_widget_; - - bool use_scrolled_; - - Gtk::StockID stock_id_; - - DockBook* parent_; - - bool dnd_success_; - -public: - - void set_toolbar(Gtk::Toolbar& toolbar); - - void set_use_scrolled(bool x) { use_scrolled_=x; } - - Dockable(const synfig::String& name,const synfig::String& local_name,Gtk::StockID stock_id_=Gtk::StockID(" ")); - ~Dockable(); - - sigc::signal& signal_stock_id_changed() { return signal_stock_id_changed_; } - - const synfig::String& get_name()const { return name_; } - const synfig::String& get_local_name()const { return local_name_; } - - const Gtk::StockID& get_stock_id()const { return stock_id_; } - void set_stock_id(Gtk::StockID x) { stock_id_=x; signal_stock_id_changed()(); } - - void set_local_name(const synfig::String&); - - void clear(); - - Gtk::Tooltips& get_tooltips() { return tooltips_; } - - //DialogSettings& settings() { return dialog_settings; } - //const DialogSettings& settings()const { return dialog_settings; } - - void add(Gtk::Widget& x); - - Gtk::ToolButton* add_button(const Gtk::StockID& stock_id, const synfig::String& tooltip=synfig::String()); - - void detach(); - - void present(); - - void attach_dnd_to(Gtk::Widget& widget); - - bool clear_previous(); - virtual Gtk::Widget* create_tab_label(); - -private: - - void on_drag_data_get(const Glib::RefPtr&, Gtk::SelectionData& selection_data, guint info, guint time); - void on_drag_end(const Glib::RefPtr&context); - void on_drag_begin(const Glib::RefPtr&context); - void on_drag_data_received(const Glib::RefPtr& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time); - -}; // END of studio::Dockable - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dockbook.cpp b/synfig-studio/src/gui/dockbook.cpp deleted file mode 100644 index 707352e..0000000 --- a/synfig-studio/src/gui/dockbook.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dockbook.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 "dockbook.h" -#include "dockable.h" -#include "app.h" -#include "dockmanager.h" - -#include -#include -#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 ========================================================= */ - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -DockBook::DockBook() -{ - std::list listTargets; - listTargets.push_back( Gtk::TargetEntry("DOCK") ); - - drag_dest_set(listTargets); - //set_sensitive(true); - set_flags(get_flags()|Gtk::RECEIVES_DEFAULT|Gtk::HAS_GRAB); - //add_events(Gdk::ALL_EVENTS_MASK); - //set_extension_events(Gdk::EXTENSION_EVENTS_ALL); - set_show_tabs(true); - deleting_=false; -} - -DockBook::~DockBook() -{ - deleting_=true; - clear(); -} - -void -DockBook::clear() -{ - while(get_n_pages()) - remove(static_cast(*get_nth_page(get_n_pages()-1))); -} - -void -DockBook::on_drag_data_received(const Glib::RefPtr& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time) -{ - if ((selection_data.get_length() >= 0) && (selection_data.get_format() == 8)) - { - Dockable& dockable(**reinterpret_cast(const_cast(selection_data.get_data()))); - if(dockable.parent_!=this) - add(dockable); - dockable.present(); - context->drag_finish(true, false, time); - return; - } - - context->drag_finish(false, false, time); -} - -void -DockBook::add(Dockable& dockable, int position) -{ - dockable.detach(); - - if(position==-1) - append_page(dockable, " "); - else - insert_page(dockable, " ", position); - - refresh_tab(&dockable); - - dockable.signal_stock_id_changed().connect( - sigc::bind( - sigc::mem_fun( - *this, - &DockBook::refresh_tab - ), - &dockable - ) - ); - - dockable.parent_=this; - - dockable.show(); - - signal_changed_(); -} - -void -DockBook::refresh_tab(Dockable* dockable) -{ - Gtk::Widget* label(dockable->create_tab_label()); - - label->signal_button_press_event().connect( - sigc::bind( - sigc::mem_fun( - *this, - &DockBook::tab_button_pressed - ), - dockable - ) - ); - - set_tab_label(*dockable, *label); - label->show(); -} - - -void -DockBook::remove(Dockable& dockable) -{ - dockable.hide(); - remove_page(dockable); - dockable.parent_=0; - - if(!deleting_) - { - signal_changed_(); - - if(get_n_pages()==0) - signal_empty()(); - } -} - -void -DockBook::present() -{ - show(); -} - -synfig::String -DockBook::get_local_contents()const -{ - synfig::String ret; - - for(int i(0);i!=const_cast(this)->get_n_pages();i++) - { - Dockable& dockable(static_cast(*const_cast(this)->get_nth_page(i))); - - if(i) - ret+=", "; - ret+=dockable.get_local_name(); - } - - return ret; -} - -synfig::String -DockBook::get_contents()const -{ - synfig::String ret; - - for(int i(0);i!=const_cast(this)->get_n_pages();i++) - { - Dockable& dockable(static_cast(*const_cast(this)->get_nth_page(i))); - - if(i) - ret+=' '; - ret+=dockable.get_name(); - } - - return ret; -} - -void -DockBook::set_contents(const synfig::String& x) -{ - synfig::String str(x); - while(!str.empty()) - { - synfig::String::size_type separator=str.find_first_of(' '); - synfig::String dock; - if(separator==synfig::String::npos) - { - dock=str; - str.clear(); - } - else - { - dock=String(str.begin(),str.begin()+separator); - str=String(str.begin()+separator+1,str.end()); - } - - try - { - add(App::dock_manager->find_dockable(dock)); - }catch(...) { } - } -} - -bool -DockBook::tab_button_pressed(GdkEventButton* event, Dockable* dockable) -{ - if(event->button!=3) - return false; - - Gtk::Menu *tabmenu=manage(new class Gtk::Menu()); - tabmenu->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), tabmenu)); - - tabmenu->items().push_back( - Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-close"), - sigc::mem_fun(*dockable,&Dockable::detach) - ) - ); - - tabmenu->popup(event->button,gtk_get_current_event_time()); - - return true; -} diff --git a/synfig-studio/src/gui/dockbook.h b/synfig-studio/src/gui/dockbook.h deleted file mode 100644 index c8b76a8..0000000 --- a/synfig-studio/src/gui/dockbook.h +++ /dev/null @@ -1,89 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dockbook.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_DOCKBOOK_H -#define __SYNFIG_STUDIO_DOCKBOOK_H - -/* === H E A D E R S ======================================================= */ - -#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 studio { - -class DockManager; -class Dockable; - -class DockBook : public Gtk::Notebook -{ - friend class DockManager; - friend class Dockable; - - sigc::signal signal_empty_; - sigc::signal signal_changed_; - - Gtk::Tooltips tooltips_; - - bool deleting_; - -protected: -public: - DockBook(); - ~DockBook(); - - sigc::signal& signal_empty() { return signal_empty_; } - sigc::signal& signal_changed() { return signal_changed_; } - - void add(Dockable& dockable, int position=-1); - void remove(Dockable& dockable); - - void present(); - - void clear(); - - synfig::String get_local_contents()const; - - synfig::String get_contents()const; - void set_contents(const synfig::String& x); - - void refresh_tabs_headers(); - - void refresh_tab(Dockable*); - - bool tab_button_pressed(GdkEventButton* event, Dockable* dockable); - void on_drag_data_received(const Glib::RefPtr& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time); -}; // END of studio::DockBook - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dockdialog.cpp b/synfig-studio/src/gui/dockdialog.cpp deleted file mode 100644 index 6cfc8a7..0000000 --- a/synfig-studio/src/gui/dockdialog.cpp +++ /dev/null @@ -1,564 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dockdialog.cpp -** \brief Template File -** -** $Id$ -** -** \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 -** 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 "app.h" -#include - -#include "dockdialog.h" -#include "dockbook.h" -#include "dockmanager.h" -#include "toolbox.h" -#include "widgets/widget_compselect.h" -#include -#include -#include -#include -#include -#include -#include -#include "canvasview.h" -#include -#include -#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 ========================================================= */ - -#define GRAB_HINT_DATA(y,default) { \ - String x; \ - if(synfigapp::Main::settings().get_value(String("pref.")+y+"_hints",x)) \ - { \ - set_type_hint((Gdk::WindowTypeHint)atoi(x.c_str())); \ - } else {\ - set_type_hint(default); \ - } \ - } - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -DockDialog::DockDialog(): - Gtk::Window(Gtk::WINDOW_TOPLEVEL) -{ - composition_selector_=false; - is_deleting=false; - is_horizontal=false; - last_dock_book=0; - box=0; - - widget_comp_select=new Widget_CompSelect(); - - // Give ourselves an ID that is most likely unique - set_id(synfig::UniqueID().get_uid()^reinterpret_cast(this)); - - set_role(strprintf("dock_dialog_%d",get_id())); - GRAB_HINT_DATA( - "dock_dialog", -#ifdef __APPLE__ - Gdk::WINDOW_TYPE_HINT_NORMAL -#else - Gdk::WINDOW_TYPE_HINT_UTILITY -#endif - ); - set_keep_above(false); - - //! \todo can we set dialog windows transient for all normal windows, not just the toolbox? - //! paragraph 3 of http://standards.freedesktop.org/wm-spec/1.3/ar01s07.html suggests we can - // this seems to have bad effects on KDE, so leave it disabled by default - if(getenv("SYNFIG_TRANSIENT_DIALOGS")) - set_transient_for(*App::toolbox); - - // Set up the window - //set_type_hint(Gdk::WINDOW_TYPE_HINT_UTILITY); - set_title(_("Dock Panel")); - - // Register with the dock manager - App::dock_manager->dock_dialog_list_.push_back(this); - - - // connect our signals - signal_delete_event().connect( - sigc::hide( - sigc::mem_fun(*this,&DockDialog::close) - ) - ); - -/* - App::signal_canvas_view_focus().connect( - sigc::hide( - sigc::mem_fun( - *this, - &DockDialog::refresh_accel_group - ) - ) - ); -*/ - - add_accel_group(App::ui_manager()->get_accel_group()); - App::signal_present_all().connect(sigc::mem_fun0(*this,&DockDialog::present)); - -} - -DockDialog::~DockDialog() -{ - empty_sig.disconnect(); - - is_deleting=true; - - // Remove all of the dock books - for(;!dock_book_list.empty();dock_book_list.pop_front()) - { - dock_book_list.front()->clear(); - - //! \todo Fix this UGLY HACK - // The following line really should be uncommented, - // but it causes crashes. Without it, a small - // memory hole is created--but at least it doesn't crash - // delete dock_book_list.front(); - - // Oddly enough, the following line should - // theoretically do the same thing after this - // class is destroyed, but it doesn't seem to - // cause a crash. It does, however, trigger this warning: - // - // A floating object was finalized. This means that someone - // called g_object_unref() on an object that had only a - // floating reference; the initial floating reference is not - // owned by anyone and must be removed with g_object_ref_sink(). - // - // manage(dock_book_list.front()); - } - - // Remove us from the dock manager - if(App::dock_manager)try{ - std::list::iterator iter; - for(iter=App::dock_manager->dock_dialog_list_.begin();iter!=App::dock_manager->dock_dialog_list_.end();++iter) - if(*iter==this) - { - App::dock_manager->dock_dialog_list_.erase(iter); - break; - } - } - catch(...) - { - synfig::warning("DockDialog::~DockDialog(): Exception thrown when trying to remove from dock manager...?"); - } - - delete widget_comp_select; -} - -void -DockDialog::drop_on_prepend(const Glib::RefPtr& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time) -{ - if ((selection_data.get_length() >= 0) && (selection_data.get_format() == 8)) - { - Dockable& dockable(**reinterpret_cast(const_cast(selection_data.get_data()))); - prepend_dock_book()->add(dockable); - context->drag_finish(true, false, time); - return; - } - - context->drag_finish(false, false, time); -} - -void -DockDialog::drop_on_append(const Glib::RefPtr& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time) -{ - if ((selection_data.get_length() >= 0) && (selection_data.get_format() == 8)) - { - Dockable& dockable(**reinterpret_cast(const_cast(selection_data.get_data()))); - append_dock_book()->add(dockable); - context->drag_finish(true, false, time); - return; - } - - context->drag_finish(false, false, time); -} - - -void -DockDialog::on_hide() -{ - Gtk::Window::on_hide(); - close(); -} - -DockBook* -DockDialog::prepend_dock_book() -{ - if(is_deleting)return 0; - - dock_book_list.push_front(new DockBook); - last_dock_book=dock_book_list.front(); - - - last_dock_book->signal_empty().connect( - sigc::bind( - sigc::mem_fun(*this,&DockDialog::erase_dock_book), - last_dock_book - ) - ); - - dock_book_sizes_.insert(dock_book_sizes_.begin(),225); - refresh(); - return last_dock_book; -} - -DockBook* -DockDialog::append_dock_book() -{ - if(is_deleting)return 0; - - dock_book_list.push_back(new DockBook); - last_dock_book=dock_book_list.back(); - last_dock_book->signal_empty().connect( - sigc::bind( - sigc::mem_fun(*this,&DockDialog::erase_dock_book), - last_dock_book - ) - ); - last_dock_book->signal_changed().connect( - sigc::mem_fun(*this,&DockDialog::refresh_title) - ); - last_dock_book->signal_changed().connect( - sigc::mem_fun(*this,&DockDialog::refresh_title) - ); - dock_book_sizes_.push_back(225); - - //last_dock_book->show(); - refresh(); - return last_dock_book; -} - -void -DockDialog::erase_dock_book(DockBook* dock_book) -{ - if(is_deleting)return; - - std::list::iterator iter; - for(iter=dock_book_list.begin();iter!=dock_book_list.end();++iter) - if(*iter==dock_book) - { - dock_book_list.erase(iter); - - if(dock_book_list.empty()) - { - last_dock_book=0; - close(); - return; - } - else - { - if(last_dock_book==dock_book) - last_dock_book=dock_book_list.front(); - } - - refresh(); - - return; - } -} - -void -DockDialog::refresh() -{ - // synfig::info("dock_book_list.size()=%d",dock_book_list.size()); - //remove(); - - if(dock_book_list.empty()) - return; - - if(box)delete box; - box=(manage(is_horizontal?(Gtk::Box*)new Gtk::HBox:(Gtk::Box*)new Gtk::VBox)); - add(*box); - - box->pack_start(*widget_comp_select,false,true); - - Gtk::Button* append_button(manage(new Gtk::Button)); - Gtk::Button* prepend_button(manage(new Gtk::Button)); - - std::list listTargets; - listTargets.push_back( Gtk::TargetEntry("DOCK") ); - - append_button->drag_dest_set(listTargets); - prepend_button->drag_dest_set(listTargets); - - append_button->signal_drag_data_received().connect( - sigc::mem_fun(*this,&DockDialog::drop_on_append) - ); - - prepend_button->signal_drag_data_received().connect( - sigc::mem_fun(*this,&DockDialog::drop_on_prepend) - ); - - box->pack_start(*prepend_button,false,true); - box->pack_end(*append_button,false,true); - - //prepend_button->show(); - //append_button->show(); - panels_.clear(); - - if(dock_book_list.size()==1) - { - box->pack_start(get_dock_book(),true,true); - } - else - { - Gtk::Paned* parent(manage(is_horizontal?(Gtk::Paned*)new Gtk::HPaned:(Gtk::Paned*)new Gtk::VPaned)); - - panels_.push_back(parent); - - if(panels_.size()<=dock_book_sizes_.size()) - panels_.back()->set_position(dock_book_sizes_[panels_.size()-1]); - panels_.back()->property_position().signal_changed().connect( - sigc::mem_fun(*this,&DockDialog::rebuild_sizes) - ); - //parent->show(); - parent->add1(*dock_book_list.front()); - //dock_book_list.front()->show(); - - box->pack_start(*parent,true,true); - - std::list::iterator iter,next; - for(next=dock_book_list.begin(),next++,iter=next++;next!=dock_book_list.end();iter=next++) - { - Gtk::Paned* current(manage(is_horizontal?(Gtk::Paned*)new Gtk::HPaned:(Gtk::Paned*)new Gtk::VPaned)); - panels_.push_back(current); - - if(panels_.size()<=dock_book_sizes_.size()) - panels_.back()->set_position(dock_book_sizes_[panels_.size()-1]); - panels_.back()->property_position().signal_changed().connect( - sigc::mem_fun(*this,&DockDialog::rebuild_sizes) - ); - - - parent->add2(*current); - - current->add1(**iter); - //(*iter)->show(); - //current->show(); - - parent=current; - } - parent->add2(**iter); - //(*iter)->show(); - } - - box->show_all(); - if(!composition_selector_) - widget_comp_select->hide(); - rebuild_sizes(); -} - -void -DockDialog::rebuild_sizes() -{ - unsigned int i=0; - dock_book_sizes_.clear(); - for(i=0;iget_position()); - } -} - -void -DockDialog::set_dock_book_sizes(const std::vector& new_sizes) -{ - unsigned int i=0; - for(i=0;iset_position(new_sizes[i]); - } - dock_book_sizes_=new_sizes; - //rebuild_sizes(); -} - -void -DockDialog::refresh_accel_group() -{ -/* - if(last_accel_group_) - { - last_accel_group_->unlock(); - remove_accel_group(last_accel_group_); - last_accel_group_=Glib::RefPtr(); - } - - etl::loose_handle canvas_view(App::get_selected_canvas_view()); - if(canvas_view) - { - last_accel_group_=canvas_view->get_accel_group(); - last_accel_group_->lock(); - add_accel_group(last_accel_group_); - } -*/ - etl::loose_handle canvas_view(App::get_selected_canvas_view()); - if(canvas_view) - { - canvas_view->mainmenu.accelerate(*this); - } -} - -bool -DockDialog::close() -{ - if (getenv("SYNFIG_DEBUG_DESTRUCTORS")) - synfig::info("DockDialog::close(): Deleted"); - - empty_sig.disconnect(); - //get_dock_book().clear(); - delete this; - return true; -} - -DockBook& -DockDialog::get_dock_book() -{ - if(!last_dock_book) - return *append_dock_book(); - return *last_dock_book; -} - -const DockBook& -DockDialog::get_dock_book()const -{ - return *last_dock_book; -} - - -synfig::String -DockDialog::get_contents()const -{ - synfig::String ret; - - std::list::const_iterator iter; - for(iter=dock_book_list.begin();iter!=dock_book_list.end();++iter) - { - if(!ret.empty()) - ret+=is_horizontal?" | ":" - "; - ret+=(*iter)->get_contents(); - } - - - return ret; -} - -void -DockDialog::set_contents(const synfig::String& z) -{ - int x,y; - get_size(x,y); - - synfig::String str(z); - while(!str.empty()) - { - synfig::String::size_type separator=str.find_first_of('-'); - { - synfig::String::size_type sep2=str.find_first_of('|'); - if(separator!=synfig::String::npos || sep2!=synfig::String::npos) - { - if((separator==synfig::String::npos || sep2set_contents(book_contents); - }catch(...) { } - } - - resize(x,y); -} - -void -DockDialog::set_composition_selector(bool x) -{ - if(x==get_composition_selector()) - return; - composition_selector_=x; - if(x) - widget_comp_select->show(); - else - widget_comp_select->hide(); -} - -void -DockDialog::refresh_title() -{ - if(is_deleting)return; - if(dock_book_list.size()) - { - synfig::String title; - - std::list::const_iterator iter; - for(iter=dock_book_list.begin();iter!=dock_book_list.end();++iter) - { - if(!title.empty()) - title+=", "; - title+=(*iter)->get_local_contents(); - } - set_title(title); - } - else - set_title(_("Empty Dock Panel")); -} diff --git a/synfig-studio/src/gui/dockdialog.h b/synfig-studio/src/gui/dockdialog.h deleted file mode 100644 index 551ecba..0000000 --- a/synfig-studio/src/gui/dockdialog.h +++ /dev/null @@ -1,128 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dockdialog.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_DIALOG_H -#define __SYNFIG_STUDIO_DOCK_DIALOG_H - -/* === H E A D E R S ======================================================= */ - -#include -#include -#include "dialogsettings.h" -#include -#include -#include -#include -#include -#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 Gtk { class Box; class Paned; }; -namespace studio { - -class DockManager; -class DockBook; -class Dockable; -class Widget_CompSelect; -class CanvasView; - -class DockDialog : public Gtk::Window -{ - friend class DockManager; - friend class DockBook; - friend class Dockable; - sigc::connection empty_sig; - - bool composition_selector_; - - bool is_deleting; - - bool is_horizontal; - -private: - std::list dock_book_list; - - std::vector panels_; - std::vector dock_book_sizes_; - - - DockBook* last_dock_book; - - Widget_CompSelect* widget_comp_select; - Gtk::Box *box; - - int id_; - - void on_hide(); - - void refresh(); - - void refresh_title(); - - void set_id(int x) { id_=x; } - - void refresh_accel_group(); - - void drop_on_append(const Glib::RefPtr& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time); - void drop_on_prepend(const Glib::RefPtr& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time); - -public: - - const std::vector& get_dock_book_sizes()const { return dock_book_sizes_;} - void set_dock_book_sizes(const std::vector&); - void rebuild_sizes(); - - bool close(); - - int get_id()const { return id_; } - - DockBook* append_dock_book(); - DockBook* prepend_dock_book(); - void erase_dock_book(DockBook*); - - void set_composition_selector(bool x); - bool get_composition_selector()const { return composition_selector_; } - - DockDialog(); - ~DockDialog(); - - DockBook& get_dock_book(); - const DockBook& get_dock_book()const; - - synfig::String get_contents()const; - void set_contents(const synfig::String& x); -}; // END of studio::DockDialog - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/dockmanager.cpp b/synfig-studio/src/gui/dockmanager.cpp deleted file mode 100644 index 8a5198c..0000000 --- a/synfig-studio/src/gui/dockmanager.cpp +++ /dev/null @@ -1,328 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dockmanager.cpp -** \brief Template File -** -** $Id$ -** -** \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 -** 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 "dockmanager.h" -#include -#include "dockable.h" -#include "dockdialog.h" -#include -#include -#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 ========================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -class studio::DockSettings : public synfigapp::Settings -{ - DockManager* dock_manager; - -public: - DockSettings(DockManager* dock_manager):dock_manager(dock_manager) - { - synfigapp::Main::settings().add_domain(this,"dock"); - } - - virtual ~DockSettings() - { - synfigapp::Main::settings().remove_domain("dock"); - } -#define SCALE_FACTOR (1280) - virtual bool get_value(const synfig::String& key_, synfig::String& value)const - { - int screen_w(Gdk::screen_width()); - int screen_h(Gdk::screen_height()); - - if(key_.size()>6 && String(key_.begin(),key_.begin()+6)=="dialog")try - { - synfig::String key(key_.begin()+7,key_.end()); - synfig::String::size_type separator=key.find_first_of('.'); - int id(atoi(synfig::String(key.begin(),key.begin()+separator).c_str())); - key=synfig::String(key.begin()+separator+1,key.end()); - - DockDialog& dock_dialog(dock_manager->find_dock_dialog(id)); - - if(key=="contents_size") - { - dock_dialog.rebuild_sizes(); - vector::const_iterator iter(dock_dialog.get_dock_book_sizes().begin()); - vector::const_iterator end(dock_dialog.get_dock_book_sizes().end()); - value.clear(); - for(;iter!=end;++iter) - value+=strprintf("%d ",(*iter)*SCALE_FACTOR/screen_h); - return true; - } - if(key=="pos") - { - int x,y; dock_dialog.get_position(x,y); - value=strprintf("%d %d",x*SCALE_FACTOR/screen_w,y*SCALE_FACTOR/screen_h); - return true; - } - if(key=="size") - { - int x,y; dock_dialog.get_size(x,y); - value=strprintf("%d %d",x*SCALE_FACTOR/screen_w,y*SCALE_FACTOR/screen_h); - return true; - } - if(key=="contents") - { - value=dock_dialog.get_contents(); - return true; - } - if(key=="comp_selector") - { - value=dock_dialog.get_composition_selector()?"1":"0"; - return true; - } - }catch (...) { return false; } - return synfigapp::Settings::get_value(key_,value); - } - - virtual bool set_value(const synfig::String& key_,const synfig::String& value) - { - int screen_w(Gdk::screen_width()); - int screen_h(Gdk::screen_height()); - - if(key_.size()>6 && String(key_.begin(),key_.begin()+6)=="dialog") - { - synfig::String key(key_.begin()+7,key_.end()); - synfig::String::size_type separator=key.find_first_of('.'); - int id(atoi(synfig::String(key.begin(),key.begin()+separator).c_str())); - key=synfig::String(key.begin()+separator+1,key.end()); - - DockDialog& dock_dialog(dock_manager->find_dock_dialog(id)); - - if(key=="contents_size") - { - try { - int width, height; - Gtk::IconSize::lookup(Gtk::IconSize(4),width,height); - vector data; - String::size_type n=0; - String value_(value); - while(value_.size() && value_.size()>n){ - value_=String(value_.begin()+n,value_.end()); - int size; - if(!strscanf(value_,"%d",&size)) - break; - if (size > SCALE_FACTOR) size = SCALE_FACTOR - 150; - if (size < 0) size = 0; - size=size*screen_h/SCALE_FACTOR; - - // prevent errors like this, by allowing space for at least the dockable's icon: - // ** CRITICAL **: clearlooks_style_draw_box_gap: assertion `height >= -1' failed - if (size < height + 9) size = height + 9; - - data.push_back(size); - - n=value_.find(" "); - if(n==String::npos) - break; - n++; - } - dock_dialog.set_dock_book_sizes(data); - } - catch(...) - { - synfig::error("Exception caught!!!"); - return false; - } - return true; - } - if(key=="pos") - { - int x,y; - if(!strscanf(value,"%d %d",&x, &y)) - return false; - if (x > SCALE_FACTOR) x = SCALE_FACTOR - 150; if (x < 0) x = 0; - if (y > SCALE_FACTOR) y = SCALE_FACTOR - 150; if (y < 0) y = 0; - x=x*screen_w/SCALE_FACTOR; - y=y*screen_h/SCALE_FACTOR; - if(getenv("SYNFIG_WINDOW_POSITION_X_OFFSET")) - x += atoi(getenv("SYNFIG_WINDOW_POSITION_X_OFFSET")); - if(getenv("SYNFIG_WINDOW_POSITION_Y_OFFSET")) - y += atoi(getenv("SYNFIG_WINDOW_POSITION_Y_OFFSET")); - dock_dialog.move(x,y); - return true; - } - if(key=="size") - { - int x,y; - if(!strscanf(value,"%d %d",&x, &y)) - return false; - if (x > SCALE_FACTOR) x = 150; if (x < 0) x = 0; - if (y > SCALE_FACTOR) y = 150; if (y < 0) y = 0; - x=x*screen_w/SCALE_FACTOR; - y=y*screen_h/SCALE_FACTOR; - dock_dialog.set_default_size(x,y); - dock_dialog.resize(x,y); - return true; - } - if(key=="contents") - { - dock_dialog.set_contents(value); - return true; - } - if(key=="comp_selector") - { - if(value.empty() || value[0]=='0') - dock_dialog.set_composition_selector(false); - else - dock_dialog.set_composition_selector(true); - return true; - } - } - return synfigapp::Settings::set_value(key_,value); - } - - virtual KeyList get_key_list()const - { - synfigapp::Settings::KeyList ret(synfigapp::Settings::get_key_list()); - - std::list::const_iterator iter; - for(iter=dock_manager->dock_dialog_list_.begin();iter!=dock_manager->dock_dialog_list_.end();++iter) - { - ret.push_back(strprintf("dialog.%d.contents",(*iter)->get_id())); - ret.push_back(strprintf("dialog.%d.comp_selector",(*iter)->get_id())); - ret.push_back(strprintf("dialog.%d.pos",(*iter)->get_id())); - ret.push_back(strprintf("dialog.%d.size",(*iter)->get_id())); - ret.push_back(strprintf("dialog.%d.contents_size",(*iter)->get_id())); - } - return ret; - } -}; - -/* === M E T H O D S ======================================================= */ - -DockManager::DockManager(): - dock_settings(new DockSettings(this)) -{ -} - -DockManager::~DockManager() -{ - while(!dock_dialog_list_.empty()) - { - dock_dialog_list_.back()->close(); - } - while(!dockable_list_.empty()) - { - Dockable* dockable(dockable_list_.back()); - // synfig::info("DockManager::~DockManager(): Deleting dockable \"%s\"",dockable->get_name().c_str()); - dockable_list_.pop_back(); - delete dockable; - } -} - -void -DockManager::register_dockable(Dockable& x) -{ - dockable_list_.push_back(&x); - // synfig::info("DockManager::register_dockable(): Registered dockable \"%s\"",dockable_list_.back()->get_name().c_str()); - signal_dockable_registered()(&x); -} - -bool -DockManager::unregister_dockable(Dockable& x) -{ - std::list::iterator iter; - for(iter=dockable_list_.begin();iter!=dockable_list_.end();++iter) - { - if(&x==*iter) - { - x.detach(); - dockable_list_.erase(iter); - synfig::info("DockManager::unregister_dockable(): \"%s\" has been Unregistered",x.get_name().c_str()); - return true; - } - } - return false; -} - -Dockable& -DockManager::find_dockable(const synfig::String& x) -{ - std::list::iterator iter; - for(iter=dockable_list_.begin();iter!=dockable_list_.end();++iter) - if((*iter)->get_name()==x) - return **iter; - - throw std::runtime_error("DockManager::find_dockable(): not found"); -} - -void -DockManager::present(synfig::String x) -{ - try - { - find_dockable(x).present(); - } - catch(...) - { - } -} - -DockDialog& -DockManager::find_dock_dialog(int id) -{ - std::list::iterator iter; - for(iter=dock_dialog_list_.begin();iter!=dock_dialog_list_.end();++iter) - if((*iter)->get_id()==id) - return **iter; - - DockDialog* dock_dialog(new DockDialog()); - dock_dialog->set_id(id); - dock_dialog->show(); - return *dock_dialog; -} - -const DockDialog& -DockManager::find_dock_dialog(int id)const -{ - std::list::const_iterator iter; - for(iter=dock_dialog_list_.begin();iter!=dock_dialog_list_.end();++iter) - if((*iter)->get_id()==id) - return **iter; - - throw std::runtime_error("DockManager::find_dock_dialog(int id)const: not found"); -} diff --git a/synfig-studio/src/gui/dockmanager.h b/synfig-studio/src/gui/dockmanager.h deleted file mode 100644 index 98df376..0000000 --- a/synfig-studio/src/gui/dockmanager.h +++ /dev/null @@ -1,82 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file dockmanager.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_DOCKMANAGER_H -#define __SYNFIG_DOCKMANAGER_H - -/* === H E A D E R S ======================================================= */ - -#include -#include -#include -#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 studio { - -class Dockable; -class DockDialog; -class DockSettings; - -class DockManager : public sigc::trackable -{ - friend class Dockable; - friend class DockDialog; - friend class DockSettings; - - std::list dockable_list_; - std::list dock_dialog_list_; - - sigc::signal signal_dockable_registered_; - - etl::smart_ptr dock_settings; - -public: - DockManager(); - ~DockManager(); - - DockDialog& find_dock_dialog(int id); - const DockDialog& find_dock_dialog(int id)const; - - sigc::signal& signal_dockable_registered() { return signal_dockable_registered_; } - - void register_dockable(Dockable& x); - bool unregister_dockable(Dockable& x); - Dockable& find_dockable(const synfig::String& x); - void present(synfig::String x); - -}; // END of class DockManager - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gui/docks/dialog_tooloptions.cpp b/synfig-studio/src/gui/docks/dialog_tooloptions.cpp new file mode 100644 index 0000000..7d45979 --- /dev/null +++ b/synfig-studio/src/gui/docks/dialog_tooloptions.cpp @@ -0,0 +1,97 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialog_tooloptions.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 "docks/dialog_tooloptions.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 ======================================================= */ + +Dialog_ToolOptions::Dialog_ToolOptions(): + Dockable("tool_options",_("Tool Options"),Gtk::StockID("synfig-about")), + empty_label(_("This tool has no options")) +{ + add(sub_vbox_); + + set_widget(empty_label); + empty_label.show(); +} + +Dialog_ToolOptions::~Dialog_ToolOptions() +{ +} + +void +Dialog_ToolOptions::clear() +{ + Dockable::clear(); + set_local_name(_("Tool Options")); + add(sub_vbox_); + set_widget(empty_label); + empty_label.show(); + + set_stock_id(Gtk::StockID("synfig-about")); +} + +void +Dialog_ToolOptions::set_widget(Gtk::Widget&x) +{ + if(!sub_vbox_.children().empty()) + sub_vbox_.children().clear(); + + sub_vbox_.show(); + sub_vbox_.pack_start(x,false,false); + x.show(); +} + +void +Dialog_ToolOptions::set_name(const synfig::String& name) +{ + set_stock_id(Gtk::StockID("synfig-"+name)); +} diff --git a/synfig-studio/src/gui/docks/dialog_tooloptions.h b/synfig-studio/src/gui/docks/dialog_tooloptions.h new file mode 100644 index 0000000..05dfe93 --- /dev/null +++ b/synfig-studio/src/gui/docks/dialog_tooloptions.h @@ -0,0 +1,62 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dialog_tooloptions.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_DIALOG_TOOLOPTIONS_H +#define __SYNFIG_STUDIO_DIALOG_TOOLOPTIONS_H + +/* === H E A D E R S ======================================================= */ + +#include +#include +#include +#include "docks/dockable.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 Dialog_ToolOptions : public Dockable +{ + Gtk::Label empty_label; + Gtk::VBox sub_vbox_; + +public: + + void clear(); + void set_widget(Gtk::Widget&); + void set_name(const synfig::String& name); + + Dialog_ToolOptions(); + ~Dialog_ToolOptions(); +}; // END of Dialog_ToolOptions + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/docks/dock_canvases.cpp b/synfig-studio/src/gui/docks/dock_canvases.cpp new file mode 100644 index 0000000..92363aa --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_canvases.cpp @@ -0,0 +1,251 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dock_canvases.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 "docks/dock_canvases.h" +#include "app.h" +#include "canvasview.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_Canvases::Dock_Canvases(): + Dockable("canvases",_("Canvas Browser"),Gtk::StockID("synfig-canvas")) +{ + + App::signal_instance_created().connect(sigc::mem_fun(*this,&studio::Dock_Canvases::new_instance)); + App::signal_instance_deleted().connect(sigc::mem_fun(*this,&studio::Dock_Canvases::delete_instance)); + App::signal_instance_selected().connect(sigc::mem_fun(*this,&studio::Dock_Canvases::set_selected_instance_signal)); + + + add(*create_canvas_tree()); + +/* // \todo Implement canvas management in canvas browser + add_button( + Gtk::StockID("synfig-canvas_new"), + _("Insert a new canvas") + )->signal_clicked().connect( + sigc::mem_fun( + *this, + &Dock_Canvases::menu_new_canvas + ) + ); + + add_button( + Gtk::StockID("gtk-delete"), + _("Remove selected canvas") + )->signal_clicked().connect( + sigc::mem_fun( + *this, + &Dock_Canvases::menu_delete + ) + ); + + add_button( + Gtk::StockID("synfig-rename"), + _("Rename selected canvas") + )->signal_clicked().connect( + sigc::mem_fun( + *this, + &Dock_Canvases::menu_rename + ) + ); +*/ +} + +Dock_Canvases::~Dock_Canvases() +{ +} + +Gtk::Widget* +Dock_Canvases::create_canvas_tree() +{ + studio::Instance::CanvasTreeModel canvas_tree_model; + canvas_tree=manage(new class Gtk::TreeView()); + { + Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("ID")) ); +// Gtk::CellRendererPixbuf* icon_cellrenderer = Gtk::manage( new Gtk::CellRendererPixbuf() ); + + //column->pack_start(*icon_cellrenderer,false); + column->pack_start(canvas_tree_model.icon, false); //false = don't expand. + column->pack_start(canvas_tree_model.label); + +//#ifdef NDEBUG +// column->add_attribute(icon_cellrenderer->property_pixbuf(), canvas_tree_model.icon); +//#endif + + canvas_tree->append_column(*column); + } + canvas_tree->set_rules_hint(); + canvas_tree->signal_row_activated().connect(sigc::mem_fun(*this,&Dock_Canvases::on_row_activate)); + //canvas_tree->signal_event().connect(sigc::mem_fun(*this,&Dock_Canvases::on_tree_event)); + canvas_tree->add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); + canvas_tree->add_events(Gdk::BUTTON1_MOTION_MASK); + canvas_tree->show(); + canvas_tree->set_headers_visible(false); + + Gtk::ScrolledWindow *scrolledwindow = manage(new class Gtk::ScrolledWindow()); + scrolledwindow->set_flags(Gtk::CAN_FOCUS); + scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + scrolledwindow->add(*canvas_tree); + scrolledwindow->set_shadow_type(Gtk::SHADOW_ETCHED_IN); + scrolledwindow->show_all(); + + return scrolledwindow; +} + +etl::loose_handle +Dock_Canvases::get_selected_canvas_view() +{ + return get_selected_instance()->find_canvas_view(get_selected_canvas()); +} + +etl::loose_handle +Dock_Canvases::get_selected_canvas() +{ + Glib::RefPtr selection=canvas_tree->get_selection(); + + if(!selection || !selection->get_selected()) + return 0; + + studio::Instance::CanvasTreeModel canvas_tree_model; + + return static_cast >((*selection->get_selected())[canvas_tree_model.canvas]); +} + + + +void +Dock_Canvases::set_selected_instance_signal(etl::handle x) +{ + set_selected_instance(x); +} + +void +Dock_Canvases::set_selected_instance_(etl::handle instance) +{ + if(studio::App::shutdown_in_progress) + return; + + selected_instance=instance; + if(instance) + { + canvas_tree->set_model(instance->canvas_tree_store()); + canvas_tree->show(); + } + else + { + canvas_tree->set_model(Glib::RefPtr< Gtk::TreeModel >()); + canvas_tree->hide(); + } +} + +void +Dock_Canvases::set_selected_instance(etl::loose_handle x) +{ + if(studio::App::shutdown_in_progress) + return; + + // if it's already selected, don't select it again + if (x==selected_instance) + return; + + set_selected_instance_(x); +} + +void +Dock_Canvases::new_instance(etl::handle instance) +{ + if(studio::App::shutdown_in_progress) + return; + + assert(instance); + + etl::loose_handle loose_instance(instance); + + instance->synfigapp::Instance::signal_filename_changed().connect(sigc::mem_fun(*this,&Dock_Canvases::refresh_instances)); + instance->synfigapp::Instance::signal_filename_changed().connect( + sigc::bind >( + sigc::mem_fun(*this,&Dock_Canvases::set_selected_instance), + loose_instance + ) + ); + + present(); + +} + +void +Dock_Canvases::delete_instance(etl::handle instance) +{ + if(studio::App::shutdown_in_progress) + return; + + refresh_instances(); + + if(selected_instance==instance) + { + set_selected_instance(0); + } +} + +void +Dock_Canvases::refresh_instances() +{ + if(studio::App::shutdown_in_progress) + return; +} + +void +Dock_Canvases::on_row_activate(const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn *) +{ + assert(get_selected_instance()); + studio::Instance::CanvasTreeModel canvas_tree_model; + const Gtk::TreeRow row = *(get_selected_instance()->canvas_tree_store()->get_iter(path)); + if(row[canvas_tree_model.is_canvas]) + get_selected_instance()->focus(row[canvas_tree_model.canvas]); + else + studio::App::dialog_not_implemented(); +} diff --git a/synfig-studio/src/gui/docks/dock_canvases.h b/synfig-studio/src/gui/docks/dock_canvases.h new file mode 100644 index 0000000..1ab15e7 --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_canvases.h @@ -0,0 +1,88 @@ +/* === S Y N F I G ========================================================= */ +/*! \file docks/dock_canvases.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_DIALOG_CANVASES_H +#define __SYNFIG_STUDIO_DIALOG_CANVASES_H + +/* === H E A D E R S ======================================================= */ + +#include "docks/dockable.h" +#include +#include "instance.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_Canvases : public Dockable +{ + Gtk::TreeView *canvas_tree; + //Gtk::Menu menu; + etl::loose_handle selected_instance; + +private: + + void set_selected_instance_(etl::handle x); + + etl::loose_handle get_selected_instance() { return selected_instance; } + + etl::loose_handle get_selected_canvas(); + + etl::loose_handle get_selected_canvas_view(); + + void set_selected_instance(etl::loose_handle x); + + void set_selected_instance_signal(etl::handle x); + + void new_instance(etl::handle x); + + void delete_instance(etl::handle x); + + void refresh_instances(); + + bool close(); + + void on_row_activate(const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn *); + //bool on_tree_event(GdkEvent *event); + + + + void on_action_toggle(const Glib::ustring& path); + Gtk::Widget* create_canvas_tree(); + +public: + + Dock_Canvases(); + ~Dock_Canvases(); +}; // END of Dock_Canvases + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/docks/dock_canvasspecific.cpp b/synfig-studio/src/gui/docks/dock_canvasspecific.cpp new file mode 100644 index 0000000..1ef3a47 --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_canvasspecific.cpp @@ -0,0 +1,175 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dock_canvasspecific.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 "app.h" +#include "docks/dock_canvasspecific.h" + +#include +#include +#include "instance.h" +#include +#include +//#include +#include +#include "metadatatreestore.h" +#include "canvasview.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 ========================================================= */ + +/* === 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_CanvasSpecific::Dock_CanvasSpecific(const synfig::String& name,const synfig::String& local_name,Gtk::StockID stock_id_): + Dockable(name,local_name,stock_id_) +{ + App::signal_instance_created().connect(sigc::mem_fun(*this,&Dock_CanvasSpecific::init_instance)); +} + +Dock_CanvasSpecific::~Dock_CanvasSpecific() +{ +} + +etl::loose_handle +Dock_CanvasSpecific::get_canvas_view() +{ + return App::get_selected_canvas_view(); +} + +etl::loose_handle +Dock_CanvasSpecific::get_canvas_interface() +{ + if(get_canvas_view()) + return get_canvas_view()->canvas_interface(); + return 0; +} + +void +Dock_CanvasSpecific::init_canvas_view_vfunc(etl::loose_handle /*canvas_view*/) +{ +} + +void +Dock_CanvasSpecific::init_instance_vfunc(etl::loose_handle /*instance*/) +{ +} + +void +Dock_CanvasSpecific::changed_canvas_view_vfunc(etl::loose_handle /*canvas_view*/) +{ +} + +void +Dock_CanvasSpecific::init_instance(etl::handle instance) +{ + etl::clock timer;timer.reset(); + instance->signal_canvas_view_created().connect(sigc::mem_fun(*this,&Dock_CanvasSpecific::init_canvas_view)); + init_instance_vfunc(instance); + // synfig::info("%s init_instance() took %f seconds",get_local_name().c_str(),float(timer())); +} + +void +Dock_CanvasSpecific::delete_instance(etl::handle /*instance*/) +{ + changed_canvas_view_vfunc(0); +} + +void +Dock_CanvasSpecific::init_canvas_view(CanvasView* canvas_view) +{ + /* + canvas_view->signal_focus_in_event().connect( + sigc::hide( + sigc::bind_return( + sigc::mem_fun( + *this, + &Dock_CanvasSpecific::canvas_view_changed + ), + false + ) + ) + ); + */ + // synfig::info("%s init_canvas_view() Starting init...",get_local_name().c_str()); + etl::clock timer;timer.reset(); + App::signal_canvas_view_focus().connect( + sigc::hide( + sigc::mem_fun( + *this, + &Dock_CanvasSpecific::canvas_view_changed + ) + ) + ); + init_canvas_view_vfunc(canvas_view); + // synfig::info("%s init_canvas_view() took %f seconds",get_local_name().c_str(),float(timer())); +} + +void +Dock_CanvasSpecific::canvas_view_changed() +{ + etl::loose_handle canvas_view(App::get_selected_canvas_view()); +/* if(canvas_view) + { + canvas_delete_connection.disconnect(); + canvas_delete_connection=canvas_view->signal_deleted().connect( + sigc::bind( + sigc::mem_fun( + *this, + &Dock_CanvasSpecific::changed_canvas_view + ), + etl::loose_handle(0) + ) + ); + } +*/ + +// #ifdef _DEBUG +// synfig::info("%s canvas_view_changed: start",get_local_name().c_str()); +// #endif + changed_canvas_view_vfunc(canvas_view); +// #ifdef _DEBUG +// synfig::info("%s canvas_view_changed: end",get_local_name().c_str()); +// #endif +} diff --git a/synfig-studio/src/gui/docks/dock_canvasspecific.h b/synfig-studio/src/gui/docks/dock_canvasspecific.h new file mode 100644 index 0000000..bcb0eab --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_canvasspecific.h @@ -0,0 +1,73 @@ +/* === S Y N F I G ========================================================= */ +/*! \file docks/dock_canvasspecific.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_CANVASSPECIFIC_H +#define __SYNFIG_STUDIO_DOCK_CANVASSPECIFIC_H + +/* === H E A D E R S ======================================================= */ + +#include "docks/dockable.h" +#include +#include "instance.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 CanvasView; +class Instance; + +class Dock_CanvasSpecific : public Dockable +{ + sigc::connection canvas_delete_connection; +protected: + virtual void init_instance_vfunc(etl::loose_handle instance); + + virtual void init_canvas_view_vfunc(etl::loose_handle canvas_view); + virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); + +private: + void init_canvas_view(CanvasView* canvas_view); + void init_instance(etl::handle instance); + void delete_instance(etl::handle instance); + void canvas_view_changed(); + void changed_canvas_view(etl::loose_handle canvas_view) { return changed_canvas_view_vfunc(canvas_view); } +public: + + etl::loose_handle get_canvas_view(); + etl::loose_handle get_canvas_interface(); + + Dock_CanvasSpecific(const synfig::String& name,const synfig::String& local_name,Gtk::StockID stock_id_=Gtk::StockID(" ")); + virtual ~Dock_CanvasSpecific(); +}; // END of Dock_CanvasSpecific + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/docks/dock_children.cpp b/synfig-studio/src/gui/docks/dock_children.cpp new file mode 100644 index 0000000..eaa6365 --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_children.cpp @@ -0,0 +1,107 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dock_children.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 "docks/dock_children.h" +#include "app.h" + +#include +#include +#include "instance.h" +#include +#include +#include +#include +#include "childrentreestore.h" +#include "childrentree.h" +#include "canvasview.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_Children::Dock_Children(): + Dock_CanvasSpecific("children",_("Children"),Gtk::StockID("synfig-children")) +{ + //! \todo the combination of set_use_scrolled(false) and + //! add(*tree_view) causes crashes when + //! Dockable::prev_widget_ is left referencing a + //! ChildrenTree that has already been destroyed. + // set_use_scrolled(false); +} + +Dock_Children::~Dock_Children() +{ +} + +void +Dock_Children::init_canvas_view_vfunc(etl::loose_handle canvas_view) +{ + Glib::RefPtr children_tree_store; + children_tree_store=ChildrenTreeStore::create(canvas_view->canvas_interface()); + + ChildrenTree* children_tree(new ChildrenTree()); + children_tree->set_model(children_tree_store); + children_tree->set_time_adjustment(canvas_view->time_adjustment()); + + + canvas_view->set_tree_model(get_name(),children_tree_store); + canvas_view->set_ext_widget(get_name(),children_tree); +} + +void +Dock_Children::changed_canvas_view_vfunc(etl::loose_handle canvas_view) +{ + if(canvas_view) + { + Gtk::Widget* tree_view(canvas_view->get_ext_widget(get_name())); + + add(*tree_view); + tree_view->show(); + } + else clear_previous(); + +} diff --git a/synfig-studio/src/gui/docks/dock_children.h b/synfig-studio/src/gui/docks/dock_children.h new file mode 100644 index 0000000..09fab01 --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_children.h @@ -0,0 +1,60 @@ +/* === S Y N F I G ========================================================= */ +/*! \file docks/dock_children.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_CHILDREN_H +#define __SYNFIG_STUDIO_DOCK_CHILDREN_H + +/* === H E A D E R S ======================================================= */ + +#include "docks/dockable.h" +#include +#include "instance.h" +#include "docks/dock_canvasspecific.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_Children : public Dock_CanvasSpecific +{ +protected: + virtual void init_canvas_view_vfunc(etl::loose_handle canvas_view); + virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); + +public: + + + Dock_Children(); + ~Dock_Children(); +}; // END of Dock_Children + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/docks/dock_curves.cpp b/synfig-studio/src/gui/docks/dock_curves.cpp new file mode 100644 index 0000000..4d1d97d --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_curves.cpp @@ -0,0 +1,194 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dock_curves.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 "docks/dock_curves.h" +#include "app.h" + +#include +#include +#include "instance.h" +#include +#include +#include +#include "canvasview.h" +#include "layerparamtreestore.h" +#include "workarea.h" +#include "widgets/widget_curves.h" +#include "layerparamtreestore.h" +#include +#include +#include "widgets/widget_timeslider.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_Curves::Dock_Curves(): + Dock_CanvasSpecific("curves",_("Curves"),Gtk::StockID("synfig-curves")) +{ + last_widget_curves_=0; + table_=0; + + hscrollbar_=new Gtk::HScrollbar(); + vscrollbar_=new Gtk::VScrollbar(); + widget_timeslider_= new Widget_Timeslider(); +} + +Dock_Curves::~Dock_Curves() +{ + if(table_)delete table_; + delete hscrollbar_; + delete vscrollbar_; + delete widget_timeslider_; +} + +static void +_curve_selection_changed(Gtk::TreeView* param_tree_view,Widget_Curves* curves) +{ + LayerParamTreeStore::Model model; + Gtk::TreeIter iter; + if(!param_tree_view->get_selection()->count_selected_rows()) + { + curves->clear(); + curves->refresh(); + return; + } + + std::list value_descs; + + iter=param_tree_view->get_selection()->get_selected(); + value_descs.push_back((*iter)[model.value_desc]); + curves->set_value_descs(value_descs); +} + +void +Dock_Curves::init_canvas_view_vfunc(etl::loose_handle canvas_view) +{ + Widget_Curves* curves(new Widget_Curves()); + curves->set_time_adjustment(canvas_view->time_adjustment()); + + Gtk::TreeView* param_tree_view( + static_cast(canvas_view->get_ext_widget("params")) + ); + + param_tree_view->get_selection()->signal_changed().connect( + sigc::bind( + sigc::bind( + sigc::ptr_fun( + _curve_selection_changed + ),curves + ),param_tree_view + ) + ); + + canvas_view->set_ext_widget(get_name(),curves); +} + +void +Dock_Curves::refresh_selected_param() +{ +/* Gtk::TreeView* tree_view( + static_cast(get_canvas_view()->get_ext_widget(get_name())) + ); + Gtk::TreeModel::iterator iter(tree_view->get_selection()->get_selected()); + + if(iter) + { + LayerParamTreeStore::Model model; + get_canvas_view()->work_area->set_selected_value_node( + (synfig::ValueNode::Handle)(*iter)[model.value_node] + ); + } + else + { + get_canvas_view()->work_area->set_selected_value_node(0); + } +*/ +} + +void +Dock_Curves::changed_canvas_view_vfunc(etl::loose_handle canvas_view) +{ + if(table_) + { + table_->hide(); + delete table_; + hscrollbar_->unset_adjustment(); + vscrollbar_->unset_adjustment(); + //widget_timeslider_->unset_adjustment(); + table_=0; + } + + + if(canvas_view) + { + last_widget_curves_=dynamic_cast( + canvas_view->get_ext_widget(get_name()) + ); + + vscrollbar_->set_adjustment(last_widget_curves_->get_range_adjustment()); + hscrollbar_->set_adjustment(canvas_view->time_window_adjustment()); + widget_timeslider_->set_time_adjustment(&canvas_view->time_adjustment()); + widget_timeslider_->set_bounds_adjustment(&canvas_view->time_window_adjustment()); + widget_timeslider_->set_global_fps(canvas_view->get_canvas()->rend_desc().get_frame_rate()); + + table_=new Gtk::Table(2,2); + table_->attach(*widget_timeslider_, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK); + table_->attach(*last_widget_curves_, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); + table_->attach(*hscrollbar_, 0, 1, 2, 3, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK); + table_->attach(*vscrollbar_, 1, 2, 0, 2, Gtk::FILL|Gtk::SHRINK, Gtk::FILL|Gtk::EXPAND); + add(*table_); + + //add(*last_widget_curves_); + last_widget_curves_->show(); + table_->show_all(); + show_all(); + } + else + { + //clear_previous(); + } +} diff --git a/synfig-studio/src/gui/docks/dock_curves.h b/synfig-studio/src/gui/docks/dock_curves.h new file mode 100644 index 0000000..495dd68 --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_curves.h @@ -0,0 +1,74 @@ +/* === S Y N F I G ========================================================= */ +/*! \file docks/dock_curves.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_CURVES_H +#define __SYNFIG_STUDIO_DOCK_CURVES_H + +/* === H E A D E R S ======================================================= */ + +#include "docks/dockable.h" +#include +#include "instance.h" +#include "docks/dock_canvasspecific.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 Gtk { class Table; class HScrollbar; class VScrollbar; }; + +namespace studio { + +class Widget_Curves; +class Widget_Timeslider; + +class Dock_Curves : public Dock_CanvasSpecific +{ + Gtk::Table* table_; + Gtk::HScrollbar* hscrollbar_; + Gtk::VScrollbar* vscrollbar_; + + Widget_Timeslider* widget_timeslider_; + Widget_Curves* last_widget_curves_; + +protected: + virtual void init_canvas_view_vfunc(etl::loose_handle canvas_view); + virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); + + void refresh_selected_param(); + +public: + + + Dock_Curves(); + ~Dock_Curves(); +}; // END of Dock_Keyframes + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/docks/dock_history.cpp b/synfig-studio/src/gui/docks/dock_history.cpp new file mode 100644 index 0000000..6ee6e51 --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_history.cpp @@ -0,0 +1,447 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dock_history.cpp +** \brief Template File +** +** $Id$ +** +** \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 +** 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 "docks/dock_history.h" +#include "app.h" + + + +#include +#include +#include "instance.h" +#include +#include +#include +#include +#include "historytreestore.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 ========================================================= */ +#define COLUMNID_JUMP (787584) +#define ColumnID int + +/* === 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_History::Dock_History(): + Dock_CanvasSpecific("history",_("History"),Gtk::StockID("gtk-undo")), + action_group(Gtk::ActionGroup::create("action_group_dock_history")) +{ + App::signal_instance_deleted().connect(sigc::mem_fun(*this,&studio::Dock_History::delete_instance)); + App::signal_instance_selected().connect(sigc::mem_fun(*this,&studio::Dock_History::set_selected_instance_signal)); + + action_group->add(Gtk::Action::create( + "clear-undo", + Gtk::StockID("synfig-clear_undo"), + _("Clear Undo Stack"), + _("Clear the undo stack") + ), + sigc::mem_fun( + *this, + &Dock_History::clear_undo + ) + ); + action_group->add(Gtk::Action::create( + "clear-redo", + Gtk::StockID("synfig-clear_redo"), + _("Clear Redo Stack"), + _("Clear the redo stack") + ), + sigc::mem_fun( + *this, + &Dock_History::clear_redo + ) + ); + action_group->add(Gtk::Action::create( + "clear-undo-and-redo", + Gtk::Stock::CLEAR, + _("Clear Undo and Redo Stacks"), + _("Clear the undo and redo stacks") + ), + sigc::mem_fun( + *this, + &Dock_History::clear_undo_and_redo + ) + ); + action_group->add(Gtk::Action::create( + "undo", + Gtk::StockID("gtk-undo"), + _("Undo"), + _("Undo the previous action") + ), + sigc::ptr_fun(studio::App::undo) + ); + action_group->add(Gtk::Action::create( + "redo", + Gtk::StockID("gtk-redo"), + _("Redo"), + _("Redo the previously undone action") + ), + sigc::ptr_fun(studio::App::redo) + ); + + action_group->add( Gtk::Action::create("toolbar-history", _("History")) ); + App::ui_manager()->insert_action_group(action_group); + + Glib::ustring ui_info = + "" + " " + " " + " " + " " + " " + " " + " " + "" + ; + + App::ui_manager()->add_ui_from_string(ui_info); + + action_group->set_sensitive(false); + + set_toolbar(*dynamic_cast(App::ui_manager()->get_widget("/toolbar-history"))); + add(*create_action_tree()); +} + +Dock_History::~Dock_History() +{ +} + +void +Dock_History::init_instance_vfunc(etl::loose_handle instance) +{ + instance->signal_undo_redo_status_changed().connect( + sigc::mem_fun(*this,&Dock_History::update_undo_redo) + ); +} + +Gtk::Widget* +Dock_History::create_action_tree() +{ + studio::HistoryTreeStore::Model history_tree_model; + action_tree=manage(new class Gtk::TreeView()); + { + Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column("") ); + + Gtk::CellRendererToggle* toggle_cr = Gtk::manage( new Gtk::CellRendererToggle() ); + toggle_cr->signal_toggled().connect(sigc::mem_fun(*this, &studio::Dock_History::on_action_toggle) ); + + column->pack_start(*toggle_cr); //false = don't expand. + column->add_attribute(toggle_cr->property_active(),history_tree_model.is_active); + column->set_resizable(); + column->set_clickable(); + + action_tree->append_column(*column); + } + /*{ + Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Canvas")) ); + Gtk::CellRendererText *text_cr=Gtk::manage(new Gtk::CellRendererText()); + text_cr->property_foreground()=Glib::ustring("#7f7f7f"); + + column->pack_start(*text_cr); + column->add_attribute(text_cr->property_text(),history_tree_model.canvas_id); + column->add_attribute(text_cr->property_foreground_set(),history_tree_model.is_redo); + + action_tree->append_column(*column); + }*/ + { + Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Jump")) ); + + Gtk::CellRendererText* cell_renderer_jump=Gtk::manage(new Gtk::CellRendererText()); + column->pack_start(*cell_renderer_jump,true); + + cell_renderer_jump->property_text()=_("(JMP)"); + cell_renderer_jump->property_foreground()="#003a7f"; + + column->set_resizable(); + column->set_clickable(); + + column->set_sort_column(COLUMNID_JUMP); + + action_tree->append_column(*column); + //column->clicked(); + } + { + Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Action")) ); + + Gtk::CellRendererText *text_cr=Gtk::manage(new Gtk::CellRendererText()); + text_cr->property_foreground()=Glib::ustring("#7f7f7f"); + + + + //column->pack_start(history_tree_model.icon, false); //false = don't expand. + column->pack_start(*text_cr); + column->add_attribute(text_cr->property_text(),history_tree_model.name); + column->add_attribute(text_cr->property_foreground_set(),history_tree_model.is_redo); + + action_tree->append_column(*column); + } + + action_tree->set_enable_search(true); + action_tree->set_search_column(history_tree_model.name); + action_tree->set_search_equal_func(sigc::ptr_fun(&studio::HistoryTreeStore::search_func)); + + action_tree->set_rules_hint(); +// action_tree->signal_row_activated().connect(sigc::mem_fun(*this,&Dock_History::on_row_activate)); + action_tree->signal_event().connect(sigc::mem_fun(*this,&Dock_History::on_action_event)); +// action_tree->add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); +// action_tree->add_events(Gdk::BUTTON1_MOTION_MASK); + action_tree->show(); + + Gtk::ScrolledWindow *scrolledwindow = manage(new class Gtk::ScrolledWindow()); + scrolledwindow->set_flags(Gtk::CAN_FOCUS); + scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + scrolledwindow->add(*action_tree); + scrolledwindow->set_shadow_type(Gtk::SHADOW_ETCHED_IN); + scrolledwindow->show_all(); + +/* { + Gtk::Widget& widget(*action_tree); + Pango::FontDescription font(widget.get_modifier_style()->get_font()); + font.set_size(Pango::SCALE*5); + widget.get_modifier_style()->set_font(font); + widget.modify_font(font); + } +*/ + return scrolledwindow; +} + +void +Dock_History::clear_undo() +{ + if(selected_instance && App::dialog_yes_no(_("Clear History"), + _("You will not be able to undo any changes that you have made!\nAre you sure you want to clear the undo stack?"))) + selected_instance->clear_undo_stack(); +} + +void +Dock_History::clear_redo() +{ + if(selected_instance && App::dialog_yes_no(_("Clear History"), + _("You will not be able to redo any changes that you have made!\nAre you sure you want to clear the redo stack?"))) + selected_instance->clear_redo_stack(); +} + +void +Dock_History::clear_undo_and_redo() +{ + if(selected_instance && App::dialog_yes_no(_("Clear History"), + _("You will not be able to undo or redo any changes that you have made!\nAre you sure you want to clear the undo and redo stacks?"))) + { + selected_instance->clear_undo_stack(); + selected_instance->clear_redo_stack(); + } +} + +void +Dock_History::update_undo_redo() +{ + etl::handle instance=App::get_selected_instance(); + if(instance) + { + action_group->get_action("undo")->set_sensitive(instance->get_undo_status()); + action_group->get_action("clear-undo")->set_sensitive(instance->get_undo_status()); + action_group->get_action("redo")->set_sensitive(instance->get_redo_status()); + action_group->get_action("clear-redo")->set_sensitive(instance->get_redo_status()); + action_group->get_action("clear-undo-and-redo")->set_sensitive(instance->get_undo_status() || instance->get_redo_status()); + } +} + +void +Dock_History::on_undo_tree_changed() +{ + Gtk::TreeModel::Children children(selected_instance->history_tree_store()->children()); + + if (!children.size()) + return; + + studio::HistoryTreeStore::Model model; + + Gtk::TreeModel::Children::iterator iter, prev = children.end(); + for (iter = children.begin(); iter != children.end(); prev = iter++) + if ((*iter)[model.is_redo]) + { + if (prev == children.end()) + action_tree->get_selection()->unselect_all(); + else + { + action_tree->scroll_to_row(Gtk::TreePath(prev), 0.5); + action_tree->get_selection()->select(prev); + } + return; + } + + action_tree->scroll_to_row(Gtk::TreePath(prev), 0.5); + action_tree->get_selection()->select(prev); +} + +void +Dock_History::set_selected_instance_(etl::handle instance) +{ + if(studio::App::shutdown_in_progress) + return; + + if (on_undo_tree_changed_connection) + on_undo_tree_changed_connection.disconnect(); + + selected_instance=instance; + if(instance) + { + on_undo_tree_changed_connection = selected_instance->history_tree_store()->signal_undo_tree_changed().connect( + sigc::mem_fun(*this,&Dock_History::on_undo_tree_changed)); + + action_tree->set_model(instance->history_tree_store()); + action_tree->show(); + update_undo_redo(); + action_group->set_sensitive(true); + } + else + { + action_tree->set_model(Glib::RefPtr< Gtk::TreeModel >()); + action_tree->hide(); + action_group->set_sensitive(false); + } +} + +void +Dock_History::set_selected_instance_signal(etl::handle x) +{ + set_selected_instance(x); +} + +void +Dock_History::set_selected_instance(etl::loose_handle x) +{ + if(studio::App::shutdown_in_progress) + return; + + // if it's already selected, don't select it again + if (x==selected_instance) + return; + + std::list >::iterator iter; + + set_selected_instance_(x); +} + +void +Dock_History::delete_instance(etl::handle instance) +{ + if(studio::App::shutdown_in_progress) + return; + + if(selected_instance==instance) + { + set_selected_instance(0); + } +} + +bool +Dock_History::on_action_event(GdkEvent *event) +{ + studio::HistoryTreeStore::Model model; + switch(event->type) + { + case GDK_BUTTON_PRESS: + case GDK_2BUTTON_PRESS: + { + Gtk::TreeModel::Path path; + Gtk::TreeViewColumn *column; + int cell_x, cell_y; + if(!action_tree->get_path_at_pos( + int(event->button.x),int(event->button.y), // x, y + path, // TreeModel::Path& + column, //TreeViewColumn*& + cell_x,cell_y //int&cell_x,int&cell_y + ) + ) break; + const Gtk::TreeRow row = *(action_tree->get_model()->get_iter(path)); + + //signal_user_click()(event->button.button,row,(ColumnID)column->get_sort_column_id()); + if((ColumnID)column->get_sort_column_id()==COLUMNID_JUMP) + { + etl::handle action(row[model.action]); + try{ + if((bool)row[model.is_undo]) + { + while(get_selected_instance()->undo_action_stack().size() && get_selected_instance()->undo_action_stack().front()!=action) + if(get_selected_instance()->undo()==false) + throw int(); + } + else if((bool)row[model.is_redo]) + { + while(get_selected_instance()->redo_action_stack().size() && get_selected_instance()->undo_action_stack().front()!=action) + if(get_selected_instance()->redo()==false) + throw int(); + } + } + catch(int) + { + return true; + } + } + } + + case GDK_BUTTON_RELEASE: + break; + default: + break; + } + return false; +} + +void +Dock_History::on_action_toggle(const Glib::ustring& path_string) +{ + studio::HistoryTreeStore::Model history_tree_model; + + Gtk::TreePath path(path_string); + + const Gtk::TreeRow row = *(selected_instance->history_tree_store()->get_iter(path)); + + handle action=row[history_tree_model.action]; + + selected_instance->synfigapp::Instance::set_action_status(action,!action->is_active()); +} diff --git a/synfig-studio/src/gui/docks/dock_history.h b/synfig-studio/src/gui/docks/dock_history.h new file mode 100644 index 0000000..70f34dc --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_history.h @@ -0,0 +1,90 @@ +/* === S Y N F I G ========================================================= */ +/*! \file docks/dock_history.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_DIALOG_HISTORY_H +#define __SYNFIG_STUDIO_DIALOG_HISTORY_H + +/* === H E A D E R S ======================================================= */ + +#include "docks/dockable.h" +#include +#include "instance.h" +#include +#include "docks/dock_canvasspecific.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_History : public Dock_CanvasSpecific +{ + Glib::RefPtr action_group; + Gtk::TreeView *action_tree; + + etl::loose_handle selected_instance; + + sigc::connection on_undo_tree_changed_connection; + + void on_undo_tree_changed(); + + void set_selected_instance_(etl::handle x); + + + void set_selected_instance(etl::loose_handle x); + + void set_selected_instance_signal(etl::handle x); + + void delete_instance(etl::handle x); + + Gtk::Widget* create_action_tree(); + +public: + + etl::loose_handle get_selected_instance() { return selected_instance; } + + void clear_undo(); + void clear_redo(); + void clear_undo_and_redo(); + + bool on_action_event(GdkEvent *event); + void on_action_toggle(const Glib::ustring& path); + + void update_undo_redo(); + + Dock_History(); + ~Dock_History(); +protected: + virtual void init_instance_vfunc(etl::loose_handle instance); + +}; // END of Dock_History + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/docks/dock_info.cpp b/synfig-studio/src/gui/docks/dock_info.cpp new file mode 100644 index 0000000..7324e57 --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_info.cpp @@ -0,0 +1,144 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dock_info.cpp +** \brief Dock Info 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 "docks/dock_info.h" +#include "canvasview.h" +#include "workarea.h" + +#include +#include // for gamma_in() +#include + +#include +#include + +#include "general.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +using namespace etl; +using namespace synfig; + +/* === 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 ======================================================= */ + +/* === E N T R Y P O I N T ================================================= */ + +void studio::Dock_Info::on_mouse_move() +{ + Point pos = get_canvas_view()->work_area->get_cursor_pos(); + + Distance xv(pos[0],Distance::SYSTEM_UNITS); + xv.convert(App::distance_system, get_canvas_view()->get_canvas()->rend_desc()); + + Distance yv(pos[1],Distance::SYSTEM_UNITS); + yv.convert(App::distance_system, get_canvas_view()->get_canvas()->rend_desc()); + + //get the color and set the labels + + x.set_text(xv.get_string(3)); + y.set_text(yv.get_string(3)); + + Color c = get_canvas_view()->get_canvas()->get_context().get_color(pos); + float cr = c.get_r(),cg = c.get_g(), cb = c.get_b(); + + if(use_colorspace_gamma()) + { + cr = gamma_in(cr); + cg = gamma_in(cg); + cb = gamma_in(cb); + } + + r.set_text(strprintf("%.1f%%",cr*100)); + g.set_text(strprintf("%.1f%%",cg*100)); + b.set_text(strprintf("%.1f%%",cb*100)); + a.set_text(strprintf("%.1f%%",c.get_a()*100)); +} + +studio::Dock_Info::Dock_Info() +:Dock_CanvasSpecific("info",_("Info"),Gtk::StockID("synfig-info")) +{ + set_use_scrolled(false); + + Gtk::Table *table = manage(new Gtk::Table); + + //pos labels + table->attach(*manage(new Gtk::Label(_("X: "))),0,1,0,2,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); + table->attach(*manage(new Gtk::Label(_("Y: "))),0,1,2,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); + + //pos + table->attach(x,1,2,0,2,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); + table->attach(y,1,2,2,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); + + //separator + table->attach(*manage(new Gtk::VSeparator),2,3,0,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); + + //color label + table->attach(*manage(new Gtk::Label(_("R: "))),3,4,0,1,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); + table->attach(*manage(new Gtk::Label(_("G: "))),3,4,1,2,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); + table->attach(*manage(new Gtk::Label(_("B: "))),3,4,2,3,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); + table->attach(*manage(new Gtk::Label(_("A: "))),3,4,3,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); + + //color + table->attach(r,4,5,0,1,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); + table->attach(g,4,5,1,2,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); + table->attach(b,4,5,2,3,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); + table->attach(a,4,5,3,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); + + table->attach(*manage(new Gtk::Label),0,5,4,5); + + table->show_all(); + + add(*table); +} + +studio::Dock_Info::~Dock_Info() +{ +} + +void studio::Dock_Info::changed_canvas_view_vfunc(etl::loose_handle canvas_view) +{ + mousecon.disconnect(); + + if(canvas_view && canvas_view->get_work_area()) + { + mousecon = get_canvas_view()->work_area->signal_cursor_moved().connect(sigc::mem_fun(*this,&Dock_Info::on_mouse_move)); + } +} diff --git a/synfig-studio/src/gui/docks/dock_info.h b/synfig-studio/src/gui/docks/dock_info.h new file mode 100644 index 0000000..c954932 --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_info.h @@ -0,0 +1,62 @@ +/* === S Y N F I G ========================================================= */ +/*! \file docks/dock_info.h +** \brief Info Dock 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_DOCK_INFO_H +#define __SYNFIG_DOCK_INFO_H + +/* === H E A D E R S ======================================================= */ +#include "docks/dock_canvasspecific.h" +#include "sigc++/signal.h" + +#include "widgets/widget_distance.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_Info : public Dock_CanvasSpecific +{ + Gtk::Label r,g,b,a; + Gtk::Label x,y; + + sigc::connection mousecon; + + void on_mouse_move(); + +public: + Dock_Info(); + ~Dock_Info(); + + virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); +}; + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/docks/dock_keyframes.cpp b/synfig-studio/src/gui/docks/dock_keyframes.cpp new file mode 100644 index 0000000..e741bbf --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_keyframes.cpp @@ -0,0 +1,138 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dock_keyframes.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 "docks/dock_keyframes.h" +#include "app.h" + +#include +#include +#include "instance.h" +#include +#include +#include +#include "keyframetreestore.h" +#include "keyframetree.h" +#include "canvasview.h" +#include "keyframeactionmanager.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_Keyframes::Dock_Keyframes(): + Dock_CanvasSpecific("keyframes",_("Keyframes"),Gtk::StockID("synfig-keyframes")), + action_group(Gtk::ActionGroup::create("action_group_dock_keyframes")), + keyframe_action_manager(new KeyframeActionManager) +{ + keyframe_action_manager->set_ui_manager(App::ui_manager()); + keyframe_action_manager->signal_show_keyframe_properties().connect( + sigc::mem_fun(*this,&Dock_Keyframes::show_keyframe_properties) + ); + + Glib::ustring ui_info = + "" + " " + " " + " " + " " + " " + " " + "" + ; + + App::ui_manager()->add_ui_from_string(ui_info); + + set_toolbar(*dynamic_cast(App::ui_manager()->get_widget("/toolbar-keyframe"))); +} + +Dock_Keyframes::~Dock_Keyframes() +{ +} + +void +Dock_Keyframes::show_keyframe_properties() +{ + if(get_canvas_view()) + get_canvas_view()->show_keyframe_dialog(); +} + +void +Dock_Keyframes::init_canvas_view_vfunc(etl::loose_handle canvas_view) +{ + Glib::RefPtr keyframe_tree_store; + keyframe_tree_store=KeyframeTreeStore::create(canvas_view->canvas_interface()); + + KeyframeTree* keyframe_tree(new KeyframeTree()); + keyframe_tree->set_model(keyframe_tree_store); + keyframe_tree->set_editable(true); + + canvas_view->set_tree_model(get_name(),keyframe_tree_store); + canvas_view->set_ext_widget(get_name(),keyframe_tree); +} + +void +Dock_Keyframes::changed_canvas_view_vfunc(etl::loose_handle canvas_view) +{ + if(canvas_view) + { + Gtk::Widget* tree_view(canvas_view->get_ext_widget(get_name())); + + add(*tree_view); + tree_view->show(); + + keyframe_action_manager->set_keyframe_tree(dynamic_cast(canvas_view->get_ext_widget(get_name()))); + keyframe_action_manager->set_canvas_interface(canvas_view->canvas_interface()); + keyframe_action_manager->refresh(); + } + else + { + clear_previous(); + + keyframe_action_manager->set_keyframe_tree(0); + keyframe_action_manager->set_canvas_interface(0); + keyframe_action_manager->refresh(); + } +} diff --git a/synfig-studio/src/gui/docks/dock_keyframes.h b/synfig-studio/src/gui/docks/dock_keyframes.h new file mode 100644 index 0000000..9818b28 --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_keyframes.h @@ -0,0 +1,79 @@ +/* === S Y N F I G ========================================================= */ +/*! \file docks/dock_keyframes.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_KEYFRAMES_H +#define __SYNFIG_STUDIO_DOCK_KEYFRAMES_H + +/* === H E A D E R S ======================================================= */ + +#include "docks/dockable.h" +#include "docks/dock_canvasspecific.h" +#include +#include "instance.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 studio { + +class KeyframeTreeStore; +class KeyframeTree; + +class KeyframeActionManager; + +class Dock_Keyframes : public Dock_CanvasSpecific +{ + Glib::RefPtr action_group; + + /* + void add_keyframe_pressed(); + void duplicate_keyframe_pressed(); + void delete_keyframe_pressed(); + */ + + void show_keyframe_properties(); + + KeyframeActionManager* keyframe_action_manager; + +protected: + virtual void init_canvas_view_vfunc(etl::loose_handle canvas_view); + virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); + + +public: + + + Dock_Keyframes(); + ~Dock_Keyframes(); +}; // END of Dock_Keyframes + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/docks/dock_layergroups.cpp b/synfig-studio/src/gui/docks/dock_layergroups.cpp new file mode 100644 index 0000000..8306a8e --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_layergroups.cpp @@ -0,0 +1,136 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dock_layergroups.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 "docks/dock_layergroups.h" +#include "app.h" + +#include +#include +#include "instance.h" +#include +#include +#include +#include +#include "canvasview.h" + +#include "layergrouptreestore.h" +#include "layergrouptree.h" +#include "groupactionmanager.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_LayerGroups::Dock_LayerGroups(): + Dock_CanvasSpecific("groups",_("Groups"),Gtk::StockID("synfig-group")), + action_group_group_ops(Gtk::ActionGroup::create("action_group_dock_layergroups")), + group_action_manager(new GroupActionManager) +{ + group_action_manager->set_ui_manager(App::ui_manager()); + + action_group_group_ops->add( Gtk::Action::create("toolbar-groups", _("Group Ops")) ); + + action_group_add=Gtk::Action::create("action-group_add", Gtk::Stock::ADD,_("Add a New Group"),_("Add a New Group")); + action_group_group_ops->add(action_group_add); + action_group_add->set_sensitive(false); + + App::ui_manager()->insert_action_group(action_group_group_ops); + + Glib::ustring ui_info = + "" + " " + " " + " " + " " + "" + ; + + App::ui_manager()->add_ui_from_string(ui_info); + + set_toolbar(*dynamic_cast(App::ui_manager()->get_widget("/toolbar-groups"))); +} + +Dock_LayerGroups::~Dock_LayerGroups() +{ + delete group_action_manager; +} + +void +Dock_LayerGroups::init_canvas_view_vfunc(etl::loose_handle canvas_view) +{ + Glib::RefPtr layer_group_tree_store; + layer_group_tree_store=LayerGroupTreeStore::create(canvas_view->canvas_interface()); + + LayerGroupTree* layer_group_tree(new LayerGroupTree()); + layer_group_tree->set_model(layer_group_tree_store); + layer_group_tree->signal_popup_layer_menu().connect(sigc::mem_fun(*canvas_view,&CanvasView::popup_layer_menu)); + + canvas_view->set_tree_model(get_name(),layer_group_tree_store); + canvas_view->set_ext_widget(get_name(),layer_group_tree); +} + +void +Dock_LayerGroups::changed_canvas_view_vfunc(etl::loose_handle canvas_view) +{ + if(canvas_view) + { + Gtk::Widget* tree_view(canvas_view->get_ext_widget(get_name())); + + add(*tree_view); + tree_view->show(); + + group_action_manager->set_group_tree(dynamic_cast(tree_view)); + group_action_manager->set_canvas_interface(canvas_view->canvas_interface()); + group_action_manager->refresh(); + } + else + { + clear_previous(); + group_action_manager->clear(); + group_action_manager->set_canvas_interface(0); + group_action_manager->set_group_tree(0); + } +} diff --git a/synfig-studio/src/gui/docks/dock_layergroups.h b/synfig-studio/src/gui/docks/dock_layergroups.h new file mode 100644 index 0000000..b9e42bc --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_layergroups.h @@ -0,0 +1,71 @@ +/* === S Y N F I G ========================================================= */ +/*! \file docks/dock_layergroups.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_LAYERGROUPS_H +#define __SYNFIG_STUDIO_DOCK_LAYERGROUPS_H + +/* === H E A D E R S ======================================================= */ + +#include "docks/dockable.h" +#include +#include "instance.h" +#include "docks/dock_canvasspecific.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 Gtk { class HScale; } + +namespace studio { + +class GroupActionManager ; + +class Dock_LayerGroups : public Dock_CanvasSpecific +{ + Glib::RefPtr action_group_group_ops; + Glib::RefPtr action_group_add; + + GroupActionManager *group_action_manager; +protected: + virtual void init_canvas_view_vfunc(etl::loose_handle canvas_view); + virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); + +private: + +public: + + + Dock_LayerGroups(); + ~Dock_LayerGroups(); +}; // END of Dock_LayerGroups + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/docks/dock_layers.cpp b/synfig-studio/src/gui/docks/dock_layers.cpp new file mode 100644 index 0000000..152ffb1 --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_layers.cpp @@ -0,0 +1,295 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dock_layers.cpp +** \brief Template File +** +** $Id$ +** +** \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 +** 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 "docks/dock_layers.h" +#include "app.h" + +#include +#include +#include "instance.h" +#include +#include +#include +#include +#include "layertreestore.h" +#include "layertree.h" +#include "canvasview.h" +#include "layeractionmanager.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 ========================================================= */ + +/* === G L O B A L S ======================================================= */ + +/* === P R O C E D U R E S ================================================= */ + +/*static void do_nothing(reference_counter x) +{ + synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,x.count()); +}*/ + +/* === M E T H O D S ======================================================= */ + +Dock_Layers::Dock_Layers(): + Dock_CanvasSpecific("layers",_("Layers"),Gtk::StockID("synfig-layer")), + layer_action_manager(new LayerActionManager) +{ + if(layer_action_manager)layer_action_manager->set_ui_manager(App::ui_manager()); + + action_group_new_layers=Gtk::ActionGroup::create("action_group_new_layers"); + action_group_layer_ops=Gtk::ActionGroup::create("action_group_layer_ops"); + + std::map category_map; + + // Build layer creation actions + synfig::Layer::Book::iterator iter; + for(iter=synfig::Layer::book().begin();iter!=synfig::Layer::book().end();++iter) + { + synfig::Layer::Book::value_type lyr(*iter); + + if(lyr.second.category==CATEGORY_DO_NOT_USE) + continue; + + action_group_new_layers->add(Gtk::Action::create( + strprintf("layer-new-%s",lyr.first.c_str()), + layer_icon(lyr.first.c_str()), + lyr.second.local_name,lyr.second.local_name + ), + sigc::hide_return( + sigc::bind( + sigc::mem_fun(*this,&studio::Dock_Layers::add_layer), + lyr.first + ) + ) + ); + + category_map[lyr.second.category]+=strprintf("",lyr.first.c_str()); + + //(*category_map)[lyr.second.category]->items().push_back(Gtk::Menu_Helpers::MenuElem(lyr.second.local_name, + //)); + } + + { + Glib::RefPtr action_group_categories(Gtk::ActionGroup::create("layer-category")); + synfig::String layer_ui_info; + + layer_ui_info+=""; + + std::map::iterator iter; + for(iter=category_map.begin();iter!=category_map.end();++iter) + { + layer_ui_info+=strprintf("%s",iter->first.c_str(),iter->second.c_str()); + action_group_categories->add(Gtk::Action::create(iter->first.c_str(),dgettext("synfig", iter->first.c_str()))); + } + + layer_ui_info+=""; + + App::ui_manager()->insert_action_group(action_group_categories); + App::ui_manager()->insert_action_group(action_group_new_layers); + + try + { + App::ui_manager()->add_ui_from_string(layer_ui_info); + } + catch(Glib::MarkupError x) + { + error("%s:%d caught MarkupError code %d: %s", __FILE__, __LINE__, x.code(), x.what().c_str()); + error("%s:%d with markup: \"%s\"", __FILE__, __LINE__, layer_ui_info.c_str()); + exit(1); + } + } + + if(layer_action_manager) + action_group_layer_ops->add(layer_action_manager->get_action_select_all_child_layers()); + + action_group_layer_ops->add( Gtk::Action::create("toolbar-layer", _("Layer Ops")) ); + App::ui_manager()->insert_action_group(action_group_layer_ops); + + Glib::ustring ui_info = + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + "" + ; + + App::ui_manager()->add_ui_from_string(ui_info); + + action_group_new_layers->set_sensitive(false); + + set_toolbar(*dynamic_cast(App::ui_manager()->get_widget("/toolbar-layer"))); + + + + + + /* + reference_counter ref_count; + synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); + + { + sigc::signal tmp_signal; + + tmp_signal.connect( + sigc::bind( + sigc::ptr_fun(do_nothing), + ref_count + ) + ); + + synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); + tmp_signal(); + synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); + + tmp_signal.clear(); + synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); + + tmp_signal(); + synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); + tmp_signal.connect( + sigc::bind( + sigc::ptr_fun(do_nothing), + ref_count + ) + ); + synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); + } + synfig::info(__FILE__":%d:ref_count.count()=%d",__LINE__,ref_count.count()); + assert(ref_count.count()==1); + */ +} + + +Dock_Layers::~Dock_Layers() +{ + delete layer_action_manager; +} + + +void +Dock_Layers::init_canvas_view_vfunc(etl::loose_handle canvas_view) +{ + Glib::RefPtr layer_tree_store; + layer_tree_store=LayerTreeStore::create(canvas_view->canvas_interface()); + + canvas_view->set_tree_model(get_name(),layer_tree_store); + LayerTree* layer_tree(new LayerTree()); + layer_tree->set_time_adjustment(canvas_view->time_adjustment()); + + layer_tree->signal_edited_value().connect( + sigc::hide_return( + sigc::mem_fun(*canvas_view->canvas_interface(), &synfigapp::CanvasInterface::change_value) + ) + ); + + // (a) should be before (b), (b) should be before (c) + canvas_view->set_ext_widget(get_name()+"_cmp",layer_tree); // (a) + canvas_view->set_ext_widget(get_name(),&layer_tree->get_layer_tree_view()); + canvas_view->set_ext_widget("params",&layer_tree->get_param_tree_view()); + + layer_tree->set_model(layer_tree_store); // (b) + canvas_view->set_tree_model("params",layer_tree->get_param_tree_view().get_model()); // (c) + + /* + canvas_view->layermenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-delete"),Gtk::AccelKey("Delete"), + sigc::mem_fun(*layer_tree, &LayerTree::on_delete_pressed)) + ); + */ + + // Hide the time bar + if(canvas_view->get_canvas()->rend_desc().get_time_start()==canvas_view->get_canvas()->rend_desc().get_time_end()) + canvas_view->hide_timebar(); + layer_tree_store->rebuild(); + present(); +} + +void +Dock_Layers::changed_canvas_view_vfunc(etl::loose_handle canvas_view) +{ + if(canvas_view) + { + Gtk::Widget* tree_view(canvas_view->get_ext_widget(get_name())); + + add(*tree_view); + tree_view->show(); + action_group_new_layers->set_sensitive(true); + if(layer_action_manager) + { + layer_action_manager->set_layer_tree(dynamic_cast(canvas_view->get_ext_widget(get_name()+"_cmp"))); + layer_action_manager->set_canvas_interface(canvas_view->canvas_interface()); + layer_action_manager->refresh(); + } + } + else + { + action_group_new_layers->set_sensitive(false); + if(layer_action_manager) + { + layer_action_manager->clear(); + layer_action_manager->set_canvas_interface(0); + layer_action_manager->set_layer_tree(0); + } + + clear_previous(); + } +} + +void +Dock_Layers::add_layer(synfig::String id) +{ + etl::loose_handle canvas_view(get_canvas_view()); + if(canvas_view) + { + canvas_view->add_layer(id); + } +} diff --git a/synfig-studio/src/gui/docks/dock_layers.h b/synfig-studio/src/gui/docks/dock_layers.h new file mode 100644 index 0000000..0f00f92 --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_layers.h @@ -0,0 +1,79 @@ +/* === S Y N F I G ========================================================= */ +/*! \file docks/dock_layers.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_LAYERS_H +#define __SYNFIG_STUDIO_DOCK_LAYERS_H + +/* === H E A D E R S ======================================================= */ + +#include "docks/dockable.h" +#include +#include "instance.h" +#include "docks/dock_canvasspecific.h" +#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 Gtk { class HScale; } + +namespace studio { + +class LayerActionManager; + +class Dock_Layers : public Dock_CanvasSpecific +{ + Glib::RefPtr action_group_new_layers; + Glib::RefPtr action_group_layer_ops; + + Gtk::HScale *layer_amount_hscale; + + LayerActionManager* layer_action_manager; + +protected: + virtual void init_canvas_view_vfunc(etl::loose_handle canvas_view); + virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); + +private: + + void add_layer(synfig::String id); + void increase_amount(); + void decrease_amount(); + +public: + + + Dock_Layers(); + ~Dock_Layers(); +}; // END of Dock_Layers + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/docks/dock_metadata.cpp b/synfig-studio/src/gui/docks/dock_metadata.cpp new file mode 100644 index 0000000..5fe09f9 --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_metadata.cpp @@ -0,0 +1,144 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dock_metadata.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 "docks/dock_metadata.h" +#include "app.h" + +#include +#include +#include "instance.h" +#include +#include +#include +#include "metadatatreestore.h" +#include "canvasview.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_MetaData::Dock_MetaData(): + Dock_CanvasSpecific("meta_data",_("Canvas MetaData"),Gtk::StockID("synfig-meta_data")), + tree_view(manage(new Gtk::TreeView())) +{ + MetaDataTreeStore::Model model; + + tree_view->append_column(_("Key"),model.key); + tree_view->append_column_editable(_("Data"),model.data); + tree_view->set_rules_hint(); + + Gtk::ScrolledWindow *scrolledwindow = manage(new class Gtk::ScrolledWindow()); + scrolledwindow->set_flags(Gtk::CAN_FOCUS); + scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + scrolledwindow->add(*tree_view); + scrolledwindow->set_shadow_type(Gtk::SHADOW_ETCHED_IN); + scrolledwindow->show(); + + add(*scrolledwindow); + + add_button( + Gtk::StockID("gtk-add"), + _("Add new MetaData entry") + )->signal_clicked().connect( + sigc::mem_fun( + *this, + &Dock_MetaData::on_add_pressed + ) + ); + + add_button( + Gtk::StockID("gtk-delete"), + _("Remove selected MetaData entry") + )->signal_clicked().connect( + sigc::mem_fun( + *this, + &Dock_MetaData::on_delete_pressed + ) + ); +} + +Dock_MetaData::~Dock_MetaData() +{ +} + +void +Dock_MetaData::init_canvas_view_vfunc(etl::loose_handle canvas_view) +{ + canvas_view->set_tree_model(get_name(),MetaDataTreeStore::create(canvas_view->canvas_interface())); +} + +void +Dock_MetaData::changed_canvas_view_vfunc(etl::loose_handle canvas_view) +{ + if(canvas_view) + { + tree_view->set_model(canvas_view->get_tree_model(get_name())); + tree_view->show(); + } + else + { + tree_view->set_model(Glib::RefPtr()); + tree_view->hide(); + } +} + +void +Dock_MetaData::on_add_pressed() +{ + if(get_canvas_interface()) + { + synfig::String key; + if(App::dialog_entry(_("New MetaData Entry"), _("Please enter the name of the key"),key) && !key.empty()) + { + get_canvas_interface()->set_meta_data(key," "); + } + } +} + +void +Dock_MetaData::on_delete_pressed() +{ +} diff --git a/synfig-studio/src/gui/docks/dock_metadata.h b/synfig-studio/src/gui/docks/dock_metadata.h new file mode 100644 index 0000000..f6ef500 --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_metadata.h @@ -0,0 +1,71 @@ +/* === S Y N F I G ========================================================= */ +/*! \file docks/dock_metadata.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_METADATA_H +#define __SYNFIG_STUDIO_DOCK_METADATA_H + +/* === H E A D E R S ======================================================= */ + +#include "docks/dockable.h" +#include +#include "instance.h" +#include "docks/dock_canvasspecific.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 CanvasView; +class Instance; + +class Dock_MetaData : public Dock_CanvasSpecific +{ + + Gtk::TreeView *tree_view; + + + void on_add_pressed(); + void on_delete_pressed(); + +protected: + + virtual void init_canvas_view_vfunc(etl::loose_handle canvas_view); + virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); + +public: + + + Dock_MetaData(); + ~Dock_MetaData(); +}; // END of Dock_MetaData + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/docks/dock_navigator.cpp b/synfig-studio/src/gui/docks/dock_navigator.cpp new file mode 100644 index 0000000..51d86e6 --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_navigator.cpp @@ -0,0 +1,522 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dock_navigator.cpp +** \brief Dock Nagivator 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 "docks/dock_navigator.h" +#include "canvasview.h" +#include "workarea.h" + +#include +#include +#include +#include +#include + +#include + +#include "asyncrenderer.h" + +#include "general.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +using namespace etl; +using namespace synfig; + +/* === M A C R O S ========================================================= */ + +const double log_10_2 = log(2.0); + +/* === G L O B A L S ======================================================= */ + +/* === P R O C E D U R E S ================================================= */ + +/* === M E T H O D S ======================================================= */ + +/* === E N T R Y P O I N T ================================================= */ +studio::Widget_NavView::Widget_NavView(CanvasView::LooseHandle cv) +:canvview(cv), +adj_zoom(0,-4,4,1,2), +scrolling(false), +surface(new synfig::Surface) +{ + attach(drawto,0,4,0,1); + + attach(*manage(new Gtk::HSeparator),0,4,1,2,Gtk::SHRINK|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); + + //zooming stuff + attach(zoom_print,0,1,2,3,Gtk::SHRINK|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); + zoom_print.set_size_request(40,-1); + + Gtk::HScale *s = manage(new Gtk::HScale(adj_zoom)); + s->set_draw_value(false); + //s->set_update_policy(Gtk::UPDATE_DELAYED); + //s->signal_event().connect(sigc::mem_fun(*this,&Dock_Navigator::on_scroll_event)); + attach(*s,1,4,2,3,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL); + + show_all(); + + adj_zoom.signal_value_changed().connect(sigc::mem_fun(*this,&Widget_NavView::on_number_modify)); + + if(cv) + { + drawto.signal_expose_event().connect(sigc::mem_fun(*this,&Widget_NavView::on_expose_draw)); + drawto.signal_event().connect(sigc::mem_fun(*this,&Widget_NavView::on_mouse_event)); + + drawto.add_events(Gdk::BUTTON_MOTION_MASK|Gdk::BUTTON_PRESS_MASK); + + //get_canvas_view()->canvas_interface()->signal_dirty_preview() + // .connect(sigc::mem_fun(*this,&Widget_NavView::on_dirty_preview)); + get_canvas_view()->work_area->signal_rendering() + .connect(sigc::mem_fun(*this,&Widget_NavView::on_dirty_preview)); + + get_canvas_view()->work_area->signal_view_window_changed() + .connect(sigc::mem_fun(*this,&Widget_NavView::on_workarea_view_change)); + + //update with this canvas' view + on_workarea_view_change(); + + dirty = true; + queue_draw(); + } + + adj_zoom.set_value(0); +} + +studio::Widget_NavView::~Widget_NavView() +{ +} + + +static void freegu8(const guint8 *p) +{ + delete [] p; +} + +void studio::Widget_NavView::on_start_render() +{ + if(dirty) + { + //synfig::warning("Nav: Starting render"); + //synfig::warning("Nav: Rendering canvas"); + etl::handle targ = surface_target(surface.get()); + + targ->set_canvas(get_canvas_view()->get_canvas()); + targ->set_remove_alpha(); + targ->set_avoid_time_sync(); + targ->set_quality(get_canvas_view()->get_work_area()->get_quality()); + //synfig::info("Set the quality level to: %d", get_canvas_view()->get_work_area()->get_quality()); + + //this should set it to render a single frame + RendDesc r = get_canvas_view()->get_canvas()->rend_desc(); + r.set_time(get_canvas_view()->canvas_interface()->get_time()); + + //this changes the size of the canvas to the closest thing we can find + int sw = r.get_w(), sh = r.get_h(); + + //synfig::warning("Nav: source image is %d x %d", sw,sh); + + //resize so largest dimension is 128 + int dw = sw > sh ? 128 : sw*128/sh, + dh = sh > sw ? 128 : sh*128/sw; + + //synfig::warning("Nav: dest image is %d x %d", dw,dh); + + r.set_w(dw); + r.set_h(dh); + + //get the pw and ph + //float pw = r.get_pw(); + //float ph = r.get_ph(); + //synfig::warning("Nav: pixel size is %f x %f", pw,ph); + + //this renders that single frame + targ->set_rend_desc(&r); + + //synfig::warning("Nav: Building async renderer and starting it..."); + + renderer = new AsyncRenderer(targ); + renderer->signal_success().connect(sigc::mem_fun(*this,&Widget_NavView::on_finish_render)); + dirty = false; + renderer->start(); + } +} + +void studio::Widget_NavView::on_finish_render() +{ + //convert it into our pixmap + PixelFormat pf(PF_RGB); + + //synfig::warning("Nav: It hath succeeded!!!"); + + //assert(renderer && renderer->has_success()); + //synfig::warning("Nav: now we know it really succeeded"); + if(!*surface) + { + synfig::warning("dock_navigator: Bad surface"); + return; + } + + int w = 0, h = 0; + int dw = surface->get_w(); + int dh = surface->get_h(); + + if(prev) + { + w = prev->get_width(); + h = prev->get_height(); + } + + if(w != dw || h != dh || !prev) + { + const int total_bytes(dw*dh*synfig::channels(pf)); + + //synfig::warning("Nav: Updating the pixbuf to be the right size, etc. (%d bytes)", total_bytes); + + prev.clear(); + guint8 *bytes = new guint8[total_bytes]; //24 bits per pixel + + //convert into our buffered dataS + //synfig::warning("Nav: converting color format into buffer"); + convert_color_format((unsigned char *)bytes, (*surface)[0], dw*dh, pf, App::gamma); + + prev = + Gdk::Pixbuf::create_from_data( + bytes, // pointer to the data + Gdk::COLORSPACE_RGB, // the colorspace + ((pf&PF_A)==PF_A), // has alpha? + 8, // bits per sample + dw, // width + dh, // height + dw*synfig::channels(pf), // stride (pitch) + sigc::ptr_fun(freegu8) + ); + } + else + { + //synfig::warning("Nav: Don't need to resize"); + //convert into our buffered dataS + //synfig::warning("Nav: converting color format into buffer"); + if(prev) //just in case we're stupid + { + convert_color_format((unsigned char *)prev->get_pixels(), (*surface)[0], dw*dh, pf, App::gamma); + } + } + queue_draw(); +} + +/* zoom slider is on exponential scale + + map: -4,4 -> small number,1600 with 100 at 0 + + f(x) = 100*2^x +*/ + +static double unit_to_zoom(double f) +{ + return pow(2.0,f); +} + +static double zoom_to_unit(double f) +{ + if(f > 0) + { + return log(f) / log_10_2; + }else return -999999.0; +} + +bool studio::Widget_NavView::on_expose_draw(GdkEventExpose */*exp*/) +{ +#ifdef SINGLE_THREADED + // don't redraw if the previous redraw is still running single-threaded + // or we end up destroying the renderer that's rendering it + if (App::single_threaded && renderer && renderer->updating) + return false; +#endif + + //print out the zoom + //HACK kind of... + //zoom_print.set_text(strprintf("%.1f%%",100*unit_to_zoom(adj_zoom.get_value()))); + + //draw the good stuff + on_start_render(); + + //if we've got a preview etc. display it... + if(get_canvas_view() && prev) + { + //axis transform from units to pixel coords + float xaxis = 0, yaxis = 0; + + int canvw = get_canvas_view()->get_canvas()->rend_desc().get_w(); + //int canvh = get_canvas_view()->get_canvas()->rend_desc().get_h(); + + float pw = get_canvas_view()->get_canvas()->rend_desc().get_pw(); + float ph = get_canvas_view()->get_canvas()->rend_desc().get_ph(); + + int w = prev->get_width(); + int h = prev->get_height(); + + //scale up/down to the nearest pixel ratio... + //and center in center + int offx=0, offy=0; + + float sx, sy; + int nw,nh; + + sx = drawto.get_width() / (float)w; + sy = drawto.get_height() / (float)h; + + //synfig::warning("Nav redraw: now to scale the bitmap: %.3f x %.3f",sx,sy); + + //round to smallest scale (fit entire thing in window without distortion) + if(sx > sy) sx = sy; + //else sy = sx; + + //scaling and stuff + // the point to navpixel space conversion should be: + // (navpixels / canvpixels) * (canvpixels / canvsize) + // or (navpixels / prevpixels) * (prevpixels / navpixels) + xaxis = sx * w / (float)canvw; + yaxis = xaxis/ph; + xaxis /= pw; + + //scale to a new pixmap and then copy over to the window + nw = (int)(w*sx); + nh = (int)(h*sx); + + //must now center to be cool + offx = (drawto.get_width() - nw)/2; + offy = (drawto.get_height() - nh)/2; + + //trivial escape + if(nw == 0 || nh == 0)return true; + + //draw to drawing area + Glib::RefPtr gc = Gdk::GC::create(drawto.get_window()); + + //synfig::warning("Nav: Scaling pixmap to off (%d,%d) with size (%d,%d)", offx,offy,nw, nh); + Glib::RefPtr scalepx = prev->scale_simple(nw,nh,Gdk::INTERP_NEAREST); + + //synfig::warning("Nav: Drawing scaled bitmap"); + drawto.get_window()->draw_pixbuf( + gc, //GC + scalepx, //pixbuf + 0, 0, // Source X and Y + offx, offy, // Dest X and Y + -1,-1, // Width and Height + Gdk::RGB_DITHER_MAX, // RgbDither + 2, 2 // Dither offset X and Y + ); + + //draw fancy red rectangle around focus point + const Point &wtl = get_canvas_view()->work_area->get_window_tl(), + &wbr = get_canvas_view()->work_area->get_window_br(); + + gc->set_rgb_fg_color(Gdk::Color("#ff0000")); + gc->set_line_attributes(2,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER); + + //it must be clamped to the drawing area though + int l=0,rw=0,t=0,rh=0; + const Point fp = -get_canvas_view()->work_area->get_focus_point(); + + //get focus point in normal space + rw = (int)(abs((wtl[0]-wbr[0])*xaxis)); + rh = (int)(abs((wtl[1]-wbr[1])*yaxis)); + + //transform into pixel space + l = (int)(drawto.get_width()/2 + fp[0]*xaxis - rw/2); + t = (int)(drawto.get_height()/2 + fp[1]*yaxis - rh/2); + + //coord system: + // tl : (offx,offy) + // axis multipliers = xaxis,yaxis + //synfig::warning("Nav: tl (%f,%f), br (%f,%f)", wtl[0],wtl[1],wbr[0],wbr[1]); + //synfig::warning("Nav: tl (%f,%f), br (%f,%f)", wtl[0],wtl[1],wbr[0],wbr[1]); + //synfig::warning("Nav: Drawing Rectangle (%d,%d) with dim (%d,%d)", l,t,rw,rh); + drawto.get_window()->draw_rectangle(gc,false,l,t,rw,rh); + } + + return false; //draw everything else too +} + +void studio::Widget_NavView::on_dirty_preview() +{ + dirty = true; + queue_draw(); +} + +bool studio::Widget_NavView::on_scroll_event(GdkEvent *event) +{ + if(get_canvas_view() && get_canvas_view()->get_work_area()) + { + double z = unit_to_zoom(adj_zoom.get_value()); + + switch(event->type) + { + case GDK_BUTTON_PRESS: + { + if(event->button.button == 1) + { + scrolling = true; + get_canvas_view()->get_work_area()->set_zoom(z); + scrolling = false; + } + break; + } + + case GDK_MOTION_NOTIFY: + { + if(Gdk::ModifierType(event->motion.state) & Gdk::BUTTON1_MASK) + { + scrolling = true; + get_canvas_view()->get_work_area()->set_zoom(z); + scrolling = false; + } + break; + } + + default: + break; + } + } + + return false; +} + +void studio::Widget_NavView::on_number_modify() +{ + double z = unit_to_zoom(adj_zoom.get_value()); + zoom_print.set_text(strprintf("%.1f%%",z*100.0)); + //synfig::warning("Updating zoom to %f",adj_zoom.get_value()); + + if(get_canvas_view() && z != get_canvas_view()->get_work_area()->get_zoom()) + { + scrolling = true; + get_canvas_view()->get_work_area()->set_zoom(z); + scrolling = false; + } +} + +void studio::Widget_NavView::on_workarea_view_change() +{ + double wz = get_canvas_view()->get_work_area()->get_zoom(); + double z = zoom_to_unit(wz); + + //synfig::warning("Updating zoom to %f -> %f",wz,z); + if(!scrolling && z != adj_zoom.get_value()) + { + adj_zoom.set_value(z); + //adj_zoom.value_changed(); + } + queue_draw(); +} + +bool studio::Widget_NavView::on_mouse_event(GdkEvent * e) +{ + Point p; + bool setpos = false; + + if(e->type == GDK_BUTTON_PRESS && e->button.button == 1) + { + p[0] = e->button.x - drawto.get_width()/2; + p[1] = e->button.y - drawto.get_height()/2; + + setpos = true; + } + + if(e->type == GDK_MOTION_NOTIFY && (Gdk::ModifierType(e->motion.state) & Gdk::BUTTON1_MASK)) + { + p[0] = e->motion.x - drawto.get_width()/2; + p[1] = e->motion.y - drawto.get_height()/2; + + setpos = true; + } + + if(setpos && prev && get_canvas_view()) + { + const Point &tl = get_canvas_view()->get_canvas()->rend_desc().get_tl(); + const Point &br = get_canvas_view()->get_canvas()->rend_desc().get_br(); + + float max = abs((br[0]-tl[0]) / drawto.get_width()); + + if((float(prev->get_width()) / drawto.get_width()) < (float(prev->get_height()) / drawto.get_height())) + max = abs((br[1]-tl[1]) / drawto.get_height()); + + float signx = (br[0]-tl[0]) < 0 ? -1 : 1; + float signy = (br[1]-tl[1]) < 0 ? -1 : 1; + + Point pos; + + pos[0] = p[0] * max * signx; + pos[1] = p[1] * max * signy; + + get_canvas_view()->get_work_area()->set_focus_point(-pos); + + return true; + } + + return false; +} + +//Navigator Dock Definitions + +studio::Dock_Navigator::Dock_Navigator() +:Dock_CanvasSpecific("navigator",_("Navigator"),Gtk::StockID("synfig-navigator")) +{ + add(dummy); +} + +studio::Dock_Navigator::~Dock_Navigator() +{ +} + +void studio::Dock_Navigator::changed_canvas_view_vfunc(etl::loose_handle canvas_view) +{ + if(canvas_view) + { + Widget *v = canvas_view->get_ext_widget("navview"); + + if(!v) + { + v = new Widget_NavView(canvas_view); + canvas_view->set_ext_widget("navview",v); + } + + add(*v); + }else + { + clear_previous(); + //add(dummy); + } +} diff --git a/synfig-studio/src/gui/docks/dock_navigator.h b/synfig-studio/src/gui/docks/dock_navigator.h new file mode 100644 index 0000000..4100af1 --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_navigator.h @@ -0,0 +1,121 @@ +/* === S Y N F I G ========================================================= */ +/*! \file docks/dock_navigator.h +** \brief Navigator Dock 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_DOCK_NAVIGATOR_H +#define __SYNFIG_DOCK_NAVIGATOR_H + +/* === H E A D E R S ======================================================= */ +#include "sigc++/signal.h" + +#include +#include +#include +#include + +#include + +#include "canvasview.h" +#include "docks/dock_canvasspecific.h" +#include "widgets/widget_distance.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 studio { +class AsyncRenderer; + +class Widget_NavView : public Gtk::Table +{ + //handle to out parent canvas + CanvasView::LooseHandle canvview; + + Glib::RefPtr prev; + bool dirty; + + //The drawing stuff + Gtk::DrawingArea drawto; + + //The input stuff + Gtk::Adjustment adj_zoom; + Gtk::Label zoom_print; + + //zoom window stuff + bool scrolling; + + //asynchronous rendering stuff + etl::handle renderer; + etl::smart_ptr surface; + bool rendering; + + //drawing functionality + void on_start_render(); //breaks out into asynchronous rendering + void on_finish_render(); + void on_draw(); //renders the small thing we have + void on_dirty_preview(); //dirties the preview for rerender + + //for the zoom buttons + void on_zoom_in(); + void on_zoom_out(); + + //handles the zoom scroller + bool on_scroll_event(GdkEvent *event); + void on_number_modify(); + + // + bool on_mouse_event(GdkEvent * e); + + //draws the gotten bitmap on the draw area + bool on_expose_draw(GdkEventExpose *exp=0); + + //for when the canvasview view changes (boolean value scrolling solves cyclic problems) + void on_workarea_view_change(); + +public: + Widget_NavView(CanvasView::LooseHandle cv = CanvasView::LooseHandle()); + ~Widget_NavView(); + + etl::loose_handle get_canvas_view() {return canvview;} +}; + +class Dock_Navigator : public Dock_CanvasSpecific +{ + Widget_NavView dummy; + +public: + Dock_Navigator(); + ~Dock_Navigator(); + + virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); +}; + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/docks/dock_params.cpp b/synfig-studio/src/gui/docks/dock_params.cpp new file mode 100644 index 0000000..79b965e --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_params.cpp @@ -0,0 +1,126 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dock_params.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 "docks/dock_params.h" +#include "app.h" + +#include +#include +#include "instance.h" +#include +#include +#include +#include "canvasview.h" +#include "layerparamtreestore.h" +#include "workarea.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_Params::Dock_Params(): + Dock_CanvasSpecific("params",_("Params"),Gtk::Stock::INDEX/*Gtk::StockID("synfig-params")*/), + action_group(Gtk::ActionGroup::create("action_group_dock_params")) +{ +} + +Dock_Params::~Dock_Params() +{ +} + + +void +Dock_Params::init_canvas_view_vfunc(etl::loose_handle canvas_view) +{ + Gtk::TreeView* tree_view( + static_cast(canvas_view->get_ext_widget(get_name())) + ); + + if(tree_view) + { + tree_view->get_selection()->signal_changed().connect( + sigc::mem_fun( + *this, + &Dock_Params::refresh_selected_param + ) + ); + } +} + +void +Dock_Params::refresh_selected_param() +{ + Gtk::TreeView* tree_view( + static_cast(get_canvas_view()->get_ext_widget(get_name())) + ); + Gtk::TreeModel::iterator iter(tree_view->get_selection()->get_selected()); + + if(iter) + { + LayerParamTreeStore::Model model; + get_canvas_view()->work_area->set_selected_value_node( + (synfig::ValueNode::Handle)(*iter)[model.value_node] + ); + } + else + { + get_canvas_view()->work_area->set_selected_value_node(0); + } +} + +void +Dock_Params::changed_canvas_view_vfunc(etl::loose_handle canvas_view) +{ + if(canvas_view) + { + Gtk::Widget* tree_view(canvas_view->get_ext_widget(get_name())); + + add(*tree_view); + tree_view->show(); + show_all(); + } + else clear_previous(); +} diff --git a/synfig-studio/src/gui/docks/dock_params.h b/synfig-studio/src/gui/docks/dock_params.h new file mode 100644 index 0000000..c7d0168 --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_params.h @@ -0,0 +1,64 @@ +/* === S Y N F I G ========================================================= */ +/*! \file docks/dock_params.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_PARAMS_H +#define __SYNFIG_STUDIO_DOCK_PARAMS_H + +/* === H E A D E R S ======================================================= */ + +#include "docks/dockable.h" +#include +#include "instance.h" +#include "docks/dock_canvasspecific.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_Params : public Dock_CanvasSpecific +{ + Glib::RefPtr action_group; + +protected: + virtual void init_canvas_view_vfunc(etl::loose_handle canvas_view); + virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); + + void refresh_selected_param(); + +public: + + + Dock_Params(); + ~Dock_Params(); +}; // END of Dock_Keyframes + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/docks/dock_timetrack.cpp b/synfig-studio/src/gui/docks/dock_timetrack.cpp new file mode 100644 index 0000000..61ba14d --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_timetrack.cpp @@ -0,0 +1,494 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dock_timetrack.cpp +** \brief Template File +** +** $Id$ +** +** \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 +** 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 "docks/dock_timetrack.h" +#include "app.h" + +#include +#include +#include "instance.h" +#include +#include +#include +#include "canvasview.h" +#include "layerparamtreestore.h" +#include "workarea.h" +#include "widgets/widget_timeslider.h" +#include "widgets/widget_keyframe_list.h" +#include "layerparamtreestore.h" +#include "general.h" +#include + +#endif + +/* === U S I N G =========================================================== */ + +using namespace std; +using namespace etl; +using namespace synfig; +using namespace studio; + +/* === M A C R O S ========================================================= */ + +/* === C L A S S E S ======================================================= */ + +class TimeTrackView : public Gtk::TreeView +{ + CellRenderer_TimeTrack *cellrenderer_time_track; + + Glib::RefPtr param_tree_store_; + + Gtk::TreeView *mimic_tree_view; +public: + + sigc::signal >,int> signal_waypoint_clicked_timetrackview; + + LayerParamTreeStore::Model model; + + void set_canvas_view(handle canvas_view) + { + cellrenderer_time_track->set_adjustment(canvas_view->time_adjustment()); + } + + TimeTrackView() + { + int label_index(append_column_editable(_("Name"),model.label)); + Gtk::TreeView::Column* label_column = get_column(label_index-1); + + { // --- T I M E T R A C K -------------------------------------------- + Gtk::TreeView::Column* column = Gtk::manage( new Gtk::TreeView::Column(_("Time Track")) ); + + // Set up the value-node cell-renderer + cellrenderer_time_track=LayerParamTreeStore::add_cell_renderer_value_node(column); + cellrenderer_time_track->property_mode()=Gtk::CELL_RENDERER_MODE_ACTIVATABLE; + cellrenderer_time_track->signal_waypoint_clicked_cellrenderer().connect(sigc::mem_fun(*this, &TimeTrackView::on_waypoint_clicked_timetrackview)); + cellrenderer_time_track->signal_waypoint_changed().connect(sigc::mem_fun(*this, &TimeTrackView::on_waypoint_changed) ); + column->add_attribute(cellrenderer_time_track->property_value_desc(), model.value_desc); + column->add_attribute(cellrenderer_time_track->property_canvas(), model.canvas); + //column->add_attribute(cellrenderer_time_track->property_visible(), model.is_value_node); + + //column->pack_start(*cellrenderer_time_track); + + // Finish setting up the column + column->set_reorderable(); + column->set_resizable(); + column->set_min_width(200); + + append_column(*column); + } + set_rules_hint(); + + set_expander_column(*label_column); + label_column->set_visible(false); + set_headers_visible(false); + set_size_request(-1,64); + } + + bool + on_event(GdkEvent *event) + { + switch(event->type) + { + case GDK_SCROLL: + if(mimic_tree_view) + { + if(event->scroll.direction==GDK_SCROLL_DOWN) + { + mimic_tree_view->get_vadjustment()->set_value( + std::min( + mimic_tree_view->get_vadjustment()->get_value()+ + mimic_tree_view->get_vadjustment()->get_step_increment(), + mimic_tree_view->get_vadjustment()->get_upper()- + mimic_tree_view->get_vadjustment()->get_page_size() + ) + ); + mimic_tree_view->get_vadjustment()->value_changed(); + } + else if(event->scroll.direction==GDK_SCROLL_UP) + { + mimic_tree_view->get_vadjustment()->set_value( + std::max( + mimic_tree_view->get_vadjustment()->get_value()- + mimic_tree_view->get_vadjustment()->get_step_increment(), + mimic_tree_view->get_vadjustment()->get_lower() + ) + ); + mimic_tree_view->get_vadjustment()->value_changed(); + } + } + break; + case GDK_BUTTON_PRESS: + { + Gtk::TreeModel::Path path; + Gtk::TreeViewColumn *column; + int cell_x, cell_y; + if(!get_path_at_pos( + int(event->button.x),int(event->button.y), // x, y + path, // TreeModel::Path& + column, //TreeViewColumn*& + cell_x,cell_y //int&cell_x,int&cell_y + ) + ) break; + const Gtk::TreeRow row = *(get_model()->get_iter(path)); + + if(column && column->get_first_cell_renderer()==cellrenderer_time_track) + { + Gdk::Rectangle rect; + get_cell_area(path,*column,rect); + cellrenderer_time_track->property_value_desc()=row[model.value_desc]; + cellrenderer_time_track->property_canvas()=row[model.canvas]; + cellrenderer_time_track->activate(event,*this,path.to_string(),rect,rect,Gtk::CellRendererState()); + queue_draw_area(rect.get_x(),rect.get_y(),rect.get_width(),rect.get_height()); + return true; + //return signal_param_user_click()(event->button.button,row,COLUMNID_TIME_TRACK); + } + } + break; + + case GDK_MOTION_NOTIFY: + { + Gtk::TreeModel::Path path; + Gtk::TreeViewColumn *column; + int cell_x, cell_y; + if(!get_path_at_pos( + (int)event->motion.x,(int)event->motion.y, // x, y + path, // TreeModel::Path& + column, //TreeViewColumn*& + cell_x,cell_y //int&cell_x,int&cell_y + ) + ) break; + + if(!get_model()->get_iter(path)) + break; + + Gtk::TreeRow row = *(get_model()->get_iter(path)); + + if ((event->motion.state&GDK_BUTTON1_MASK || event->motion.state&GDK_BUTTON3_MASK) && + column && + cellrenderer_time_track == column->get_first_cell_renderer()) + { + Gdk::Rectangle rect; + get_cell_area(path,*column,rect); + cellrenderer_time_track->property_value_desc()=row[model.value_desc]; + cellrenderer_time_track->property_canvas()=row[model.canvas]; + cellrenderer_time_track->activate(event,*this,path.to_string(),rect,rect,Gtk::CellRendererState()); + queue_draw(); + //queue_draw_area(rect.get_x(),rect.get_y(),rect.get_width(),rect.get_height()); + return true; + } +/* else + if(last_tooltip_path.get_depth()<=0 || path!=last_tooltip_path) + { + tooltips_.unset_tip(*this); + Glib::ustring tooltips_string(row[layer_model.tooltip]); + last_tooltip_path=path; + if(!tooltips_string.empty()) + { + tooltips_.set_tip(*this,tooltips_string); + tooltips_.force_window(); + } + } +*/ + return true; + } + break; + case GDK_BUTTON_RELEASE: + { + Gtk::TreeModel::Path path; + Gtk::TreeViewColumn *column; + int cell_x, cell_y; + if(!get_path_at_pos( + (int)event->button.x,(int)event->button.y, // x, y + path, // TreeModel::Path& + column, //TreeViewColumn*& + cell_x,cell_y //int&cell_x,int&cell_y + ) + ) break; + + if(!get_model()->get_iter(path)) + break; + + Gtk::TreeRow row = *(get_model()->get_iter(path)); + + if(column && cellrenderer_time_track==column->get_first_cell_renderer()) + { + Gdk::Rectangle rect; + get_cell_area(path,*column,rect); + cellrenderer_time_track->property_value_desc()=row[model.value_desc]; + cellrenderer_time_track->property_canvas()=row[model.canvas]; + cellrenderer_time_track->activate(event,*this,path.to_string(),rect,rect,Gtk::CellRendererState()); + queue_draw(); + queue_draw_area(rect.get_x(),rect.get_y(),rect.get_width(),rect.get_height()); + return true; + } + } + break; + default: + break; + } + mimic_resync(); + return Gtk::TreeView::on_event(event); + } + + void + queue_draw_msg() + { + synfig::info("*************QUEUE_DRAW***************** (time track view)"); + Widget::queue_draw(); + } + void set_model(Glib::RefPtr store) + { + Gtk::TreeView::set_model(store); + param_tree_store_=store; + cellrenderer_time_track->set_canvas_interface(param_tree_store_->canvas_interface()); + store->signal_changed().connect(sigc::mem_fun(*this, &TimeTrackView::queue_draw)); + } + + void + on_waypoint_changed( synfig::Waypoint waypoint , synfig::ValueNode::Handle value_node) + { + // \todo is this code used? + assert(0); + + synfigapp::Action::ParamList param_list; + param_list.add("canvas",param_tree_store_->canvas_interface()->get_canvas()); + param_list.add("canvas_interface",param_tree_store_->canvas_interface()); + param_list.add("value_node",value_node); + param_list.add("waypoint",waypoint); + // param_list.add("time",canvas_interface()->get_time()); + + etl::handle::cast_static(param_tree_store_->canvas_interface()->get_instance())->process_action("WaypointSetSmart", param_list); + } + + void mimic(Gtk::TreeView *param_tree_view) + { + mimic_tree_view=param_tree_view; + param_tree_view->signal_row_expanded().connect( + sigc::hide<0>( + sigc::hide_return( + sigc::bind<-1>( + sigc::mem_fun( + *this, + &Gtk::TreeView::expand_row + ), + false + ) + )) + ); + param_tree_view->signal_row_collapsed().connect( + sigc::hide<0>( + sigc::hide_return( + sigc::mem_fun( + *this, + &Gtk::TreeView::collapse_row + ) + )) + ); + mimic_resync(); + } + + void mimic_resync() + { + if(mimic_tree_view) + { + Gtk::Adjustment &adjustment(*mimic_tree_view->get_vadjustment()); + set_vadjustment(adjustment); + + if(adjustment.get_page_size()>get_height()) + adjustment.set_page_size(get_height()); + + int row_height = 0; + if(getenv("SYNFIG_TIMETRACK_ROW_HEIGHT")) + row_height = atoi(getenv("SYNFIG_TIMETRACK_ROW_HEIGHT")); + if (row_height < 3) + row_height = 18; + + cellrenderer_time_track->set_fixed_size(-1,row_height); + } + } + + void + on_waypoint_clicked_timetrackview(const etl::handle& node, + const synfig::Time& time, + const synfig::Time& time_offset __attribute__ ((unused)), + int button) + { + std::set > waypoint_set; + synfig::waypoint_collect(waypoint_set,time,node); + + synfigapp::ValueDesc value_desc; + + if (waypoint_set.size() == 1) + { + ValueNode::Handle value_node(waypoint_set.begin()->get_parent_value_node()); + assert(value_node); + + Gtk::TreeRow row; + if (param_tree_store_->find_first_value_node(value_node, row) && row) + value_desc = static_cast(row[model.value_desc]); + } + + if (!waypoint_set.empty()) + signal_waypoint_clicked_timetrackview(value_desc,waypoint_set,button); + } +}; + +/* === 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_Timetrack::Dock_Timetrack(): + Dock_CanvasSpecific("timetrack",_("Timetrack"),Gtk::StockID("synfig-timetrack")) +{ + table_=0; + widget_timeslider_= new Widget_Timeslider(); + widget_kf_list_= new Widget_Keyframe_List(); + + int header_height = 0; + if(getenv("SYNFIG_TIMETRACK_HEADER_HEIGHT")) + header_height = atoi(getenv("SYNFIG_TIMETRACK_HEADER_HEIGHT")); + if (header_height < 3) + header_height = 24; + + widget_timeslider_->set_size_request(-1,header_height-header_height/3+1); + widget_kf_list_->set_size_request(-1,header_height/3+1); + + hscrollbar_=new Gtk::HScrollbar(); + vscrollbar_=new Gtk::VScrollbar(); +} + +Dock_Timetrack::~Dock_Timetrack() +{ + if(table_)delete table_; + delete hscrollbar_; + delete vscrollbar_; + delete widget_timeslider_; + delete widget_kf_list_; +} + +void +Dock_Timetrack::init_canvas_view_vfunc(etl::loose_handle canvas_view) +{ + LayerParamTreeStore::Model model; + + Glib::RefPtr tree_store( + Glib::RefPtr::cast_dynamic( + canvas_view->get_tree_model("params") + ) + ); + + TimeTrackView* tree_view(new TimeTrackView()); + tree_view->set_canvas_view(canvas_view); + tree_view->set_model(tree_store); + Gtk::TreeView* param_tree_view(dynamic_cast(canvas_view->get_ext_widget("params"))); + tree_view->mimic(param_tree_view); + + tree_view->signal_waypoint_clicked_timetrackview.connect(sigc::mem_fun(*canvas_view, &studio::CanvasView::on_waypoint_clicked_canvasview)); + + canvas_view->time_adjustment().signal_value_changed().connect(sigc::mem_fun(*tree_view,&Gtk::TreeView::queue_draw)); + canvas_view->time_adjustment().signal_changed().connect(sigc::mem_fun(*tree_view,&Gtk::TreeView::queue_draw)); + + canvas_view->set_ext_widget(get_name(),tree_view); +} + +void +Dock_Timetrack::refresh_selected_param() +{ +/* Gtk::TreeView* tree_view( + static_cast(get_canvas_view()->get_ext_widget(get_name())) + ); + Gtk::TreeModel::iterator iter(tree_view->get_selection()->get_selected()); + + if(iter) + { + LayerParamTreeStore::Model model; + get_canvas_view()->work_area->set_selected_value_node( + (synfig::ValueNode::Handle)(*iter)[model.value_node] + ); + } + else + { + get_canvas_view()->work_area->set_selected_value_node(0); + } +*/ +} + +void +Dock_Timetrack::changed_canvas_view_vfunc(etl::loose_handle canvas_view) +{ + if(table_) + { + table_->hide(); + delete table_; + hscrollbar_->unset_adjustment(); + vscrollbar_->unset_adjustment(); + //widget_timeslider_->unset_adjustment(); + table_=0; + } + + if(canvas_view) + { + TimeTrackView* tree_view(dynamic_cast(canvas_view->get_ext_widget(get_name()))); + Gtk::TreeView* param_tree_view(dynamic_cast(canvas_view->get_ext_widget("params"))); + tree_view->set_vadjustment(*param_tree_view->get_vadjustment()); + + assert(tree_view); + + + widget_timeslider_->set_time_adjustment(&canvas_view->time_adjustment()); + widget_timeslider_->set_bounds_adjustment(&canvas_view->time_window_adjustment()); + widget_timeslider_->set_global_fps(canvas_view->get_canvas()->rend_desc().get_frame_rate()); + + widget_kf_list_->set_time_adjustment(&canvas_view->time_adjustment()); + widget_kf_list_->set_canvas_interface(canvas_view->canvas_interface()); + + vscrollbar_->set_adjustment(*tree_view->get_vadjustment()); + hscrollbar_->set_adjustment(canvas_view->time_window_adjustment()); + table_=new Gtk::Table(2,3); + table_->attach(*widget_timeslider_, 0, 1, 1, 2, Gtk::FILL|Gtk::SHRINK, Gtk::FILL|Gtk::SHRINK); + table_->attach(*widget_kf_list_, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK); + table_->attach(*tree_view, 0, 1, 2, 3, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); + table_->attach(*hscrollbar_, 0, 1, 3, 4, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK); + table_->attach(*vscrollbar_, 1, 2, 0, 3, Gtk::FILL|Gtk::SHRINK, Gtk::FILL|Gtk::EXPAND); + add(*table_); + + //add(*last_widget_curves_); + table_->show_all(); + show_all(); + } + else + { + //clear_previous(); + } +} diff --git a/synfig-studio/src/gui/docks/dock_timetrack.h b/synfig-studio/src/gui/docks/dock_timetrack.h new file mode 100644 index 0000000..5525ee6 --- /dev/null +++ b/synfig-studio/src/gui/docks/dock_timetrack.h @@ -0,0 +1,71 @@ +/* === S Y N F I G ========================================================= */ +/*! \file docks/dock_timetrack.h +** \brief Template Header +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2009 Carlos López +** +** 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_TIMETRACK_H +#define __SYNFIG_STUDIO_DOCK_TIMETRACK_H + +/* === H E A D E R S ======================================================= */ + +#include "docks/dockable.h" +#include +#include "instance.h" +#include "docks/dock_canvasspecific.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 Widget_Timeslider; +class Widget_Keyframe_List; + +class Dock_Timetrack : public Dock_CanvasSpecific +{ + Gtk::HScrollbar* hscrollbar_; + Gtk::VScrollbar* vscrollbar_; + Widget_Timeslider* widget_timeslider_; + Widget_Keyframe_List* widget_kf_list_; + Gtk::Table* table_; + +protected: + virtual void init_canvas_view_vfunc(etl::loose_handle canvas_view); + virtual void changed_canvas_view_vfunc(etl::loose_handle canvas_view); + + void refresh_selected_param(); + +public: + + + Dock_Timetrack(); + ~Dock_Timetrack(); +}; // END of Dock_Timetrack + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/docks/dockable.cpp b/synfig-studio/src/gui/docks/dockable.cpp new file mode 100644 index 0000000..1baeb41 --- /dev/null +++ b/synfig-studio/src/gui/docks/dockable.cpp @@ -0,0 +1,380 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dockable.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 "app.h" +#include + +#include "docks/dockable.h" +#include "docks/dockmanager.h" +#include "docks/dockbook.h" +#include "docks/dockdialog.h" +#include +#include +#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 ========================================================= */ + +#ifdef WIN32 +# ifdef IMAGE_DIR +# undef IMAGE_DIR +# define IMAGE_DIR "share\\pixmaps" +# endif +#endif + +#ifndef IMAGE_DIR +# define IMAGE_DIR "/usr/local/share/pixmaps" +#endif + +#ifndef IMAGE_EXT +# define IMAGE_EXT "png" +#endif + +/* === G L O B A L S ======================================================= */ + +/* === P R O C E D U R E S ================================================= */ + +/* === M E T H O D S ======================================================= */ + +Dockable::Dockable(const synfig::String& name,const synfig::String& local_name,Gtk::StockID stock_id_): +// Gtk::Window(Gtk::WINDOW_TOPLEVEL), + name_(name), + local_name_(local_name), +// dialog_settings(this,name), + title_label_(local_name,Gtk::ALIGN_LEFT), + stock_id_(stock_id_) +{ + parent_=0; + scrolled_=0; + + use_scrolled_=true; + + attach_dnd_to(title_label_); + + toolbar_=0; + //button_box_.show(); + + Gtk::Table* table(this); + + { + title_label_.set_padding(0,0); + //title_label_.show(); + Gtk::EventBox* event_box(manage(new Gtk::EventBox())); + event_box->set_border_width(0); + event_box->add(title_label_); + //table->attach(*event_box, 0, 1, 0,1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + + header_box_.pack_start(*event_box); + + attach_dnd_to(*event_box); + event_box->show(); + // event_box->set_events(Gdk::ALL_EVENTS_MASK); //!< \todo change this to only allow what is necessary for DnD + + + Gtk::Button* bttn_close(manage(new Gtk::Button(_("X")))); + //table->attach(*bttn_close, 1, 2, 0,1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + header_box_.pack_end(*bttn_close,false,false); + bttn_close->show(); + bttn_close->set_relief(Gtk::RELIEF_NONE); + bttn_close->signal_clicked().connect(sigc::mem_fun(*this,&Dockable::detach)); + bttn_close->set_border_width(0); + dynamic_cast(bttn_close->get_child())->set_padding(0,0); + } + + prev_widget_=manage(new Gtk::Label(" ")); + + //table->attach(header_box_, 0, 1, 0,1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + table->attach(*prev_widget_, 0, 1, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + //table->attach(*toolbar_, 0, 1, 2,3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + set_toolbar(*manage(new Gtk::Toolbar)); + table->show(); + + prev_widget_->show(); + + set_size_request(175,120); + +} + +Dockable::~Dockable() +{ + if(scrolled_) + { + delete scrolled_; + scrolled_=0; + } +} + +void +Dockable::attach_dnd_to(Gtk::Widget& widget) +{ + std::list listTargets; + listTargets.push_back( Gtk::TargetEntry("DOCK") ); + + widget.drag_source_set(listTargets); + widget.drag_source_set_icon(get_stock_id()); + widget.drag_dest_set(listTargets); + + + widget.signal_drag_data_get().connect(sigc::mem_fun(*this,&Dockable::on_drag_data_get)); + widget.signal_drag_end().connect(sigc::mem_fun(*this,&Dockable::on_drag_end)); + widget.signal_drag_begin().connect(sigc::mem_fun(*this,&Dockable::on_drag_begin)); + widget.signal_drag_data_received().connect(sigc::mem_fun(*this,&Dockable::on_drag_data_received)); +} + +void +Dockable::on_drag_data_received(const Glib::RefPtr& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time) +{ + if ((selection_data.get_length() >= 0) && (selection_data.get_format() == 8)) + { + Dockable& dockable(**reinterpret_cast(const_cast(selection_data.get_data()))); + + if(dockable.parent_ != parent_) + parent_->add(dockable,parent_->page_num(*this)); + else + parent_->reorder_child(dockable,parent_->page_num(*this)); + dockable.present(); + context->drag_finish(true, false, time); + return; + } + + context->drag_finish(false, false, time); +} + +void +Dockable::on_drag_end(const Glib::RefPtr&/*context*/) +{ + if(!dnd_success_) + { + detach(); + present(); + } +} + +void +Dockable::on_drag_begin(const Glib::RefPtr&/*context*/) +{ + dnd_success_=false; +} + +void +Dockable::on_drag_data_get(const Glib::RefPtr&, Gtk::SelectionData& selection_data, guint /*info*/, guint /*time*/) +{ + Dockable* tmp(this); + dnd_success_=true; + + selection_data.set(8, reinterpret_cast(&tmp), 4); +} + +void +Dockable::set_local_name(const synfig::String& local_name) +{ + //set_title(local_name); + title_label_.set_text(local_name); +} + +void +Dockable::clear() +{ + //if(!toolbar_->children().empty()) + // toolbar_->children().clear(); + set_toolbar(*manage(new Gtk::Toolbar)); + +} + +void +Dockable::set_toolbar(Gtk::Toolbar& toolbar) +{ + if(toolbar_)remove(*toolbar_); + toolbar_=0; + toolbar_=&toolbar; + if(toolbar_) + { + attach(*toolbar_, 0, 1, 2,3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); + gtk_toolbar_set_icon_size(toolbar_->gobj(),GtkIconSize(1)/*GTK_ICON_SIZE_MENU*/); + toolbar_->show(); + } +} + +bool +Dockable::clear_previous() +{ + prev_widget_=0; + prev_widget_delete_connection.disconnect(); + return false; +} + +void +Dockable::add(Gtk::Widget& x) +{ + if(prev_widget_) + { + remove(*prev_widget_); + clear_previous(); + } + + if(scrolled_) + { + delete scrolled_; + scrolled_=0; + } + + if(use_scrolled_) + { + scrolled_=new Gtk::ScrolledWindow; + + scrolled_->add(x); + + attach(*scrolled_, 0, 1, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + + x.show(); + + scrolled_->show(); + + scrolled_->set_shadow_type(Gtk::SHADOW_NONE); + scrolled_->set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC); + prev_widget_=scrolled_; + } + else + { + attach(x, 0, 1, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); + x.show(); + prev_widget_=&x; + } + prev_widget_delete_connection=prev_widget_->signal_delete_event().connect( + sigc::hide( + sigc::mem_fun( + *this, + &Dockable::clear_previous + ) + ) + ); +} + +Gtk::ToolButton* +Dockable::add_button(const Gtk::StockID& stock_id, const synfig::String& tooltip) +{ + if(!toolbar_) + set_toolbar(*manage(new Gtk::Toolbar)); + + //Gtk::IconSize iconsize(4); + //Gtk::IconSize iconsize(Gtk::IconSize::from_name("synfig-small_icon")); + + Gtk::ToolButton* ret(manage(new Gtk::ToolButton(stock_id))); + //Gtk::Image* icon(manage(new Gtk::Image(stock_id,iconsize))); + //ret->add(*icon); + //ret->set_relief(Gtk::RELIEF_HALF); + //ret->set_relief(Gtk::RELIEF_NONE); + ret->set_label(tooltip); + if (toolbar_->get_tooltips_object()) + toolbar_->get_tooltips_object()->set_tip(*ret,tooltip); + + ret->show(); + //icon->show(); + toolbar_->set_tooltips(true); + + toolbar_->append(*ret); + //button_box_.pack_start(*ret,false,false); + //get_action_area()->pack_start(*ret,false,false); + //add_action_widget(*ret,1); + return ret; +} + + +void +Dockable::detach() +{ + if(parent_) + parent_->remove(*this); +} + +void +Dockable::present() +{ + if(parent_) + { + parent_->set_current_page(parent_->page_num(*this)); + parent_->present(); + } + else + { + DockDialog* dock_dialog(new DockDialog()); + dock_dialog->get_dock_book().add(*this); +/* //hack: always display composition selector on top of canvas browser + if(get_name()=="canvases") + dock_dialog->set_composition_selector(true); +*/ + dock_dialog->present(); + } +} + +Gtk::Widget* +Dockable::create_tab_label() +{ + Gtk::EventBox* event_box(manage(new Gtk::EventBox())); + + attach_dnd_to(*event_box); + + { + Gtk::StockID stock_id(get_stock_id()); + Gtk::StockItem item; + + // Check to make sure the icon is valid + if(Gtk::Stock::lookup(stock_id,item)) + { + Gtk::Image* icon(manage(new Gtk::Image(stock_id,Gtk::IconSize(4)))); + event_box->add(*icon); + tooltips_.set_tip(*event_box,get_local_name()); + icon->show(); + } + else + { + // Bad icon, try to make a label + + Glib::ustring text(get_local_name()); + + Gtk::Label* label(manage(new Gtk::Label(text))); + event_box->add(*label); + label->show(); + } + } + + return event_box; +} diff --git a/synfig-studio/src/gui/docks/dockable.h b/synfig-studio/src/gui/docks/dockable.h new file mode 100644 index 0000000..a205c9e --- /dev/null +++ b/synfig-studio/src/gui/docks/dockable.h @@ -0,0 +1,144 @@ +/* === S Y N F I G ========================================================= */ +/*! \file docks/dockable.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_DOCKABLE_H +#define __SYNFIG_STUDIO_DOCKABLE_H + +/* === H E A D E R S ======================================================= */ + +#include +#include +#include "dialogsettings.h" +#include +#include +#include +#include +#include +#include +#include +#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 studio { + +class DockManager; +class DockBook; + +class Dockable : public Gtk::Table +{ + friend class DockManager; + friend class DockBook; + + + sigc::signal signal_stock_id_changed_; + sigc::connection prev_widget_delete_connection; +protected: + +// DialogSettings dialog_settings; + + +private: + + Gtk::Toolbar *toolbar_; + + synfig::String name_; + synfig::String local_name_; + Gtk::Tooltips tooltips_; + Gtk::Frame frame_; + Gtk::Label title_label_; + //Gtk::HBox button_box_; + Gtk::HBox header_box_; + + //Gtk::HandleBox handle_box_; + Gtk::ScrolledWindow *scrolled_; + Gtk::Widget *prev_widget_; + + bool use_scrolled_; + + Gtk::StockID stock_id_; + + DockBook* parent_; + + bool dnd_success_; + +public: + + void set_toolbar(Gtk::Toolbar& toolbar); + + void set_use_scrolled(bool x) { use_scrolled_=x; } + + Dockable(const synfig::String& name,const synfig::String& local_name,Gtk::StockID stock_id_=Gtk::StockID(" ")); + ~Dockable(); + + sigc::signal& signal_stock_id_changed() { return signal_stock_id_changed_; } + + const synfig::String& get_name()const { return name_; } + const synfig::String& get_local_name()const { return local_name_; } + + const Gtk::StockID& get_stock_id()const { return stock_id_; } + void set_stock_id(Gtk::StockID x) { stock_id_=x; signal_stock_id_changed()(); } + + void set_local_name(const synfig::String&); + + void clear(); + + Gtk::Tooltips& get_tooltips() { return tooltips_; } + + //DialogSettings& settings() { return dialog_settings; } + //const DialogSettings& settings()const { return dialog_settings; } + + void add(Gtk::Widget& x); + + Gtk::ToolButton* add_button(const Gtk::StockID& stock_id, const synfig::String& tooltip=synfig::String()); + + void detach(); + + void present(); + + void attach_dnd_to(Gtk::Widget& widget); + + bool clear_previous(); + virtual Gtk::Widget* create_tab_label(); + +private: + + void on_drag_data_get(const Glib::RefPtr&, Gtk::SelectionData& selection_data, guint info, guint time); + void on_drag_end(const Glib::RefPtr&context); + void on_drag_begin(const Glib::RefPtr&context); + void on_drag_data_received(const Glib::RefPtr& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time); + +}; // END of studio::Dockable + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/docks/dockbook.cpp b/synfig-studio/src/gui/docks/dockbook.cpp new file mode 100644 index 0000000..2e839b3 --- /dev/null +++ b/synfig-studio/src/gui/docks/dockbook.cpp @@ -0,0 +1,253 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dockbook.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 "docks/dockbook.h" +#include "docks/dockable.h" +#include "app.h" +#include "docks/dockmanager.h" + +#include +#include +#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 ========================================================= */ + +/* === G L O B A L S ======================================================= */ + +/* === P R O C E D U R E S ================================================= */ + +/* === M E T H O D S ======================================================= */ + +DockBook::DockBook() +{ + std::list listTargets; + listTargets.push_back( Gtk::TargetEntry("DOCK") ); + + drag_dest_set(listTargets); + //set_sensitive(true); + set_flags(get_flags()|Gtk::RECEIVES_DEFAULT|Gtk::HAS_GRAB); + //add_events(Gdk::ALL_EVENTS_MASK); + //set_extension_events(Gdk::EXTENSION_EVENTS_ALL); + set_show_tabs(true); + deleting_=false; +} + +DockBook::~DockBook() +{ + deleting_=true; + clear(); +} + +void +DockBook::clear() +{ + while(get_n_pages()) + remove(static_cast(*get_nth_page(get_n_pages()-1))); +} + +void +DockBook::on_drag_data_received(const Glib::RefPtr& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time) +{ + if ((selection_data.get_length() >= 0) && (selection_data.get_format() == 8)) + { + Dockable& dockable(**reinterpret_cast(const_cast(selection_data.get_data()))); + if(dockable.parent_!=this) + add(dockable); + dockable.present(); + context->drag_finish(true, false, time); + return; + } + + context->drag_finish(false, false, time); +} + +void +DockBook::add(Dockable& dockable, int position) +{ + dockable.detach(); + + if(position==-1) + append_page(dockable, " "); + else + insert_page(dockable, " ", position); + + refresh_tab(&dockable); + + dockable.signal_stock_id_changed().connect( + sigc::bind( + sigc::mem_fun( + *this, + &DockBook::refresh_tab + ), + &dockable + ) + ); + + dockable.parent_=this; + + dockable.show(); + + signal_changed_(); +} + +void +DockBook::refresh_tab(Dockable* dockable) +{ + Gtk::Widget* label(dockable->create_tab_label()); + + label->signal_button_press_event().connect( + sigc::bind( + sigc::mem_fun( + *this, + &DockBook::tab_button_pressed + ), + dockable + ) + ); + + set_tab_label(*dockable, *label); + label->show(); +} + + +void +DockBook::remove(Dockable& dockable) +{ + dockable.hide(); + remove_page(dockable); + dockable.parent_=0; + + if(!deleting_) + { + signal_changed_(); + + if(get_n_pages()==0) + signal_empty()(); + } +} + +void +DockBook::present() +{ + show(); +} + +synfig::String +DockBook::get_local_contents()const +{ + synfig::String ret; + + for(int i(0);i!=const_cast(this)->get_n_pages();i++) + { + Dockable& dockable(static_cast(*const_cast(this)->get_nth_page(i))); + + if(i) + ret+=", "; + ret+=dockable.get_local_name(); + } + + return ret; +} + +synfig::String +DockBook::get_contents()const +{ + synfig::String ret; + + for(int i(0);i!=const_cast(this)->get_n_pages();i++) + { + Dockable& dockable(static_cast(*const_cast(this)->get_nth_page(i))); + + if(i) + ret+=' '; + ret+=dockable.get_name(); + } + + return ret; +} + +void +DockBook::set_contents(const synfig::String& x) +{ + synfig::String str(x); + while(!str.empty()) + { + synfig::String::size_type separator=str.find_first_of(' '); + synfig::String dock; + if(separator==synfig::String::npos) + { + dock=str; + str.clear(); + } + else + { + dock=String(str.begin(),str.begin()+separator); + str=String(str.begin()+separator+1,str.end()); + } + + try + { + add(App::dock_manager->find_dockable(dock)); + }catch(...) { } + } +} + +bool +DockBook::tab_button_pressed(GdkEventButton* event, Dockable* dockable) +{ + if(event->button!=3) + return false; + + Gtk::Menu *tabmenu=manage(new class Gtk::Menu()); + tabmenu->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), tabmenu)); + + tabmenu->items().push_back( + Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-close"), + sigc::mem_fun(*dockable,&Dockable::detach) + ) + ); + + tabmenu->popup(event->button,gtk_get_current_event_time()); + + return true; +} diff --git a/synfig-studio/src/gui/docks/dockbook.h b/synfig-studio/src/gui/docks/dockbook.h new file mode 100644 index 0000000..ded4a31 --- /dev/null +++ b/synfig-studio/src/gui/docks/dockbook.h @@ -0,0 +1,89 @@ +/* === S Y N F I G ========================================================= */ +/*! \file docks/dockbook.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_DOCKBOOK_H +#define __SYNFIG_STUDIO_DOCKBOOK_H + +/* === H E A D E R S ======================================================= */ + +#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 studio { + +class DockManager; +class Dockable; + +class DockBook : public Gtk::Notebook +{ + friend class DockManager; + friend class Dockable; + + sigc::signal signal_empty_; + sigc::signal signal_changed_; + + Gtk::Tooltips tooltips_; + + bool deleting_; + +protected: +public: + DockBook(); + ~DockBook(); + + sigc::signal& signal_empty() { return signal_empty_; } + sigc::signal& signal_changed() { return signal_changed_; } + + void add(Dockable& dockable, int position=-1); + void remove(Dockable& dockable); + + void present(); + + void clear(); + + synfig::String get_local_contents()const; + + synfig::String get_contents()const; + void set_contents(const synfig::String& x); + + void refresh_tabs_headers(); + + void refresh_tab(Dockable*); + + bool tab_button_pressed(GdkEventButton* event, Dockable* dockable); + void on_drag_data_received(const Glib::RefPtr& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time); +}; // END of studio::DockBook + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/docks/dockdialog.cpp b/synfig-studio/src/gui/docks/dockdialog.cpp new file mode 100644 index 0000000..4187a9d --- /dev/null +++ b/synfig-studio/src/gui/docks/dockdialog.cpp @@ -0,0 +1,564 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dockdialog.cpp +** \brief Template File +** +** $Id$ +** +** \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 +** 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 "app.h" +#include + +#include "docks/dockdialog.h" +#include "docks/dockbook.h" +#include "docks/dockmanager.h" +#include "toolbox.h" +#include "widgets/widget_compselect.h" +#include +#include +#include +#include +#include +#include +#include +#include "canvasview.h" +#include +#include +#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 ========================================================= */ + +#define GRAB_HINT_DATA(y,default) { \ + String x; \ + if(synfigapp::Main::settings().get_value(String("pref.")+y+"_hints",x)) \ + { \ + set_type_hint((Gdk::WindowTypeHint)atoi(x.c_str())); \ + } else {\ + set_type_hint(default); \ + } \ + } + +/* === G L O B A L S ======================================================= */ + +/* === P R O C E D U R E S ================================================= */ + +/* === M E T H O D S ======================================================= */ + +DockDialog::DockDialog(): + Gtk::Window(Gtk::WINDOW_TOPLEVEL) +{ + composition_selector_=false; + is_deleting=false; + is_horizontal=false; + last_dock_book=0; + box=0; + + widget_comp_select=new Widget_CompSelect(); + + // Give ourselves an ID that is most likely unique + set_id(synfig::UniqueID().get_uid()^reinterpret_cast(this)); + + set_role(strprintf("dock_dialog_%d",get_id())); + GRAB_HINT_DATA( + "dock_dialog", +#ifdef __APPLE__ + Gdk::WINDOW_TYPE_HINT_NORMAL +#else + Gdk::WINDOW_TYPE_HINT_UTILITY +#endif + ); + set_keep_above(false); + + //! \todo can we set dialog windows transient for all normal windows, not just the toolbox? + //! paragraph 3 of http://standards.freedesktop.org/wm-spec/1.3/ar01s07.html suggests we can + // this seems to have bad effects on KDE, so leave it disabled by default + if(getenv("SYNFIG_TRANSIENT_DIALOGS")) + set_transient_for(*App::toolbox); + + // Set up the window + //set_type_hint(Gdk::WINDOW_TYPE_HINT_UTILITY); + set_title(_("Dock Panel")); + + // Register with the dock manager + App::dock_manager->dock_dialog_list_.push_back(this); + + + // connect our signals + signal_delete_event().connect( + sigc::hide( + sigc::mem_fun(*this,&DockDialog::close) + ) + ); + +/* + App::signal_canvas_view_focus().connect( + sigc::hide( + sigc::mem_fun( + *this, + &DockDialog::refresh_accel_group + ) + ) + ); +*/ + + add_accel_group(App::ui_manager()->get_accel_group()); + App::signal_present_all().connect(sigc::mem_fun0(*this,&DockDialog::present)); + +} + +DockDialog::~DockDialog() +{ + empty_sig.disconnect(); + + is_deleting=true; + + // Remove all of the dock books + for(;!dock_book_list.empty();dock_book_list.pop_front()) + { + dock_book_list.front()->clear(); + + //! \todo Fix this UGLY HACK + // The following line really should be uncommented, + // but it causes crashes. Without it, a small + // memory hole is created--but at least it doesn't crash + // delete dock_book_list.front(); + + // Oddly enough, the following line should + // theoretically do the same thing after this + // class is destroyed, but it doesn't seem to + // cause a crash. It does, however, trigger this warning: + // + // A floating object was finalized. This means that someone + // called g_object_unref() on an object that had only a + // floating reference; the initial floating reference is not + // owned by anyone and must be removed with g_object_ref_sink(). + // + // manage(dock_book_list.front()); + } + + // Remove us from the dock manager + if(App::dock_manager)try{ + std::list::iterator iter; + for(iter=App::dock_manager->dock_dialog_list_.begin();iter!=App::dock_manager->dock_dialog_list_.end();++iter) + if(*iter==this) + { + App::dock_manager->dock_dialog_list_.erase(iter); + break; + } + } + catch(...) + { + synfig::warning("DockDialog::~DockDialog(): Exception thrown when trying to remove from dock manager...?"); + } + + delete widget_comp_select; +} + +void +DockDialog::drop_on_prepend(const Glib::RefPtr& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time) +{ + if ((selection_data.get_length() >= 0) && (selection_data.get_format() == 8)) + { + Dockable& dockable(**reinterpret_cast(const_cast(selection_data.get_data()))); + prepend_dock_book()->add(dockable); + context->drag_finish(true, false, time); + return; + } + + context->drag_finish(false, false, time); +} + +void +DockDialog::drop_on_append(const Glib::RefPtr& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time) +{ + if ((selection_data.get_length() >= 0) && (selection_data.get_format() == 8)) + { + Dockable& dockable(**reinterpret_cast(const_cast(selection_data.get_data()))); + append_dock_book()->add(dockable); + context->drag_finish(true, false, time); + return; + } + + context->drag_finish(false, false, time); +} + + +void +DockDialog::on_hide() +{ + Gtk::Window::on_hide(); + close(); +} + +DockBook* +DockDialog::prepend_dock_book() +{ + if(is_deleting)return 0; + + dock_book_list.push_front(new DockBook); + last_dock_book=dock_book_list.front(); + + + last_dock_book->signal_empty().connect( + sigc::bind( + sigc::mem_fun(*this,&DockDialog::erase_dock_book), + last_dock_book + ) + ); + + dock_book_sizes_.insert(dock_book_sizes_.begin(),225); + refresh(); + return last_dock_book; +} + +DockBook* +DockDialog::append_dock_book() +{ + if(is_deleting)return 0; + + dock_book_list.push_back(new DockBook); + last_dock_book=dock_book_list.back(); + last_dock_book->signal_empty().connect( + sigc::bind( + sigc::mem_fun(*this,&DockDialog::erase_dock_book), + last_dock_book + ) + ); + last_dock_book->signal_changed().connect( + sigc::mem_fun(*this,&DockDialog::refresh_title) + ); + last_dock_book->signal_changed().connect( + sigc::mem_fun(*this,&DockDialog::refresh_title) + ); + dock_book_sizes_.push_back(225); + + //last_dock_book->show(); + refresh(); + return last_dock_book; +} + +void +DockDialog::erase_dock_book(DockBook* dock_book) +{ + if(is_deleting)return; + + std::list::iterator iter; + for(iter=dock_book_list.begin();iter!=dock_book_list.end();++iter) + if(*iter==dock_book) + { + dock_book_list.erase(iter); + + if(dock_book_list.empty()) + { + last_dock_book=0; + close(); + return; + } + else + { + if(last_dock_book==dock_book) + last_dock_book=dock_book_list.front(); + } + + refresh(); + + return; + } +} + +void +DockDialog::refresh() +{ + // synfig::info("dock_book_list.size()=%d",dock_book_list.size()); + //remove(); + + if(dock_book_list.empty()) + return; + + if(box)delete box; + box=(manage(is_horizontal?(Gtk::Box*)new Gtk::HBox:(Gtk::Box*)new Gtk::VBox)); + add(*box); + + box->pack_start(*widget_comp_select,false,true); + + Gtk::Button* append_button(manage(new Gtk::Button)); + Gtk::Button* prepend_button(manage(new Gtk::Button)); + + std::list listTargets; + listTargets.push_back( Gtk::TargetEntry("DOCK") ); + + append_button->drag_dest_set(listTargets); + prepend_button->drag_dest_set(listTargets); + + append_button->signal_drag_data_received().connect( + sigc::mem_fun(*this,&DockDialog::drop_on_append) + ); + + prepend_button->signal_drag_data_received().connect( + sigc::mem_fun(*this,&DockDialog::drop_on_prepend) + ); + + box->pack_start(*prepend_button,false,true); + box->pack_end(*append_button,false,true); + + //prepend_button->show(); + //append_button->show(); + panels_.clear(); + + if(dock_book_list.size()==1) + { + box->pack_start(get_dock_book(),true,true); + } + else + { + Gtk::Paned* parent(manage(is_horizontal?(Gtk::Paned*)new Gtk::HPaned:(Gtk::Paned*)new Gtk::VPaned)); + + panels_.push_back(parent); + + if(panels_.size()<=dock_book_sizes_.size()) + panels_.back()->set_position(dock_book_sizes_[panels_.size()-1]); + panels_.back()->property_position().signal_changed().connect( + sigc::mem_fun(*this,&DockDialog::rebuild_sizes) + ); + //parent->show(); + parent->add1(*dock_book_list.front()); + //dock_book_list.front()->show(); + + box->pack_start(*parent,true,true); + + std::list::iterator iter,next; + for(next=dock_book_list.begin(),next++,iter=next++;next!=dock_book_list.end();iter=next++) + { + Gtk::Paned* current(manage(is_horizontal?(Gtk::Paned*)new Gtk::HPaned:(Gtk::Paned*)new Gtk::VPaned)); + panels_.push_back(current); + + if(panels_.size()<=dock_book_sizes_.size()) + panels_.back()->set_position(dock_book_sizes_[panels_.size()-1]); + panels_.back()->property_position().signal_changed().connect( + sigc::mem_fun(*this,&DockDialog::rebuild_sizes) + ); + + + parent->add2(*current); + + current->add1(**iter); + //(*iter)->show(); + //current->show(); + + parent=current; + } + parent->add2(**iter); + //(*iter)->show(); + } + + box->show_all(); + if(!composition_selector_) + widget_comp_select->hide(); + rebuild_sizes(); +} + +void +DockDialog::rebuild_sizes() +{ + unsigned int i=0; + dock_book_sizes_.clear(); + for(i=0;iget_position()); + } +} + +void +DockDialog::set_dock_book_sizes(const std::vector& new_sizes) +{ + unsigned int i=0; + for(i=0;iset_position(new_sizes[i]); + } + dock_book_sizes_=new_sizes; + //rebuild_sizes(); +} + +void +DockDialog::refresh_accel_group() +{ +/* + if(last_accel_group_) + { + last_accel_group_->unlock(); + remove_accel_group(last_accel_group_); + last_accel_group_=Glib::RefPtr(); + } + + etl::loose_handle canvas_view(App::get_selected_canvas_view()); + if(canvas_view) + { + last_accel_group_=canvas_view->get_accel_group(); + last_accel_group_->lock(); + add_accel_group(last_accel_group_); + } +*/ + etl::loose_handle canvas_view(App::get_selected_canvas_view()); + if(canvas_view) + { + canvas_view->mainmenu.accelerate(*this); + } +} + +bool +DockDialog::close() +{ + if (getenv("SYNFIG_DEBUG_DESTRUCTORS")) + synfig::info("DockDialog::close(): Deleted"); + + empty_sig.disconnect(); + //get_dock_book().clear(); + delete this; + return true; +} + +DockBook& +DockDialog::get_dock_book() +{ + if(!last_dock_book) + return *append_dock_book(); + return *last_dock_book; +} + +const DockBook& +DockDialog::get_dock_book()const +{ + return *last_dock_book; +} + + +synfig::String +DockDialog::get_contents()const +{ + synfig::String ret; + + std::list::const_iterator iter; + for(iter=dock_book_list.begin();iter!=dock_book_list.end();++iter) + { + if(!ret.empty()) + ret+=is_horizontal?" | ":" - "; + ret+=(*iter)->get_contents(); + } + + + return ret; +} + +void +DockDialog::set_contents(const synfig::String& z) +{ + int x,y; + get_size(x,y); + + synfig::String str(z); + while(!str.empty()) + { + synfig::String::size_type separator=str.find_first_of('-'); + { + synfig::String::size_type sep2=str.find_first_of('|'); + if(separator!=synfig::String::npos || sep2!=synfig::String::npos) + { + if((separator==synfig::String::npos || sep2set_contents(book_contents); + }catch(...) { } + } + + resize(x,y); +} + +void +DockDialog::set_composition_selector(bool x) +{ + if(x==get_composition_selector()) + return; + composition_selector_=x; + if(x) + widget_comp_select->show(); + else + widget_comp_select->hide(); +} + +void +DockDialog::refresh_title() +{ + if(is_deleting)return; + if(dock_book_list.size()) + { + synfig::String title; + + std::list::const_iterator iter; + for(iter=dock_book_list.begin();iter!=dock_book_list.end();++iter) + { + if(!title.empty()) + title+=", "; + title+=(*iter)->get_local_contents(); + } + set_title(title); + } + else + set_title(_("Empty Dock Panel")); +} diff --git a/synfig-studio/src/gui/docks/dockdialog.h b/synfig-studio/src/gui/docks/dockdialog.h new file mode 100644 index 0000000..e1fba30 --- /dev/null +++ b/synfig-studio/src/gui/docks/dockdialog.h @@ -0,0 +1,128 @@ +/* === S Y N F I G ========================================================= */ +/*! \file docks/dockdialog.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_DIALOG_H +#define __SYNFIG_STUDIO_DOCK_DIALOG_H + +/* === H E A D E R S ======================================================= */ + +#include +#include +#include "dialogsettings.h" +#include +#include +#include +#include +#include +#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 Gtk { class Box; class Paned; }; +namespace studio { + +class DockManager; +class DockBook; +class Dockable; +class Widget_CompSelect; +class CanvasView; + +class DockDialog : public Gtk::Window +{ + friend class DockManager; + friend class DockBook; + friend class Dockable; + sigc::connection empty_sig; + + bool composition_selector_; + + bool is_deleting; + + bool is_horizontal; + +private: + std::list dock_book_list; + + std::vector panels_; + std::vector dock_book_sizes_; + + + DockBook* last_dock_book; + + Widget_CompSelect* widget_comp_select; + Gtk::Box *box; + + int id_; + + void on_hide(); + + void refresh(); + + void refresh_title(); + + void set_id(int x) { id_=x; } + + void refresh_accel_group(); + + void drop_on_append(const Glib::RefPtr& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time); + void drop_on_prepend(const Glib::RefPtr& context, int, int, const Gtk::SelectionData& selection_data, guint, guint time); + +public: + + const std::vector& get_dock_book_sizes()const { return dock_book_sizes_;} + void set_dock_book_sizes(const std::vector&); + void rebuild_sizes(); + + bool close(); + + int get_id()const { return id_; } + + DockBook* append_dock_book(); + DockBook* prepend_dock_book(); + void erase_dock_book(DockBook*); + + void set_composition_selector(bool x); + bool get_composition_selector()const { return composition_selector_; } + + DockDialog(); + ~DockDialog(); + + DockBook& get_dock_book(); + const DockBook& get_dock_book()const; + + synfig::String get_contents()const; + void set_contents(const synfig::String& x); +}; // END of studio::DockDialog + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/docks/dockmanager.cpp b/synfig-studio/src/gui/docks/dockmanager.cpp new file mode 100644 index 0000000..a6c2ad6 --- /dev/null +++ b/synfig-studio/src/gui/docks/dockmanager.cpp @@ -0,0 +1,328 @@ +/* === S Y N F I G ========================================================= */ +/*! \file dockmanager.cpp +** \brief Template File +** +** $Id$ +** +** \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 +** 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 "docks/dockmanager.h" +#include +#include "docks/dockable.h" +#include "docks/dockdialog.h" +#include +#include +#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 ========================================================= */ + +/* === P R O C E D U R E S ================================================= */ + +class studio::DockSettings : public synfigapp::Settings +{ + DockManager* dock_manager; + +public: + DockSettings(DockManager* dock_manager):dock_manager(dock_manager) + { + synfigapp::Main::settings().add_domain(this,"dock"); + } + + virtual ~DockSettings() + { + synfigapp::Main::settings().remove_domain("dock"); + } +#define SCALE_FACTOR (1280) + virtual bool get_value(const synfig::String& key_, synfig::String& value)const + { + int screen_w(Gdk::screen_width()); + int screen_h(Gdk::screen_height()); + + if(key_.size()>6 && String(key_.begin(),key_.begin()+6)=="dialog")try + { + synfig::String key(key_.begin()+7,key_.end()); + synfig::String::size_type separator=key.find_first_of('.'); + int id(atoi(synfig::String(key.begin(),key.begin()+separator).c_str())); + key=synfig::String(key.begin()+separator+1,key.end()); + + DockDialog& dock_dialog(dock_manager->find_dock_dialog(id)); + + if(key=="contents_size") + { + dock_dialog.rebuild_sizes(); + vector::const_iterator iter(dock_dialog.get_dock_book_sizes().begin()); + vector::const_iterator end(dock_dialog.get_dock_book_sizes().end()); + value.clear(); + for(;iter!=end;++iter) + value+=strprintf("%d ",(*iter)*SCALE_FACTOR/screen_h); + return true; + } + if(key=="pos") + { + int x,y; dock_dialog.get_position(x,y); + value=strprintf("%d %d",x*SCALE_FACTOR/screen_w,y*SCALE_FACTOR/screen_h); + return true; + } + if(key=="size") + { + int x,y; dock_dialog.get_size(x,y); + value=strprintf("%d %d",x*SCALE_FACTOR/screen_w,y*SCALE_FACTOR/screen_h); + return true; + } + if(key=="contents") + { + value=dock_dialog.get_contents(); + return true; + } + if(key=="comp_selector") + { + value=dock_dialog.get_composition_selector()?"1":"0"; + return true; + } + }catch (...) { return false; } + return synfigapp::Settings::get_value(key_,value); + } + + virtual bool set_value(const synfig::String& key_,const synfig::String& value) + { + int screen_w(Gdk::screen_width()); + int screen_h(Gdk::screen_height()); + + if(key_.size()>6 && String(key_.begin(),key_.begin()+6)=="dialog") + { + synfig::String key(key_.begin()+7,key_.end()); + synfig::String::size_type separator=key.find_first_of('.'); + int id(atoi(synfig::String(key.begin(),key.begin()+separator).c_str())); + key=synfig::String(key.begin()+separator+1,key.end()); + + DockDialog& dock_dialog(dock_manager->find_dock_dialog(id)); + + if(key=="contents_size") + { + try { + int width, height; + Gtk::IconSize::lookup(Gtk::IconSize(4),width,height); + vector data; + String::size_type n=0; + String value_(value); + while(value_.size() && value_.size()>n){ + value_=String(value_.begin()+n,value_.end()); + int size; + if(!strscanf(value_,"%d",&size)) + break; + if (size > SCALE_FACTOR) size = SCALE_FACTOR - 150; + if (size < 0) size = 0; + size=size*screen_h/SCALE_FACTOR; + + // prevent errors like this, by allowing space for at least the dockable's icon: + // ** CRITICAL **: clearlooks_style_draw_box_gap: assertion `height >= -1' failed + if (size < height + 9) size = height + 9; + + data.push_back(size); + + n=value_.find(" "); + if(n==String::npos) + break; + n++; + } + dock_dialog.set_dock_book_sizes(data); + } + catch(...) + { + synfig::error("Exception caught!!!"); + return false; + } + return true; + } + if(key=="pos") + { + int x,y; + if(!strscanf(value,"%d %d",&x, &y)) + return false; + if (x > SCALE_FACTOR) x = SCALE_FACTOR - 150; if (x < 0) x = 0; + if (y > SCALE_FACTOR) y = SCALE_FACTOR - 150; if (y < 0) y = 0; + x=x*screen_w/SCALE_FACTOR; + y=y*screen_h/SCALE_FACTOR; + if(getenv("SYNFIG_WINDOW_POSITION_X_OFFSET")) + x += atoi(getenv("SYNFIG_WINDOW_POSITION_X_OFFSET")); + if(getenv("SYNFIG_WINDOW_POSITION_Y_OFFSET")) + y += atoi(getenv("SYNFIG_WINDOW_POSITION_Y_OFFSET")); + dock_dialog.move(x,y); + return true; + } + if(key=="size") + { + int x,y; + if(!strscanf(value,"%d %d",&x, &y)) + return false; + if (x > SCALE_FACTOR) x = 150; if (x < 0) x = 0; + if (y > SCALE_FACTOR) y = 150; if (y < 0) y = 0; + x=x*screen_w/SCALE_FACTOR; + y=y*screen_h/SCALE_FACTOR; + dock_dialog.set_default_size(x,y); + dock_dialog.resize(x,y); + return true; + } + if(key=="contents") + { + dock_dialog.set_contents(value); + return true; + } + if(key=="comp_selector") + { + if(value.empty() || value[0]=='0') + dock_dialog.set_composition_selector(false); + else + dock_dialog.set_composition_selector(true); + return true; + } + } + return synfigapp::Settings::set_value(key_,value); + } + + virtual KeyList get_key_list()const + { + synfigapp::Settings::KeyList ret(synfigapp::Settings::get_key_list()); + + std::list::const_iterator iter; + for(iter=dock_manager->dock_dialog_list_.begin();iter!=dock_manager->dock_dialog_list_.end();++iter) + { + ret.push_back(strprintf("dialog.%d.contents",(*iter)->get_id())); + ret.push_back(strprintf("dialog.%d.comp_selector",(*iter)->get_id())); + ret.push_back(strprintf("dialog.%d.pos",(*iter)->get_id())); + ret.push_back(strprintf("dialog.%d.size",(*iter)->get_id())); + ret.push_back(strprintf("dialog.%d.contents_size",(*iter)->get_id())); + } + return ret; + } +}; + +/* === M E T H O D S ======================================================= */ + +DockManager::DockManager(): + dock_settings(new DockSettings(this)) +{ +} + +DockManager::~DockManager() +{ + while(!dock_dialog_list_.empty()) + { + dock_dialog_list_.back()->close(); + } + while(!dockable_list_.empty()) + { + Dockable* dockable(dockable_list_.back()); + // synfig::info("DockManager::~DockManager(): Deleting dockable \"%s\"",dockable->get_name().c_str()); + dockable_list_.pop_back(); + delete dockable; + } +} + +void +DockManager::register_dockable(Dockable& x) +{ + dockable_list_.push_back(&x); + // synfig::info("DockManager::register_dockable(): Registered dockable \"%s\"",dockable_list_.back()->get_name().c_str()); + signal_dockable_registered()(&x); +} + +bool +DockManager::unregister_dockable(Dockable& x) +{ + std::list::iterator iter; + for(iter=dockable_list_.begin();iter!=dockable_list_.end();++iter) + { + if(&x==*iter) + { + x.detach(); + dockable_list_.erase(iter); + synfig::info("DockManager::unregister_dockable(): \"%s\" has been Unregistered",x.get_name().c_str()); + return true; + } + } + return false; +} + +Dockable& +DockManager::find_dockable(const synfig::String& x) +{ + std::list::iterator iter; + for(iter=dockable_list_.begin();iter!=dockable_list_.end();++iter) + if((*iter)->get_name()==x) + return **iter; + + throw std::runtime_error("DockManager::find_dockable(): not found"); +} + +void +DockManager::present(synfig::String x) +{ + try + { + find_dockable(x).present(); + } + catch(...) + { + } +} + +DockDialog& +DockManager::find_dock_dialog(int id) +{ + std::list::iterator iter; + for(iter=dock_dialog_list_.begin();iter!=dock_dialog_list_.end();++iter) + if((*iter)->get_id()==id) + return **iter; + + DockDialog* dock_dialog(new DockDialog()); + dock_dialog->set_id(id); + dock_dialog->show(); + return *dock_dialog; +} + +const DockDialog& +DockManager::find_dock_dialog(int id)const +{ + std::list::const_iterator iter; + for(iter=dock_dialog_list_.begin();iter!=dock_dialog_list_.end();++iter) + if((*iter)->get_id()==id) + return **iter; + + throw std::runtime_error("DockManager::find_dock_dialog(int id)const: not found"); +} diff --git a/synfig-studio/src/gui/docks/dockmanager.h b/synfig-studio/src/gui/docks/dockmanager.h new file mode 100644 index 0000000..0949bcc --- /dev/null +++ b/synfig-studio/src/gui/docks/dockmanager.h @@ -0,0 +1,82 @@ +/* === S Y N F I G ========================================================= */ +/*! \file docks/dockmanager.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_DOCKMANAGER_H +#define __SYNFIG_DOCKMANAGER_H + +/* === H E A D E R S ======================================================= */ + +#include +#include +#include +#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 studio { + +class Dockable; +class DockDialog; +class DockSettings; + +class DockManager : public sigc::trackable +{ + friend class Dockable; + friend class DockDialog; + friend class DockSettings; + + std::list dockable_list_; + std::list dock_dialog_list_; + + sigc::signal signal_dockable_registered_; + + etl::smart_ptr dock_settings; + +public: + DockManager(); + ~DockManager(); + + DockDialog& find_dock_dialog(int id); + const DockDialog& find_dock_dialog(int id)const; + + sigc::signal& signal_dockable_registered() { return signal_dockable_registered_; } + + void register_dockable(Dockable& x); + bool unregister_dockable(Dockable& x); + Dockable& find_dockable(const synfig::String& x); + void present(synfig::String x); + +}; // END of class DockManager + +}; // END of namespace studio + +/* === E N D =============================================================== */ + +#endif diff --git a/synfig-studio/src/gui/layergrouptreestore.cpp b/synfig-studio/src/gui/layergrouptreestore.cpp index 9c947c6..332994f 100644 --- a/synfig-studio/src/gui/layergrouptreestore.cpp +++ b/synfig-studio/src/gui/layergrouptreestore.cpp @@ -39,8 +39,8 @@ #include "app.h" #include "instance.h" #include -#include "dockmanager.h" -#include "dockable.h" +#include "docks/dockmanager.h" +#include "docks/dockable.h" #include #include diff --git a/synfig-studio/src/gui/modules/mod_palette/dock_palbrowse.h b/synfig-studio/src/gui/modules/mod_palette/dock_palbrowse.h index 0b95ba8..c9d3610 100644 --- a/synfig-studio/src/gui/modules/mod_palette/dock_palbrowse.h +++ b/synfig-studio/src/gui/modules/mod_palette/dock_palbrowse.h @@ -1,5 +1,5 @@ /* === S Y N F I G ========================================================= */ -/*! \file dock_palbrowse.h +/*! \file docks/dock_palbrowse.h ** \brief Template Header ** ** $Id$ @@ -27,7 +27,7 @@ /* === H E A D E R S ======================================================= */ -#include "../../dockable.h" +#include "../../docks/dockable.h" #include /* === M A C R O S ========================================================= */ diff --git a/synfig-studio/src/gui/modules/mod_palette/dock_paledit.h b/synfig-studio/src/gui/modules/mod_palette/dock_paledit.h index 922da34..0ec12af 100644 --- a/synfig-studio/src/gui/modules/mod_palette/dock_paledit.h +++ b/synfig-studio/src/gui/modules/mod_palette/dock_paledit.h @@ -1,5 +1,5 @@ /* === S Y N F I G ========================================================= */ -/*! \file dock_paledit.h +/*! \file docks/dock_paledit.h ** \brief Template Header ** ** $Id$ @@ -44,7 +44,7 @@ #include #include -#include "../../dockable.h" +#include "../../docks/dockable.h" #include #include diff --git a/synfig-studio/src/gui/modules/mod_palette/mod_palette.cpp b/synfig-studio/src/gui/modules/mod_palette/mod_palette.cpp index 80580be..ff1c57a 100644 --- a/synfig-studio/src/gui/modules/mod_palette/mod_palette.cpp +++ b/synfig-studio/src/gui/modules/mod_palette/mod_palette.cpp @@ -34,7 +34,7 @@ #include "dock_palbrowse.h" #include "../../app.h" -#include "../../dockmanager.h" +#include "../../docks/dockmanager.h" #include "../../general.h" diff --git a/synfig-studio/src/gui/states/state_bline.cpp b/synfig-studio/src/gui/states/state_bline.cpp index ee0ca20..d020374 100644 --- a/synfig-studio/src/gui/states/state_bline.cpp +++ b/synfig-studio/src/gui/states/state_bline.cpp @@ -47,7 +47,7 @@ #include "event_mouse.h" #include "event_layerclick.h" #include "toolbox.h" -#include "dialog_tooloptions.h" +#include "docks/dialog_tooloptions.h" #include #include #include diff --git a/synfig-studio/src/gui/states/state_circle.cpp b/synfig-studio/src/gui/states/state_circle.cpp index 5ef611b..af83784 100644 --- a/synfig-studio/src/gui/states/state_circle.cpp +++ b/synfig-studio/src/gui/states/state_circle.cpp @@ -47,7 +47,7 @@ #include "event_mouse.h" #include "event_layerclick.h" #include "toolbox.h" -#include "dialog_tooloptions.h" +#include "docks/dialog_tooloptions.h" #include #include "duck.h" #include "widgets/widget_enum.h" diff --git a/synfig-studio/src/gui/states/state_draw.cpp b/synfig-studio/src/gui/states/state_draw.cpp index 4482045..8200c6b 100644 --- a/synfig-studio/src/gui/states/state_draw.cpp +++ b/synfig-studio/src/gui/states/state_draw.cpp @@ -55,7 +55,7 @@ #include #include -#include "dialog_tooloptions.h" +#include "docks/dialog_tooloptions.h" #include #include diff --git a/synfig-studio/src/gui/states/state_gradient.cpp b/synfig-studio/src/gui/states/state_gradient.cpp index 68f35c0..1e3d104 100644 --- a/synfig-studio/src/gui/states/state_gradient.cpp +++ b/synfig-studio/src/gui/states/state_gradient.cpp @@ -46,7 +46,7 @@ #include "event_mouse.h" #include "event_layerclick.h" #include "toolbox.h" -#include "dialog_tooloptions.h" +#include "docks/dialog_tooloptions.h" #include #include "duck.h" diff --git a/synfig-studio/src/gui/states/state_mirror.cpp b/synfig-studio/src/gui/states/state_mirror.cpp index 59fc759..2b1eb0a 100644 --- a/synfig-studio/src/gui/states/state_mirror.cpp +++ b/synfig-studio/src/gui/states/state_mirror.cpp @@ -46,7 +46,7 @@ #include "event_mouse.h" #include "event_layerclick.h" #include "toolbox.h" -#include "dialog_tooloptions.h" +#include "docks/dialog_tooloptions.h" #include #include "duck.h" #include diff --git a/synfig-studio/src/gui/states/state_normal.cpp b/synfig-studio/src/gui/states/state_normal.cpp index c763022..af9a840 100644 --- a/synfig-studio/src/gui/states/state_normal.cpp +++ b/synfig-studio/src/gui/states/state_normal.cpp @@ -50,7 +50,7 @@ #include "event_mouse.h" #include "event_layerclick.h" #include "toolbox.h" -#include "dialog_tooloptions.h" +#include "docks/dialog_tooloptions.h" #include #include "duck.h" #include diff --git a/synfig-studio/src/gui/states/state_polygon.cpp b/synfig-studio/src/gui/states/state_polygon.cpp index 7c11c05..f05a6de 100644 --- a/synfig-studio/src/gui/states/state_polygon.cpp +++ b/synfig-studio/src/gui/states/state_polygon.cpp @@ -47,7 +47,7 @@ #include "event_mouse.h" #include "event_layerclick.h" #include "toolbox.h" -#include "dialog_tooloptions.h" +#include "docks/dialog_tooloptions.h" #include #include "general.h" diff --git a/synfig-studio/src/gui/states/state_rectangle.cpp b/synfig-studio/src/gui/states/state_rectangle.cpp index 4f3eccb..05f52c7 100644 --- a/synfig-studio/src/gui/states/state_rectangle.cpp +++ b/synfig-studio/src/gui/states/state_rectangle.cpp @@ -47,7 +47,7 @@ #include "event_mouse.h" #include "event_layerclick.h" #include "toolbox.h" -#include "dialog_tooloptions.h" +#include "docks/dialog_tooloptions.h" #include #include "duck.h" #include diff --git a/synfig-studio/src/gui/states/state_rotate.cpp b/synfig-studio/src/gui/states/state_rotate.cpp index 5463a41..53ee7c9 100644 --- a/synfig-studio/src/gui/states/state_rotate.cpp +++ b/synfig-studio/src/gui/states/state_rotate.cpp @@ -46,7 +46,7 @@ #include "event_mouse.h" #include "event_layerclick.h" #include "toolbox.h" -#include "dialog_tooloptions.h" +#include "docks/dialog_tooloptions.h" #include #include "duck.h" #include diff --git a/synfig-studio/src/gui/states/state_scale.cpp b/synfig-studio/src/gui/states/state_scale.cpp index edfb89b..4cc6600 100644 --- a/synfig-studio/src/gui/states/state_scale.cpp +++ b/synfig-studio/src/gui/states/state_scale.cpp @@ -46,7 +46,7 @@ #include "event_mouse.h" #include "event_layerclick.h" #include "toolbox.h" -#include "dialog_tooloptions.h" +#include "docks/dialog_tooloptions.h" #include #include "duck.h" #include diff --git a/synfig-studio/src/gui/states/state_sketch.cpp b/synfig-studio/src/gui/states/state_sketch.cpp index f8b77a3..dc09816 100644 --- a/synfig-studio/src/gui/states/state_sketch.cpp +++ b/synfig-studio/src/gui/states/state_sketch.cpp @@ -54,7 +54,7 @@ #include -#include "dialog_tooloptions.h" +#include "docks/dialog_tooloptions.h" #include #include diff --git a/synfig-studio/src/gui/states/state_smoothmove.cpp b/synfig-studio/src/gui/states/state_smoothmove.cpp index f42df35..d2227cc 100644 --- a/synfig-studio/src/gui/states/state_smoothmove.cpp +++ b/synfig-studio/src/gui/states/state_smoothmove.cpp @@ -49,7 +49,7 @@ #include "event_mouse.h" #include "event_layerclick.h" #include "toolbox.h" -#include "dialog_tooloptions.h" +#include "docks/dialog_tooloptions.h" #include #include "duck.h" #include "onemoment.h" diff --git a/synfig-studio/src/gui/states/state_star.cpp b/synfig-studio/src/gui/states/state_star.cpp index 3be4b53..c5fb3ce 100644 --- a/synfig-studio/src/gui/states/state_star.cpp +++ b/synfig-studio/src/gui/states/state_star.cpp @@ -47,7 +47,7 @@ #include "event_mouse.h" #include "event_layerclick.h" #include "toolbox.h" -#include "dialog_tooloptions.h" +#include "docks/dialog_tooloptions.h" #include #include "duck.h" #include "widgets/widget_enum.h" diff --git a/synfig-studio/src/gui/states/state_text.cpp b/synfig-studio/src/gui/states/state_text.cpp index 733f907..29440b2 100644 --- a/synfig-studio/src/gui/states/state_text.cpp +++ b/synfig-studio/src/gui/states/state_text.cpp @@ -43,7 +43,7 @@ #include "event_mouse.h" #include "event_layerclick.h" #include "toolbox.h" -#include "dialog_tooloptions.h" +#include "docks/dialog_tooloptions.h" #include #include "duck.h" #include "widgets/widget_enum.h" diff --git a/synfig-studio/src/gui/states/state_width.cpp b/synfig-studio/src/gui/states/state_width.cpp index 8c74daa..32c2665 100644 --- a/synfig-studio/src/gui/states/state_width.cpp +++ b/synfig-studio/src/gui/states/state_width.cpp @@ -48,7 +48,7 @@ #include "event_mouse.h" #include "event_layerclick.h" #include "toolbox.h" -#include "dialog_tooloptions.h" +#include "docks/dialog_tooloptions.h" #include #include "duck.h" diff --git a/synfig-studio/src/gui/toolbox.cpp b/synfig-studio/src/gui/toolbox.cpp index 1b3aa46..ae6366a 100644 --- a/synfig-studio/src/gui/toolbox.cpp +++ b/synfig-studio/src/gui/toolbox.cpp @@ -71,11 +71,11 @@ #include "canvasview.h" #include "dialogs/dialog_gradient.h" #include "dialogs/dialog_color.h" -#include "dialog_tooloptions.h" +#include "docks/dialog_tooloptions.h" #include "dialogs/dialog_preview.h" -#include "dockable.h" -#include "dockmanager.h" -#include "dockdialog.h" +#include "docks/dockable.h" +#include "docks/dockmanager.h" +#include "docks/dockdialog.h" #include "widgets/widget_defaults.h" -- 2.7.4