File indexing completed on 2024-06-16 05:11:32

0001 #ifndef EMERALD_LIBENGINE_H
0002 #define EMERALD_LIBENGINE_H
0003 #include <emerald.h>
0004 void copy_from_defaults_if_needed();
0005 void load_color_setting(GKeyFile * f, decor_color_t * color, const gchar * key, const gchar * sect);
0006 void load_shadow_color_setting(GKeyFile * f, gint sc[3], const gchar * key, const gchar * sect);
0007 void load_float_setting(GKeyFile * f, gdouble * d, const gchar * key, const gchar * sect);
0008 void load_int_setting(GKeyFile * f, gint * i, const gchar * key, const gchar * sect);
0009 void load_bool_setting(GKeyFile * f, gboolean * b, const gchar * key, const gchar * sect);
0010 void load_font_setting(GKeyFile * f, PangoFontDescription ** fd, const gchar * key, const gchar * sect);
0011 void load_string_setting(GKeyFile * f, gchar ** s, const gchar * key, const gchar * sect);
0012 void cairo_set_source_alpha_color(cairo_t * cr, alpha_color * c);
0013 #define PFACS(zc) \
0014     load_color_setting(f,&((private_fs *)ws->fs_act->engine_fs)->zc.color,"active_" #zc ,SECT);\
0015     load_color_setting(f,&((private_fs *)ws->fs_inact->engine_fs)->zc.color,"inactive_" #zc ,SECT);\
0016     load_float_setting(f,&((private_fs *)ws->fs_act->engine_fs)->zc.alpha,"active_" #zc "_alpha",SECT);\
0017     load_float_setting(f,&((private_fs *)ws->fs_inact->engine_fs)->zc.alpha,"inactive_" #zc "_alpha",SECT);
0018 
0019 void 
0020 fill_rounded_rectangle (cairo_t       *cr,
0021         double        x,
0022         double        y,
0023         double        w,
0024         double        h,
0025         int       corner,
0026         alpha_color * c0,
0027         alpha_color * c1,
0028         int       gravity,
0029         window_settings * ws,
0030         double        radius);
0031 void
0032 rounded_rectangle (cairo_t *cr,
0033         double  x,
0034         double  y,
0035         double  w,
0036         double  h,
0037         int    corner,
0038         window_settings * ws,
0039         double  radius);
0040 
0041 //////////////////////////////////////////////////////
0042 //themer stuff
0043 typedef struct _EngineMetaInfo
0044 {
0045     gchar * description;
0046     gchar * version;
0047     gchar * last_compat;
0048     GdkPixbuf * icon;
0049 } EngineMetaInfo;
0050 typedef enum _SettingType
0051 {
0052     ST_BOOL,
0053     ST_INT,
0054     ST_FLOAT,
0055     ST_COLOR,
0056     ST_FONT,
0057     ST_META_STRING,
0058     ST_IMG_FILE,
0059     ST_STRING_COMBO,
0060     ST_SFILE_INT_COMBO,
0061     ST_ENGINE_COMBO,
0062     ST_SFILE_BOOL,
0063     ST_SFILE_INT,
0064     ST_NUM
0065 } SettingType;
0066 typedef struct _SettingItem
0067 {
0068     SettingType type;
0069     gchar * key;
0070     gchar * section;
0071     GtkWidget * widget;
0072     
0073     gchar * fvalue;
0074     GtkImage * image;
0075     GtkImage * preview;
0076 } SettingItem;
0077 
0078 #include <titlebar.h>
0079 
0080 #define gtk_box_pack_startC(a,b,c,d,e) gtk_box_pack_start(GTK_BOX(a),GTK_WIDGET(b),c,d,e)
0081 #define gtk_box_pack_endC(a,b,c,d,e) gtk_box_pack_end(GTK_BOX(a),b,c,d,e)
0082 #define gtk_container_addC(a,b) gtk_container_add(GTK_CONTAINER(a),b)
0083 #define gtk_container_set_border_widthC(a,b) gtk_container_set_border_width(GTK_CONTAINER(a),b)
0084 
0085 #define ACAV(caption,basekey,sect) add_color_alpha_value(caption,basekey,sect,active)
0086 
0087 gboolean get_engine_meta_info(const gchar * engine, EngineMetaInfo * inf); // returns FALSE if couldn't find engine
0088 
0089 GtkWidget * scaler_new(gdouble low, gdouble high, gdouble prec);
0090 void add_color_alpha_value(gchar * caption, gchar * basekey, gchar * sect, gboolean active);
0091 
0092 void make_labels(gchar * header);
0093 GtkWidget * build_frame(GtkWidget * vbox, gchar * title, gboolean is_hbox);
0094 SettingItem * register_setting(GtkWidget * widget, SettingType type, gchar * section, gchar * key);
0095 SettingItem * register_img_file_setting(GtkWidget * widget, gchar * section, gchar * key, GtkImage * image);
0096 void table_new(gint width, gboolean same, gboolean labels);
0097 void table_append(GtkWidget * child,gboolean stretch);
0098 void table_append_separator();
0099 GtkTable * get_current_table();
0100 
0101 void send_reload_signal();
0102 void apply_settings();
0103 void cb_apply_setting(GtkWidget * w, gpointer p);
0104 #ifdef USE_DBUS
0105 void setup_dbus();
0106 #endif
0107 void write_setting(SettingItem * item, gpointer p);
0108 void write_setting_file();
0109 gboolean get_bool(SettingItem * item);
0110 gdouble get_float(SettingItem * item);
0111 gint get_int(SettingItem * item);
0112 const gchar * get_float_str(SettingItem * item);
0113 const gchar * get_color(SettingItem * item);
0114 const gchar * get_font(SettingItem * item);
0115 const gchar * get_string(SettingItem * item);
0116 void check_file(SettingItem * item,gchar * f);
0117 const gchar * get_file(SettingItem * item);
0118 const gchar * get_string_combo(SettingItem * item);
0119 gint get_sf_int_combo(SettingItem * item);
0120 void update_preview(GtkFileChooser * fc, gchar * filename, GtkImage * img);
0121 void update_preview_cb(GtkFileChooser * file_chooser, gpointer data);
0122 void set_file(SettingItem * item,gchar * f);
0123 void set_bool(SettingItem * item, gboolean b);
0124 void set_float(SettingItem * item, gdouble f);
0125 void set_int(SettingItem * item, gint i);
0126 void set_float_str(SettingItem * item, gchar * s);
0127 void set_color(SettingItem * item, gchar * s);
0128 void set_font(SettingItem * item, gchar * f);
0129 void set_string(SettingItem * item, gchar * s);
0130 void set_string_combo(SettingItem * item, gchar * s);
0131 void set_sf_int_combo(SettingItem * item, gint i);
0132 void read_setting(SettingItem * item, gpointer * p);
0133 void init_settings();
0134 void set_changed(gboolean schanged);
0135 void set_apply(gboolean sapply);
0136 void cb_clear_file(GtkWidget * button, gpointer p);
0137 void init_key_files();
0138 GSList * get_setting_list();
0139 const gchar * get_engine_combo(SettingItem * item);
0140 void do_engine(const gchar * nam);
0141 GtkWidget * build_notebook_page(gchar * title, GtkWidget * notebook);
0142 gchar * make_filename(const gchar * sect, const gchar * key, const gchar * ext);
0143 void layout_engine_list(GtkWidget * vbox);
0144 void init_engine_list();
0145 #endif