Fix 1859663: don't use the deprecated sigc++ compatibility API. This allows sigc...
[synfig.git] / synfig-studio / trunk / src / gtkmm / app.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file app.h
3 **      \brief writeme
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **      Copyright (c) 2007 Chris Moore
10 **
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.
15 **
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.
20 **      \endlegal
21 */
22 /* ========================================================================= */
23
24 /* === S T A R T =========================================================== */
25
26 #ifndef __SYNFIG_STUDIO_APP_H
27 #define __SYNFIG_STUDIO_APP_H
28
29 /* === H E A D E R S ======================================================= */
30
31 #include <sigc++/bind.h>
32
33 #include <gtkmm/main.h>
34 #include <string>
35 #include <list>
36
37 #include <ETL/smart_ptr>
38
39 #include <synfig/distance.h>
40 #include <synfig/string.h>
41 #include <synfig/time.h>
42
43 #include <gtkmm/uimanager.h>
44
45 #include <synfigapp/instance.h>
46 #include "iconcontroller.h"
47
48 /* === M A C R O S ========================================================= */
49
50 /* === T Y P E D E F S ===================================================== */
51
52 /* === C L A S S E S & S T R U C T S ======================================= */
53
54 namespace Gtk
55 {
56         class InputDialog;
57         class UIManager;
58         class ActionGroup;
59 };
60
61 namespace synfigapp
62 {
63         class UIInterface;
64         class Main;
65 };
66
67 class Preferences;
68
69 namespace studio {
70
71 typedef Gtk::UIManager UIManager;
72
73 class Toolbox;
74 class Instance;
75 class CanvasView;
76 class Dialog_Setup;
77 class Dialog_Gradient;
78 class Dialog_Color;
79 class Dialog_ToolOptions;
80 class DeviceTracker;
81 class AutoRecover;
82
83 class DockManager;
84
85 class Dock_History;
86 class Dock_Canvases;
87
88 class Dock_Keyframes;
89 class Dock_Params;
90 class Dock_Layers;
91 class Dock_MetaData;
92 class Dock_Children;
93 class Dock_Info;
94 class Dock_Navigator;
95 class Dock_LayerGroups;
96 class IPC;
97
98 class Module;
99
100 class StateManager;
101 class IconController;
102
103 class App : public Gtk::Main, private IconController
104 {
105         friend class Preferences;
106         friend class Dialog_Setup;
107
108         /*
109  -- ** -- P U B L I C   T Y P E S ---------------------------------------------
110         */
111
112 public:
113
114         struct Busy
115         {
116                 static int count;
117                 Busy(){count++;}
118                 ~Busy(){count--;}
119         };
120
121
122         /*
123  -- ** -- P R I V A T E   D A T A ---------------------------------------------
124         */
125
126 private:
127         //static etl::handle<synfigapp::UIInterface> ui_interface_;
128         //static int max_recent_files;
129
130 /*
131         static Dock_Keyframes *dock_keyframes;
132         static Dock_Layers *dock_layers;
133         static Dock_Params *dock_params;
134         static Dock_MetaData *dock_meta_data;
135         static Dock_Children *dock_children;
136         static Dock_Info *dock_info;
137         static Dock_Navigator *dock_navigator;
138         static Dock_History *dock_history;
139         static Dock_Canvases *dock_canvases;
140         static Dock_LayerGroups *dock_layer_groups;
141
142         static IPC *ipc;
143 */
144
145         etl::smart_ptr<synfigapp::Main> synfigapp_main;
146
147
148         static etl::handle<Instance> selected_instance;
149         static etl::handle<CanvasView> selected_canvas_view;
150
151         static Glib::RefPtr<UIManager>  ui_manager_;
152
153 //      static std::list< etl::handle< Module > > module_list_;
154
155         /*
156  -- ** -- P U B L I C   D A T A -----------------------------------------------
157         */
158
159 public:
160         static Gtk::InputDialog* dialog_input;
161
162         static DeviceTracker*   device_tracker;
163         static AutoRecover*     auto_recover;
164         static DockManager* dock_manager;
165
166         static DockManager* get_dock_manager() { return dock_manager; }
167
168         static Dialog_Setup* dialog_setup;
169         static Dialog_Gradient* dialog_gradient;
170         static Dialog_Color* dialog_color;
171 //      static Dialog_Palette* dialog_palette;
172         static Dialog_ToolOptions *dialog_tool_options;
173
174         static synfig::Distance::System distance_system;
175
176         static synfig::Gamma gamma;
177
178         static Toolbox *toolbox;
179
180         static std::list<etl::handle<Instance> > instance_list;
181
182         static bool shutdown_in_progress;
183
184         static bool use_colorspace_gamma;
185
186         static bool single_threaded;
187
188         /*
189  -- ** -- S I G N A L S -------------------------------------------------------
190         */
191 /*
192         static sigc::signal<
193                 void,
194                 etl::loose_handle<CanvasView>
195         > signal_canvas_view_focus_;
196         static sigc::signal<
197                 void,
198                 etl::handle<Instance>
199         > signal_instance_selected_;
200         static sigc::signal<
201                 void,
202                 etl::handle<Instance>
203         > signal_instance_created_;
204         static sigc::signal<
205                 void,
206                 etl::handle<Instance>
207         > signal_instance_deleted_;
208         static sigc::signal<void> signal_recent_files_changed_;
209         static sigc::signal<void> signal_present_all_;
210 */
211 public:
212
213         static sigc::signal<void> &signal_present_all();
214
215         static sigc::signal<void> &signal_recent_files_changed();
216
217         static sigc::signal<
218                 void,
219                 etl::loose_handle<CanvasView>
220         >& signal_canvas_view_focus();
221
222         static sigc::signal<
223                 void,
224                 etl::handle<Instance>
225         > &signal_instance_selected();
226
227         static sigc::signal<
228                 void,
229                 etl::handle<Instance>
230         > &signal_instance_created();
231
232         static sigc::signal<
233                 void,
234                 etl::handle<Instance>
235         > &signal_instance_deleted();
236
237         /*
238  -- ** -- P R I V A T E   M E T H O D S ---------------------------------------
239         */
240
241 private:
242
243         /*
244  -- ** -- P U B L I C   M E T H O D S -----------------------------------------
245         */
246
247 public:
248
249         App(int *argc, char ***argv);
250         virtual ~App();
251
252         /*
253  -- ** -- S T A T I C   P U B L I C   M E T H O D S ---------------------------
254         */
255
256 public:
257
258         static StateManager* get_state_manager();
259
260         static Glib::RefPtr<UIManager>& ui_manager() { return ui_manager_; }
261
262         static void add_recent_file(const std::string &filename);
263
264         static synfig::String get_base_path();
265         static void save_settings();
266         static void load_settings();
267         static void reset_initial_window_configuration();
268
269         static const std::list<std::string>& get_recent_files();
270
271         static const etl::handle<synfigapp::UIInterface>& get_ui_interface();
272
273
274         static void set_selected_instance(etl::loose_handle<Instance> instance);
275         static void set_selected_canvas_view(etl::loose_handle<CanvasView>);
276
277         static etl::loose_handle<Instance> get_instance(etl::handle<synfig::Canvas> canvas);
278
279         static etl::loose_handle<Instance> get_selected_instance() { return selected_instance; }
280         static etl::loose_handle<CanvasView> get_selected_canvas_view() { return selected_canvas_view; }
281
282         static bool open(std::string filename);
283
284         static bool open_as(std::string filename,std::string as);
285
286         static void new_instance();
287
288         static void dialog_open();
289
290         static void dialog_about();
291
292         static void quit();
293
294         static void show_setup();
295
296         static void undo();
297         static void redo();
298
299         static int get_max_recent_files();
300         static void set_max_recent_files(int x);
301
302
303         static synfig::Time::Format get_time_format();
304         static void set_time_format(synfig::Time::Format x);
305
306         static bool shutdown_request(GdkEventAny*bleh=NULL);
307
308 //      static bool dialog_file(const std::string &title, std::string &filename);
309
310         static bool dialog_open_file(const std::string &title, std::string &filename);
311         static bool dialog_save_file(const std::string &title, std::string &filename);
312
313         static void dialog_error_blocking(const std::string &title, const std::string &message);
314
315         static void dialog_warning_blocking(const std::string &title, const std::string &message);
316
317         static bool dialog_entry(const std::string &title, const std::string &message,std::string &text);
318
319         static bool dialog_yes_no(const std::string &title, const std::string &message);
320
321         static int dialog_yes_no_cancel(const std::string &title, const std::string &message);
322
323         static void dialog_not_implemented();
324
325         static synfig::String get_user_app_directory();
326         static synfig::String get_config_file(const synfig::String& file);
327 }; // END of class App
328
329         void delete_widget(Gtk::Widget *widget);
330
331 }; // END namespace studio
332
333 /* === E N D =============================================================== */
334
335 #endif