1 /* === S Y N F I G ========================================================= */
2 /*! \file asyncrenderer.h
3 ** \brief Template Header
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 ** Copyright (c) 2007 Chris Moore
11 ** This package is free software; you can redistribute it and/or
12 ** modify it under the terms of the GNU General Public License as
13 ** published by the Free Software Foundation; either version 2 of
14 ** the License, or (at your option) any later version.
16 ** This package is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ** General Public License for more details.
22 /* ========================================================================= */
24 /* === S T A R T =========================================================== */
26 #ifndef __SYNFIG_ASYNCRENDERER_H
27 #define __SYNFIG_ASYNCRENDERER_H
29 /* === H E A D E R S ======================================================= */
32 #include <sigc++/signal.h>
33 #include <sigc++/trackable.h>
34 #include <sigc++/connection.h>
36 #include <synfig/target_scanline.h>
37 #include <synfig/target_tile.h>
38 #include <synfig/surface.h>
39 #include <glibmm/main.h>
40 #include <ETL/ref_count>
41 #include <glibmm/thread.h>
42 #include <glibmm/dispatcher.h>
44 /* === M A C R O S ========================================================= */
46 #define single_threaded() App::single_threaded
47 #define NotLock Glib::NOT_LOCK
49 /* === T Y P E D E F S ===================================================== */
51 /* === C L A S S E S & S T R U C T S ======================================= */
55 class AsyncRenderer : public etl::shared_object, public sigc::trackable
57 sigc::signal<void> signal_finished_;
58 sigc::signal<void> signal_success_;
60 std::list<sigc::connection> activity_connection_list;
62 //etl::handle<synfig::Target_Scanline> target_scanline;
63 //etl::handle<synfig::Target_Tile> target_tile;
64 etl::handle<synfig::Target> target;
69 synfig::ProgressCallback *cb;
71 sigc::signal<void> signal_stop_;
73 Glib::Thread* render_thread;
74 Glib::Dispatcher signal_done_;
76 sigc::connection done_connection;
79 -- ** -- P A R E N T M E M B E R S -----------------------------------------
83 AsyncRenderer(etl::handle<synfig::Target> target,synfig::ProgressCallback *cb=0);
84 virtual ~AsyncRenderer();
90 void rendering_progress();
92 bool has_error()const { return error; }
93 bool has_success()const { return success; }
97 sigc::signal<void>& signal_finished() { return signal_finished_; }
98 sigc::signal<void>& signal_success() { return signal_success_; }
102 void render_target();
106 -- ** -- C H I L D M E M B E R S -------------------------------------------
113 }; // END of namespace studio
115 /* === E N D =============================================================== */