1 #ifndef EMERALD_LIBENGINE_H 2 #define EMERALD_LIBENGINE_H 3 #include <emerald.h> 4 void copy_from_defaults_if_needed(); 5 void load_color_setting(GKeyFile * f, decor_color_t * color, gchar * key, gchar * sect); 6 void load_shadow_color_setting(GKeyFile * f, gint sc[3], gchar * key, gchar * sect); 7 void load_float_setting(GKeyFile * f, gdouble * d, gchar * key, gchar * sect); 8 void load_int_setting(GKeyFile * f, gint * i, gchar * key, gchar * sect); 9 void load_bool_setting(GKeyFile * f, gboolean * b, gchar * key, gchar * sect); 10 void load_font_setting(GKeyFile * f, PangoFontDescription ** fd, gchar * key, gchar * sect); 11 void load_string_setting(GKeyFile * f, gchar ** s, gchar * key, gchar * sect); 12 void cairo_set_source_alpha_color(cairo_t * cr, alpha_color * c); 13 #define PFACS(zc) \ 14 load_color_setting(f,&((private_fs *)ws->fs_act->engine_fs)->zc.color,"active_" #zc ,SECT);\ 15 load_color_setting(f,&((private_fs *)ws->fs_inact->engine_fs)->zc.color,"inactive_" #zc ,SECT);\ 16 load_float_setting(f,&((private_fs *)ws->fs_act->engine_fs)->zc.alpha,"active_" #zc "_alpha",SECT);\ 17 load_float_setting(f,&((private_fs *)ws->fs_inact->engine_fs)->zc.alpha,"inactive_" #zc "_alpha",SECT); 18 19 void 20 fill_rounded_rectangle (cairo_t *cr, 21 double x, 22 double y, 23 double w, 24 double h, 25 int corner, 26 alpha_color * c0, 27 alpha_color * c1, 28 int gravity, 29 window_settings * ws, 30 double radius); 31 void 32 rounded_rectangle (cairo_t *cr, 33 double x, 34 double y, 35 double w, 36 double h, 37 int corner, 38 window_settings * ws, 39 double radius); 40 41 ////////////////////////////////////////////////////// 42 //themer stuff 43 typedef struct _EngineMetaInfo 44 { 45 gchar * description; 46 gchar * version; 47 gchar * last_compat; 48 GdkPixbuf * icon; 49 } EngineMetaInfo; 50 typedef enum _SettingType 51 { 52 ST_BOOL, 53 ST_INT, 54 ST_FLOAT, 55 ST_COLOR, 56 ST_FONT, 57 ST_META_STRING, 58 ST_IMG_FILE, 59 ST_STRING_COMBO, 60 ST_SFILE_INT_COMBO, 61 ST_ENGINE_COMBO, 62 ST_SFILE_BOOL, 63 ST_SFILE_INT, 64 ST_NUM 65 } SettingType; 66 typedef struct _SettingItem 67 { 68 SettingType type; 69 gchar * key; 70 gchar * section; 71 GtkWidget * widget; 72 73 gchar * fvalue; 74 GtkImage * image; 75 GtkImage * preview; 76 } SettingItem; 77 78 #include <titlebar.h> 79 80 #define gtk_box_pack_startC(a,b,c,d,e) gtk_box_pack_start(GTK_BOX(a),GTK_WIDGET(b),c,d,e) 81 #define gtk_box_pack_endC(a,b,c,d,e) gtk_box_pack_end(GTK_BOX(a),b,c,d,e) 82 #define gtk_container_addC(a,b) gtk_container_add(GTK_CONTAINER(a),b) 83 #define gtk_container_set_border_widthC(a,b) gtk_container_set_border_width(GTK_CONTAINER(a),b) 84 85 #define ACAV(caption,basekey,sect) add_color_alpha_value(caption,basekey,sect,active) 86 87 gboolean get_engine_meta_info(const gchar * engine, EngineMetaInfo * inf); // returns FALSE if couldn't find engine 88 89 GtkWidget * scaler_new(gdouble low, gdouble high, gdouble prec); 90 void add_color_alpha_value(gchar * caption, gchar * basekey, gchar * sect, gboolean active); 91 92 void make_labels(gchar * header); 93 GtkWidget * build_frame(GtkWidget * vbox, gchar * title, gboolean is_hbox); 94 SettingItem * register_setting(GtkWidget * widget, SettingType type, gchar * section, gchar * key); 95 SettingItem * register_img_file_setting(GtkWidget * widget, gchar * section, gchar * key, GtkImage * image); 96 void table_new(gint width, gboolean same, gboolean labels); 97 void table_append(GtkWidget * child,gboolean stretch); 98 void table_append_separator(); 99 GtkTable * get_current_table(); 100 101 void send_reload_signal(); 102 void apply_settings(); 103 void cb_apply_setting(GtkWidget * w, gpointer p); 104 #ifdef USE_DBUS 105 void setup_dbus(); 106 #endif 107 void write_setting(SettingItem * item, gpointer p); 108 void write_setting_file(); 109 gboolean get_bool(SettingItem * item); 110 gdouble get_float(SettingItem * item); 111 gint get_int(SettingItem * item); 112 const gchar * get_float_str(SettingItem * item); 113 const gchar * get_color(SettingItem * item); 114 const gchar * get_font(SettingItem * item); 115 const gchar * get_string(SettingItem * item); 116 void check_file(SettingItem * item,gchar * f); 117 const gchar * get_file(SettingItem * item); 118 const gchar * get_string_combo(SettingItem * item); 119 gint get_sf_int_combo(SettingItem * item); 120 void update_preview(GtkFileChooser * fc, gchar * filename, GtkImage * img); 121 void update_preview_cb(GtkFileChooser * file_chooser, gpointer data); 122 void set_file(SettingItem * item,gchar * f); 123 void set_bool(SettingItem * item, gboolean b); 124 void set_float(SettingItem * item, gdouble f); 125 void set_int(SettingItem * item, gint i); 126 void set_float_str(SettingItem * item, gchar * s); 127 void set_color(SettingItem * item, gchar * s); 128 void set_font(SettingItem * item, gchar * f); 129 void set_string(SettingItem * item, gchar * s); 130 void set_string_combo(SettingItem * item, gchar * s); 131 void set_sf_int_combo(SettingItem * item, gint i); 132 void read_setting(SettingItem * item, gpointer * p); 133 void init_settings(); 134 void set_changed(gboolean schanged); 135 void set_apply(gboolean sapply); 136 void cb_clear_file(GtkWidget * button, gpointer p); 137 void init_key_files(); 138 GSList * get_setting_list(); 139 const gchar * get_engine_combo(SettingItem * item); 140 void do_engine(const gchar * nam); 141 GtkWidget * build_notebook_page(gchar * title, GtkWidget * notebook); 142 gchar * make_filename(gchar * sect, gchar * key, gchar * ext); 143 void layout_engine_list(GtkWidget * vbox); 144 void init_engine_list(); 145 #endif 146