1 /* === S Y N F I G ========================================================= */
5 ** $Id: app.h,v 1.2 2005/01/13 21:11:16 darco Exp $
8 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
14 ** You may not copy, print, publish, or in any
15 ** other way distribute this software without
16 ** a prior written agreement with
17 ** the copyright holder.
20 /* ========================================================================= */
22 /* === S T A R T =========================================================== */
24 #ifndef __SYNFIG_STUDIO_APP_H
25 #define __SYNFIG_STUDIO_APP_H
27 /* === H E A D E R S ======================================================= */
29 #include <sigc++/compatibility.h>
30 #include <sigc++/bind.h>
32 #include <gtkmm/main.h>
36 #include <ETL/smart_ptr>
38 #include <synfig/distance.h>
39 #include <synfig/string.h>
40 #include <synfig/time.h>
42 #include <gtkmm/uimanager.h>
44 #include <synfigapp/instance.h>
45 #include "iconcontroler.h"
47 /* === M A C R O S ========================================================= */
49 /* === T Y P E D E F S ===================================================== */
51 /* === C L A S S E S & S T R U C T S ======================================= */
70 typedef Gtk::UIManager UIManager;
76 class Dialog_Gradient;
78 class Dialog_ToolOptions;
94 class Dock_LayerGroups;
102 class App : public Gtk::Main, private IconControler
104 friend class Preferences;
105 friend class Dialog_Setup;
108 -- ** -- P U B L I C T Y P E S ---------------------------------------------
122 -- ** -- P R I V A T E D A T A ---------------------------------------------
126 //static etl::handle<synfigapp::UIInterface> ui_interface_;
127 //static int max_recent_files;
130 static Dock_Keyframes *dock_keyframes;
131 static Dock_Layers *dock_layers;
132 static Dock_Params *dock_params;
133 static Dock_MetaData *dock_meta_data;
134 static Dock_Children *dock_children;
135 static Dock_Info *dock_info;
136 static Dock_Navigator *dock_navigator;
137 static Dock_History *dock_history;
138 static Dock_Canvases *dock_canvases;
139 static Dock_LayerGroups *dock_layer_groups;
144 etl::smart_ptr<synfigapp::Main> synfigapp_main;
147 static etl::handle<Instance> selected_instance;
148 static etl::handle<CanvasView> selected_canvas_view;
150 static Glib::RefPtr<UIManager> ui_manager_;
152 // static std::list< etl::handle< Module > > module_list_;
155 -- ** -- P U B L I C D A T A -----------------------------------------------
159 static Gtk::InputDialog* dialog_input;
161 static DeviceTracker* device_tracker;
162 static AutoRecover* auto_recover;
163 static DockManager* dock_manager;
165 static DockManager* get_dock_manager() { return dock_manager; }
167 static Dialog_Setup* dialog_setup;
168 static Dialog_Gradient* dialog_gradient;
169 static Dialog_Color* dialog_color;
170 // static Dialog_Palette* dialog_palette;
171 static Dialog_ToolOptions *dialog_tool_options;
173 static synfig::Distance::System distance_system;
175 static synfig::Gamma gamma;
177 static Toolbox *toolbox;
179 static std::list<etl::handle<Instance> > instance_list;
181 static bool shutdown_in_progress;
183 static bool use_colorspace_gamma;
186 -- ** -- S I G N A L S -------------------------------------------------------
191 etl::loose_handle<CanvasView>
192 > signal_canvas_view_focus_;
195 etl::handle<Instance>
196 > signal_instance_selected_;
199 etl::handle<Instance>
200 > signal_instance_created_;
203 etl::handle<Instance>
204 > signal_instance_deleted_;
205 static sigc::signal<void> signal_recent_files_changed_;
206 static sigc::signal<void> signal_present_all_;
210 static sigc::signal<void> &signal_present_all();
212 static sigc::signal<void> &signal_recent_files_changed();
216 etl::loose_handle<CanvasView>
217 >& signal_canvas_view_focus();
221 etl::handle<Instance>
222 > &signal_instance_selected();
226 etl::handle<Instance>
227 > &signal_instance_created();
231 etl::handle<Instance>
232 > &signal_instance_deleted();
235 -- ** -- P R I V A T E M E T H O D S ---------------------------------------
241 -- ** -- P U B L I C M E T H O D S -----------------------------------------
246 App(int *argc, char ***argv);
250 -- ** -- S T A T I C P U B L I C M E T H O D S ---------------------------
255 static StateManager* get_state_manager();
257 static Glib::RefPtr<UIManager>& ui_manager() { return ui_manager_; }
259 static void add_recent_file(const std::string &filename);
261 static synfig::String get_base_path();
262 static void save_settings();
263 static void load_settings();
265 static const std::list<std::string>& get_recent_files();
267 static const etl::handle<synfigapp::UIInterface>& get_ui_interface();
270 static void set_selected_instance(etl::loose_handle<Instance> instance);
271 static void set_selected_canvas_view(etl::loose_handle<CanvasView>);
273 static etl::loose_handle<Instance> get_instance(etl::handle<synfig::Canvas> canvas);
275 static etl::loose_handle<Instance> get_selected_instance() { return selected_instance; }
276 static etl::loose_handle<CanvasView> get_selected_canvas_view() { return selected_canvas_view; }
278 static bool open(std::string filename);
280 static bool open_as(std::string filename,std::string as);
282 static void new_instance();
284 static void dialog_open();
286 static void dialog_about();
290 static void show_setup();
295 static int get_max_recent_files();
296 static void set_max_recent_files(int x);
299 static synfig::Time::Format get_time_format();
300 static void set_time_format(synfig::Time::Format x);
302 static bool shutdown_request(GdkEventAny*bleh=NULL);
304 // static bool dialog_file(const std::string &title, std::string &filename);
306 static bool dialog_open_file(const std::string &title, std::string &filename);
307 static bool dialog_save_file(const std::string &title, std::string &filename);
308 static bool dialog_saveas_file(const std::string &title, std::string &filename);
310 static void dialog_error_blocking(const std::string &title, const std::string &message);
312 static void dialog_warning_blocking(const std::string &title, const std::string &message);
314 static bool dialog_entry(const std::string &title, const std::string &message,std::string &text);
316 static bool dialog_yes_no(const std::string &title, const std::string &message);
318 static int dialog_yes_no_cancel(const std::string &title, const std::string &message);
320 static void dialog_not_implemented();
322 static synfig::String get_user_app_directory();
323 static synfig::String get_config_file(const synfig::String& file);
324 }; // END of class App
326 }; // END namespace studio
328 /* === E N D =============================================================== */