- Main Page
- Related Pages
- Namespaces
- Classes
- Files

# app.h

Go to the documentation of this file.

    00001 /* === S Y N F I G ========================================================= */
    00023 /* ========================================================================= */
    00024
    00025 /* === S T A R T =========================================================== */
    00026
    00027 #ifndef __SYNFIG_STUDIO_APP_H
    00028 #define __SYNFIG_STUDIO_APP_H
    00029
    00030 /* === H E A D E R S ======================================================= */
    00031
    00032 #include <sigc++/bind.h>
    00033
    00034 #include <gtkmm/main.h>
    00035 #include <string>
    00036 #include <list>
    00037
    00038 #include <ETL/smart_ptr>
    00039
    00040 #include <synfig/distance.h>
    00041 #include <synfig/string.h>
    00042 #include <synfig/time.h>
    00043
    00044 #include <gtkmm/uimanager.h>
    00045
    00046 #include <synfigapp/instance.h>
    00047 #include "iconcontroller.h"
    00048
    00049 /* === M A C R O S ========================================================= */
    00050
    00051 #define MISC_DIR_PREFERENCE         "misc_dir"
    00052 #define ANIMATION_DIR_PREFERENCE    "animation_dir"
    00053 #define IMAGE_DIR_PREFERENCE        "image_dir"
    00054 #define SKETCH_DIR_PREFERENCE       "sketch_dir"
    00055 #define RENDER_DIR_PREFERENCE       "render_dir"
    00056
    00057 /* === T Y P E D E F S ===================================================== */
    00058
    00059 /* === C L A S S E S & S T R U C T S ======================================= */
    00060
    00061 namespace Gtk
    00062 {
    00063     class InputDialog;
    00064     class UIManager;
    00065     class ActionGroup;
    00066 };
    00067
    00068 namespace synfigapp
    00069 {
    00070     class UIInterface;
    00071     class Main;
    00072 };
    00073
    00074 class Preferences;
    00075
    00076 namespace studio {
    00077
    00078 typedef Gtk::UIManager UIManager;
    00079
    00080 class About;
    00081 class Toolbox;
    00082 class Instance;
    00083 class CanvasView;
    00084 class Dialog_Setup;
    00085 class Dialog_Gradient;
    00086 class Dialog_Color;
    00087 class Dialog_ToolOptions;
    00088 class DeviceTracker;
    00089 class AutoRecover;
    00090
    00091 class DockManager;
    00092
    00093 class Dock_History;
    00094 class Dock_Canvases;
    00095
    00096 class Dock_Keyframes;
    00097 class Dock_Params;
    00098 class Dock_Layers;
    00099 class Dock_MetaData;
    00100 class Dock_Children;
    00101 class Dock_Info;
    00102 class Dock_Navigator;
    00103 class Dock_LayerGroups;
    00104 class IPC;
    00105
    00106 class Module;
    00107
    00108 class StateManager;
    00109 class IconController;
    00110
    00111 class App : public Gtk::Main, private IconController
    00112 {
    00113     friend class Preferences;
    00114     friend class Dialog_Setup;
    00115
    00116     /*
    00117  -- ** -- P U B L I C   T Y P E S ---------------------------------------------
    00118     */
    00119
    00120 public:
    00121
    00122     struct Busy
    00123     {
    00124         static int count;
    00125         Busy(){count++;}
    00126         ~Busy(){count--;}
    00127     };
    00128
    00129
    00130     /*
    00131  -- ** -- P R I V A T E   D A T A ---------------------------------------------
    00132     */
    00133
    00134 private:
    00135     //static etl::handle<synfigapp::UIInterface> ui_interface_;
    00136     //static int max_recent_files;
    00137
    00138 /*
    00139     static Dock_Keyframes *dock_keyframes;
    00140     static Dock_Layers *dock_layers;
    00141     static Dock_Params *dock_params;
    00142     static Dock_MetaData *dock_meta_data;
    00143     static Dock_Children *dock_children;
    00144     static Dock_Info *dock_info;
    00145     static Dock_Navigator *dock_navigator;
    00146     static Dock_History *dock_history;
    00147     static Dock_Canvases *dock_canvases;
    00148     static Dock_LayerGroups *dock_layer_groups;
    00149
    00150     static IPC *ipc;
    00151 */
    00152
    00153     etl::smart_ptr<synfigapp::Main> synfigapp_main;
    00154
    00155
    00156     static etl::handle<Instance> selected_instance;
    00157     static etl::handle<CanvasView> selected_canvas_view;
    00158
    00159     static Glib::RefPtr<UIManager>  ui_manager_;
    00160
    00161 //  static std::list< etl::handle< Module > > module_list_;
    00162
    00163     /*
    00164  -- ** -- P U B L I C   D A T A -----------------------------------------------
    00165     */
    00166
    00167 public:
    00168     static Gtk::InputDialog* dialog_input;
    00169
    00170     static DeviceTracker*   device_tracker;
    00171     static AutoRecover* auto_recover;
    00172     static DockManager* dock_manager;
    00173
    00174     static DockManager* get_dock_manager() { return dock_manager; }
    00175
    00176     static Dialog_Setup* dialog_setup;
    00177     static Dialog_Gradient* dialog_gradient;
    00178     static Dialog_Color* dialog_color;
    00179 //  static Dialog_Palette* dialog_palette;
    00180     static Dialog_ToolOptions *dialog_tool_options;
    00181
    00182     static synfig::Distance::System distance_system;
    00183
    00184     static synfig::Gamma gamma;
    00185
    00186     static About *about;
    00187     static Toolbox *toolbox;
    00188
    00189     static std::list<etl::handle<Instance> > instance_list;
    00190
    00191     static bool shutdown_in_progress;
    00192
    00193     static bool use_colorspace_gamma;
    00194
    00195 #ifdef SINGLE_THREADED
    00196     static bool single_threaded;
    00197 #endif
    00198
    00199     static bool restrict_radius_ducks;
    00200     static bool resize_imported_images;
    00201
    00202     static synfig::String browser_command;
    00203     static synfig::String custom_filename_prefix;
    00204     static int preferred_x_size;
    00205     static int preferred_y_size;
    00206     static synfig::String predefined_size;
    00207     static synfig::String predefined_fps;
    00208     static float preferred_fps;
    00209     /*
    00210  -- ** -- S I G N A L S -------------------------------------------------------
    00211     */
    00212 /*
    00213     static sigc::signal<
    00214         void,
    00215         etl::loose_handle<CanvasView>
    00216     > signal_canvas_view_focus_;
    00217     static sigc::signal<
    00218         void,
    00219         etl::handle<Instance>
    00220     > signal_instance_selected_;
    00221     static sigc::signal<
    00222         void,
    00223         etl::handle<Instance>
    00224     > signal_instance_created_;
    00225     static sigc::signal<
    00226         void,
    00227         etl::handle<Instance>
    00228     > signal_instance_deleted_;
    00229     static sigc::signal<void> signal_recent_files_changed_;
    00230     static sigc::signal<void> signal_present_all_;
    00231 */
    00232 public:
    00233
    00234     static sigc::signal<void> &signal_present_all();
    00235
    00236     static sigc::signal<void> &signal_recent_files_changed();
    00237
    00238     static sigc::signal<
    00239         void,
    00240         etl::loose_handle<CanvasView>
    00241     >& signal_canvas_view_focus();
    00242
    00243     static sigc::signal<
    00244         void,
    00245         etl::handle<Instance>
    00246     > &signal_instance_selected();
    00247
    00248     static sigc::signal<
    00249         void,
    00250         etl::handle<Instance>
    00251     > &signal_instance_created();
    00252
    00253     static sigc::signal<
    00254         void,
    00255         etl::handle<Instance>
    00256     > &signal_instance_deleted();
    00257
    00258     /*
    00259  -- ** -- P R I V A T E   M E T H O D S ---------------------------------------
    00260     */
    00261
    00262 private:
    00263     static void add_recent_file(const std::string &filename, const std::string &window_size = std::string());
    00264
    00265     /*
    00266  -- ** -- P U B L I C   M E T H O D S -----------------------------------------
    00267     */
    00268
    00269 public:
    00270
    00271     App(int *argc, char ***argv);
    00272     virtual ~App();
    00273
    00274     /*
    00275  -- ** -- S T A T I C   P U B L I C   M E T H O D S ---------------------------
    00276     */
    00277
    00278 public:
    00279
    00280     static StateManager* get_state_manager();
    00281
    00282     static Glib::RefPtr<UIManager>& ui_manager() { return ui_manager_; }
    00283
    00284     static void set_recent_file_window_size(etl::handle<Instance> instance);
    00285     static void add_recent_file(const etl::handle<Instance> instance);
    00286
    00287     static synfig::String get_base_path();
    00288     static void save_settings();
    00289     static void load_settings();
    00290     static void reset_initial_window_configuration();
    00291
    00292     static const std::list<std::string>& get_recent_files();
    00293
    00294     static const etl::handle<synfigapp::UIInterface>& get_ui_interface();
    00295
    00296
    00297     static void set_selected_instance(etl::loose_handle<Instance> instance);
    00298     static void set_selected_canvas_view(etl::loose_handle<CanvasView>);
    00299
    00300     static etl::loose_handle<Instance> get_instance(etl::handle<synfig::Canvas> canvas);
    00301
    00302     static etl::loose_handle<Instance> get_selected_instance() { return selected_instance; }
    00303     static etl::loose_handle<CanvasView> get_selected_canvas_view() { return selected_canvas_view; }
    00304
    00305     static bool open(std::string filename);
    00306
    00307     static bool open_as(std::string filename,std::string as);
    00308
    00309     static void new_instance();
    00310
    00311     static void dialog_open(std::string filename = "");
    00312
    00313     static void dialog_about();
    00314
    00315     static void quit();
    00316
    00317     static void show_setup();
    00318
    00319     static void undo();
    00320     static void redo();
    00321
    00322     static int get_max_recent_files();
    00323     static void set_max_recent_files(int x);
    00324
    00325
    00326     static synfig::Time::Format get_time_format();
    00327     static void set_time_format(synfig::Time::Format x);
    00328
    00329     static bool shutdown_request(GdkEventAny*bleh=NULL);
    00330
    00331 //  static bool dialog_file(const std::string &title, std::string &filename);
    00332
    00333     static bool dialog_open_file(const std::string &title, std::string &filename, std::string preference);
    00334     static bool dialog_save_file(const std::string &title, std::string &filename, std::string preference);
    00335
    00336     static void dialog_error_blocking(const std::string &title, const std::string &message);
    00337
    00338     static void dialog_warning_blocking(const std::string &title, const std::string &message);
    00339
    00340     static bool dialog_entry(const std::string &title, const std::string &message,std::string &text);
    00341     static bool dialog_paragraph(const std::string &title, const std::string &message,std::string &text);
    00342
    00343     static bool dialog_yes_no(const std::string &title, const std::string &message);
    00344
    00345     static int dialog_yes_no_cancel(const std::string &title, const std::string &message);
    00346
    00347     static void dialog_not_implemented();
    00348
    00349     static void dialog_help();
    00350
    00351     static void open_url(const std::string &url);
    00352
    00353     static synfig::String get_user_app_directory();
    00354     static synfig::String get_config_file(const synfig::String& file);
    00355 }; // END of class App
    00356
    00357     void delete_widget(Gtk::Widget *widget);
    00358
    00359 }; // END namespace studio
    00360
    00361 /* === E N D =============================================================== */
    00362
    00363 #endif