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

# dialog_setup.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_DIALOG_SETUP_H
    00028 #define __SYNFIG_STUDIO_DIALOG_SETUP_H
    00029
    00030 /* === H E A D E R S ======================================================= */
    00031
    00032 #include <gtk/gtk.h>
    00033 #include <gtkmm/adjustment.h>
    00034 #include <gtkmm/table.h>
    00035 #include <gtkmm/button.h>
    00036 #include <gtkmm/dialog.h>
    00037 #include <gtkmm/drawingarea.h>
    00038 #include <gtkmm/optionmenu.h>
    00039 #include <gtkmm/checkbutton.h>
    00040 #include <gtkmm/widget_time.h>
    00041 #include <gtkmm/tooltips.h>
    00042 #include <gtkmm/comboboxtext.h>
    00043 #include <gtkmm/spinbutton.h>
    00044
    00045 #include <synfig/gamma.h>
    00046 #include <synfig/time.h>
    00047 #include <algorithm>
    00048
    00049 /* === M A C R O S ========================================================= */
    00050 #ifndef DEFAULT_PREDEFINED_SIZE
    00051 #define DEFAULT_PREDEFINED_SIZE _("Custom Size")
    00052 #endif
    00053 #ifndef DEFAULT_PREDEFINED_FPS
    00054 #define DEFAULT_PREDEFINED_FPS _("Custom fps")
    00055 #endif
    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 { class Menu; };
    00062
    00063 namespace studio {
    00064
    00065 class GammaPattern : public Gtk::DrawingArea
    00066 {
    00067     float gamma_r;
    00068     float gamma_g;
    00069     float gamma_b;
    00070     float black_level;
    00071     float red_blue_level;
    00072
    00073     int tile_w, tile_h;
    00074
    00075     Gdk::Color black[4],white[4],gray50[4],gray25[4];
    00076
    00077     float r_F32_to_F32(float x)const { float f((pow(x,gamma_r)*std::min(red_blue_level,1.0f)*(1.0f-black_level)+black_level)); if(f<0)f=0; if(f>1)f=1; return f; }
    00078     float g_F32_to_F32(float x)const { float f((pow(x,gamma_g)*sqrt(std::min(2.0f-red_blue_level,red_blue_level))*(1.0f-black_level)+black_level)); if(f<0)f=0; if(f>1)f=1; return f; }
    00079     float b_F32_to_F32(float x)const { float f((pow(x,gamma_b)*std::min(2.0f-red_blue_level,1.0f)*(1.0f-black_level)+black_level)); if(f<0)f=0; if(f>1)f=1; return f; }
    00080
    00081 public:
    00082
    00083     void refresh();
    00084
    00085     void set_gamma_r(float x) { gamma_r=x; }
    00086     void set_gamma_g(float x) { gamma_g=x; };
    00087     void set_gamma_b(float x) { gamma_b=x; };
    00088     void set_black_level(float x) { black_level=x; };
    00089     void set_red_blue_level(float x) { red_blue_level=x; };
    00090
    00091     float get_gamma_r()const { return gamma_r; }
    00092     float get_gamma_g()const { return gamma_g; }
    00093     float get_gamma_b()const { return gamma_b; }
    00094     float get_black_level()const { return black_level; }
    00095     float get_red_blue_level()const { return red_blue_level; }
    00096
    00097     GammaPattern();
    00098
    00099     ~GammaPattern();
    00100
    00101     bool redraw(GdkEventExpose*bleh=NULL);
    00102 }; // END of class GammaPattern
    00103
    00104 class BlackLevelSelector : public Gtk::DrawingArea
    00105 {
    00106     float level;
    00107
    00108     sigc::signal<void> signal_value_changed_;
    00109
    00110 public:
    00111
    00112     BlackLevelSelector();
    00113
    00114     ~BlackLevelSelector();
    00115
    00116     sigc::signal<void>& signal_value_changed() { return signal_value_changed_; }
    00117
    00118     void set_value(float x) { level=x; queue_draw(); }
    00119
    00120     const float &get_value()const { return level; }
    00121
    00122     bool redraw(GdkEventExpose*bleh=NULL);
    00123
    00124     bool on_event(GdkEvent *event);
    00125 }; // END of class BlackLevelSelector
    00126
    00127 class RedBlueLevelSelector : public Gtk::DrawingArea
    00128 {
    00129     float level;
    00130
    00131     sigc::signal<void> signal_value_changed_;
    00132
    00133 public:
    00134
    00135     RedBlueLevelSelector();
    00136
    00137     ~RedBlueLevelSelector();
    00138
    00139     sigc::signal<void>& signal_value_changed() { return signal_value_changed_; }
    00140
    00141     void set_value(float x) { level=x; queue_draw(); }
    00142
    00143     const float &get_value()const { return level; }
    00144
    00145     bool redraw(GdkEventExpose*bleh=NULL);
    00146
    00147     bool on_event(GdkEvent *event);
    00148 }; // END of class RedBlueSelector
    00149
    00150 class Widget_Enum;
    00151
    00152 class Dialog_Setup : public Gtk::Dialog
    00153 {
    00154
    00155     void on_ok_pressed();
    00156     void on_apply_pressed();
    00157
    00158     void on_gamma_r_change();
    00159     void on_gamma_g_change();
    00160     void on_gamma_b_change();
    00161     void on_black_level_change();
    00162     void on_red_blue_level_change();
    00163     void on_size_template_combo_change();
    00164     void on_fps_template_combo_change();
    00165
    00166     GammaPattern gamma_pattern;
    00167     BlackLevelSelector black_level_selector;
    00168     RedBlueLevelSelector red_blue_level_selector;
    00169     Gtk::OptionMenu timestamp_optionmenu;
    00170
    00171     Gtk::Adjustment adj_gamma_r;
    00172     Gtk::Adjustment adj_gamma_g;
    00173     Gtk::Adjustment adj_gamma_b;
    00174
    00175     Gtk::Adjustment adj_recent_files;
    00176     Gtk::Adjustment adj_undo_depth;
    00177
    00178     Gtk::CheckButton toggle_use_colorspace_gamma;
    00179 #ifdef SINGLE_THREADED
    00180     Gtk::CheckButton toggle_single_threaded;
    00181 #endif
    00182
    00183     synfig::Time::Format time_format;
    00184
    00185     Gtk::Menu *timestamp_menu;
    00186     Widget_Enum *widget_enum;
    00187
    00188     Widget_Time auto_backup_interval;
    00189
    00190     Gtk::CheckButton toggle_restrict_radius_ducks;
    00191     Gtk::CheckButton toggle_resize_imported_images;
    00192
    00193     Gtk::Entry textbox_browser_command;
    00194
    00195     Gtk::ComboBoxText* size_template_combo;
    00196     Gtk::ComboBoxText* fps_template_combo;
    00197     Gtk::Entry textbox_custom_filename_prefix;
    00198     Gtk::Adjustment adj_pref_x_size;
    00199     Gtk::Adjustment adj_pref_y_size;
    00200     Gtk::Adjustment adj_pref_fps;
    00201     Gtk::SpinButton* pref_fps_spinbutton;
    00202     Gtk::SpinButton* pref_y_size_spinbutton;
    00203     Gtk::SpinButton* pref_x_size_spinbutton;
    00204     Gtk::Tooltips tooltips_;
    00205 public:
    00206
    00207     void set_time_format(synfig::Time::Format time_format);
    00208
    00209     const synfig::Time::Format& get_time_format()const { return time_format; }
    00210
    00211     Dialog_Setup();
    00212     ~Dialog_Setup();
    00213
    00214     void refresh();
    00215
    00216 }; // END of Dialog_Waypoint
    00217
    00218 }; // END of namespace studio
    00219
    00220 /* === E N D =============================================================== */
    00221
    00222 #endif