diff options
author | 2011-10-05 21:09:34 +0200 | |
---|---|---|
committer | 2011-10-05 21:09:34 +0200 | |
commit | 21e15c00392c79a7df54ffe2659e68ba33052869 (patch) | |
tree | 451d9144518165a7bbf21bc7e7d022237e9a28c1 /plugins/gtkui/ddbequalizer.c | |
parent | 75b0b356f6f4aa3a050a47ed617a36e1119326a4 (diff) |
few minor fixes to compile using vala 0.14;
converted supereq drawing code from gdk to cairo
Diffstat (limited to 'plugins/gtkui/ddbequalizer.c')
-rw-r--r-- | plugins/gtkui/ddbequalizer.c | 1389 |
1 files changed, 1138 insertions, 251 deletions
diff --git a/plugins/gtkui/ddbequalizer.c b/plugins/gtkui/ddbequalizer.c index 7cd9ee4f..a4d88e23 100644 --- a/plugins/gtkui/ddbequalizer.c +++ b/plugins/gtkui/ddbequalizer.c @@ -1,4 +1,4 @@ -/* ddbequalizer.c generated by valac 0.10.2, the Vala compiler +/* ddbequalizer.c generated by valac 0.14.0, the Vala compiler * generated from ddbequalizer.vala, do not modify */ /* @@ -28,8 +28,10 @@ #include <float.h> #include <math.h> #include <gdk/gdk.h> -#include <gtkui.h> #include <drawing.h> +#include <gtkui.h> +#include <cairo.h> +#include <pango/pangocairo.h> #include <pango/pango.h> @@ -47,6 +49,7 @@ typedef struct _DdbEqualizerPrivate DdbEqualizerPrivate; #define _g_free0(var) (var = (g_free (var), NULL)) #define _pango_font_description_free0(var) ((var == NULL) ? NULL : (var = (pango_font_description_free (var), NULL))) #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _cairo_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_destroy (var), NULL))) struct _DdbEqualizer { GtkDrawingArea parent_instance; @@ -58,15 +61,15 @@ struct _DdbEqualizerClass { }; struct _DdbEqualizerPrivate { - double* values; + gdouble* values; gint values_length1; gint _values_size_; - double preamp; + gdouble preamp; gint mouse_y; gboolean curve_hook; gboolean preamp_hook; - gint margin_bottom; - gint margin_left; + gint eq_margin_bottom; + gint eq_margin_left; GdkCursor* pointer_cursor; }; @@ -83,29 +86,29 @@ enum { static gboolean ddb_equalizer_real_configure_event (GtkWidget* base, GdkEventConfigure* event); static void ddb_equalizer_real_realize (GtkWidget* base); static gboolean ddb_equalizer_real_expose_event (GtkWidget* base, GdkEventExpose* event); -static inline double ddb_equalizer_scale (DdbEqualizer* self, double val); -static gboolean ddb_equalizer_in_curve_area (DdbEqualizer* self, double x, double y); -static void ddb_equalizer_update_eq_drag (DdbEqualizer* self, double x, double y); +static inline gdouble ddb_equalizer_scale (DdbEqualizer* self, gdouble val); +static gboolean ddb_equalizer_in_curve_area (DdbEqualizer* self, gdouble x, gdouble y); +static void ddb_equalizer_update_eq_drag (DdbEqualizer* self, gdouble x, gdouble y); static gboolean ddb_equalizer_real_button_press_event (GtkWidget* base, GdkEventButton* event); static gboolean ddb_equalizer_real_button_release_event (GtkWidget* base, GdkEventButton* event); static gboolean ddb_equalizer_real_leave_notify_event (GtkWidget* base, GdkEventCrossing* event); static gboolean ddb_equalizer_real_motion_notify_event (GtkWidget* base, GdkEventMotion* event); -void ddb_equalizer_set_band (DdbEqualizer* self, gint band, double v); -double ddb_equalizer_get_band (DdbEqualizer* self, gint band); -void ddb_equalizer_set_preamp (DdbEqualizer* self, double v); -double ddb_equalizer_get_preamp (DdbEqualizer* self); +void ddb_equalizer_set_band (DdbEqualizer* self, gint band, gdouble v); +gdouble ddb_equalizer_get_band (DdbEqualizer* self, gint band); +void ddb_equalizer_set_preamp (DdbEqualizer* self, gdouble v); +gdouble ddb_equalizer_get_preamp (DdbEqualizer* self); DdbEqualizer* ddb_equalizer_new (void); DdbEqualizer* ddb_equalizer_construct (GType object_type); static GObject * ddb_equalizer_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void ddb_equalizer_finalize (GObject* obj); -const char* freqs[18] = {"55 Hz", "77 Hz", "110 Hz", "156 Hz", "220 Hz", "311 Hz", "440 Hz", "622 Hz", "880 Hz", "1.2 kHz", "1.8 kHz", "2.5 kHz", "3.5 kHz", "5 kHz", "7 kHz", "10 kHz", "14 kHz", "20 kHz"}; - +const gchar* freqs[18] = {"55 Hz", "77 Hz", "110 Hz", "156 Hz", "220 Hz", "311 Hz", "440 Hz", "622 Hz", "880 Hz", "1.2 kHz", "1.8 kHz", "2.5 kHz", "3.5 kHz", "5 kHz", "7 kHz", "10 kHz", "14 kHz", "20 kHz"}; static gboolean ddb_equalizer_real_configure_event (GtkWidget* base, GdkEventConfigure* event) { DdbEqualizer * self; gboolean result = FALSE; self = (DdbEqualizer*) base; + g_return_val_if_fail (event != NULL, FALSE); gtkui_init_theme_colors (); result = FALSE; return result; @@ -130,312 +133,1041 @@ static gboolean ddb_equalizer_real_expose_event (GtkWidget* base, GdkEventExpose gboolean result = FALSE; GdkColor _tmp0_ = {0}; GdkColor fore_bright_color; + GdkColor _tmp1_; GdkColor c1; - GdkColor _tmp1_ = {0}; + GdkColor _tmp2_ = {0}; GdkColor c2; + GdkColor _tmp3_; GdkColor fore_dark_color; + guint16 _tmp4_; + GdkColor _tmp5_; + guint16 _tmp6_; + GdkColor _tmp7_; + guint16 _tmp8_; + guint16 _tmp9_; + GdkColor _tmp10_; + guint16 _tmp11_; + GdkColor _tmp12_; + guint16 _tmp13_; + guint16 _tmp14_; + GdkColor _tmp15_; + guint16 _tmp16_; + GdkColor _tmp17_; + guint16 _tmp18_; + GtkAllocation alloc = {0}; + GtkAllocation _tmp19_ = {0}; + GtkAllocation _tmp20_; + gint _tmp21_; gint width; + GtkAllocation _tmp22_; + gint _tmp23_; gint height; - GdkDrawable* d; - GdkGCValues _tmp2_ = {0}; - GdkGCValues _tmp3_; - GdkGC* gc; - double step; + GdkWindow* _tmp24_ = NULL; + cairo_t* _tmp25_ = NULL; + cairo_t* ctx; + cairo_t* _tmp26_; + cairo_t* _tmp27_; + cairo_t* _tmp28_; + GdkColor _tmp29_; + guint16 _tmp30_; + GdkColor _tmp31_; + guint16 _tmp32_; + GdkColor _tmp33_; + guint16 _tmp34_; + cairo_t* _tmp35_; + gint _tmp36_; + gint _tmp37_; + cairo_t* _tmp38_; + cairo_t* _tmp39_; + GdkColor _tmp40_; + guint16 _tmp41_; + GdkColor _tmp42_; + guint16 _tmp43_; + GdkColor _tmp44_; + guint16 _tmp45_; + gint _tmp46_; + gint _tmp47_; + gdouble step; gint i = 0; - double vstep; + gint _tmp62_; + gint _tmp63_; + gdouble vstep; + cairo_t* _tmp78_; + cairo_t* _tmp79_; + GdkColor _tmp80_; + guint16 _tmp81_; + GdkColor _tmp82_; + guint16 _tmp83_; + GdkColor _tmp84_; + guint16 _tmp85_; + cairo_t* _tmp86_; + PangoLayout* _tmp87_ = NULL; PangoLayout* l; - PangoContext* ctx; + PangoLayout* _tmp88_; + PangoContext* _tmp89_ = NULL; + PangoContext* _tmp90_; + PangoContext* pctx; + GtkStyle* _tmp91_ = NULL; + const PangoFontDescription* _tmp92_; + PangoFontDescription* _tmp93_ = NULL; PangoFontDescription* fd; + const PangoFontDescription* _tmp94_; + GtkStyle* _tmp95_ = NULL; + const PangoFontDescription* _tmp96_; + gint _tmp97_ = 0; + PangoContext* _tmp98_; + const PangoFontDescription* _tmp99_; + const PangoFontDescription* _tmp129_; + GtkStyle* _tmp130_ = NULL; + const PangoFontDescription* _tmp131_; + gint _tmp132_ = 0; + PangoContext* _tmp133_; + const PangoFontDescription* _tmp134_; + PangoLayout* _tmp135_; + gint _tmp136_; + PangoLayout* _tmp137_; + const PangoFontDescription* _tmp138_; + gint _tmp139_ = 0; + gdouble _tmp140_ = 0.0; + GdkScreen* _tmp141_ = NULL; + gdouble _tmp142_ = 0.0; gint fontsize; - gboolean _tmp7_ = FALSE; - char* tmp; - double val; - const char* _tmp9_; - char* _tmp10_; - const char* _tmp11_; - char* _tmp12_; - GdkRectangle _tmp13_ = {0}; - GdkRectangle _tmp14_; + gboolean _tmp143_ = FALSE; + gint _tmp144_; + gboolean _tmp148_; + cairo_t* _tmp170_; + gchar* tmp = NULL; + gdouble _tmp171_ = 0.0; + gdouble val; + const gchar* _tmp172_ = NULL; + gdouble _tmp173_; + const gchar* _tmp174_; + gdouble _tmp175_; + gchar* _tmp176_ = NULL; + PangoLayout* _tmp177_; + const gchar* _tmp178_; + const gchar* _tmp179_; + gint _tmp180_; + gint _tmp181_; + cairo_t* _tmp182_; + gint _tmp183_; + gint _tmp184_; + gint _tmp185_; + gint _tmp186_; + cairo_t* _tmp187_; + PangoLayout* _tmp188_; + cairo_t* _tmp189_; + cairo_t* _tmp190_; + gdouble _tmp191_ = 0.0; + const gchar* _tmp192_ = NULL; + gdouble _tmp193_; + const gchar* _tmp194_; + gdouble _tmp195_; + gchar* _tmp196_ = NULL; + PangoLayout* _tmp197_; + const gchar* _tmp198_; + const gchar* _tmp199_; + gint _tmp200_; + gint _tmp201_; + cairo_t* _tmp202_; + gint _tmp203_; + cairo_t* _tmp204_; + PangoLayout* _tmp205_; + cairo_t* _tmp206_; + cairo_t* _tmp207_; + PangoLayout* _tmp208_; + cairo_t* _tmp209_; + gint _tmp210_; + gdouble _tmp211_; + gint _tmp212_; + gint _tmp213_; + gint _tmp214_; + cairo_t* _tmp215_; + PangoLayout* _tmp216_; + cairo_t* _tmp217_; + cairo_t* _tmp218_; + PangoLayout* _tmp219_; + PangoLayout* _tmp220_; + cairo_t* _tmp221_; + gint _tmp222_; + gint _tmp223_; + cairo_t* _tmp224_; + PangoLayout* _tmp225_; + cairo_t* _tmp226_; + cairo_t* _tmp227_; + gint _tmp228_; + gint _tmp229_; + gint _tmp230_; + gint _tmp231_; + gint _tmp232_; + cairo_t* _tmp233_; + cairo_t* _tmp234_; + gdouble _tmp235_; + gint _tmp236_; + gint _tmp237_; + gint _tmp238_; + cairo_t* _tmp239_; + cairo_t* _tmp240_; + GdkColor _tmp241_; + guint16 _tmp242_; + GdkColor _tmp243_; + guint16 _tmp244_; + GdkColor _tmp245_; + guint16 _tmp246_; + gint _tmp247_; + gint _tmp248_; gint count; - GdkRectangle _tmp16_ = {0}; - GdkRectangle _tmp17_; + cairo_t* _tmp258_; + cairo_t* _tmp259_; gint bar_w; - GdkRectangle _tmp22_ = {0}; - GdkRectangle _tmp23_; + gdouble _tmp260_; + gint _tmp261_; + cairo_t* _tmp300_; + cairo_t* _tmp301_; + gdouble* _tmp302_ = NULL; + gdouble* _tmp303_; + gint _tmp303__length1; + cairo_t* _tmp304_; + gint _tmp305_; + gint _tmp306_; + cairo_t* _tmp307_; + gint _tmp308_; + gint _tmp309_; + cairo_t* _tmp310_; self = (DdbEqualizer*) base; - fore_bright_color = (gtkui_get_bar_foreground_color (&_tmp0_), _tmp0_); - c1 = fore_bright_color; - c2 = (gtkui_get_bar_background_color (&_tmp1_), _tmp1_); - fore_dark_color = c2; - fore_dark_color.red = fore_dark_color.red + ((guint16) ((gint16) ((c1.red - c2.red) * 0.5))); - fore_dark_color.green = fore_dark_color.green + ((guint16) ((gint16) ((c1.green - c2.green) * 0.5))); - fore_dark_color.blue = fore_dark_color.blue + ((guint16) ((gint16) ((c1.blue - c2.blue) * 0.5))); - width = ((GtkWidget*) self)->allocation.width; - height = ((GtkWidget*) self)->allocation.height; - d = _g_object_ref0 ((GdkDrawable*) gtk_widget_get_window ((GtkWidget*) self)); - gc = _g_object_ref0 (GDK_DRAWABLE_GET_CLASS (d)->create_gc (d, (_tmp3_ = (memset (&_tmp2_, 0, sizeof (GdkGCValues)), _tmp2_), &_tmp3_), 0)); - gdk_gc_set_rgb_fg_color (gc, &c2); - gdk_draw_rectangle (d, gc, TRUE, 0, 0, width, height); - gdk_gc_set_rgb_fg_color (gc, &fore_dark_color); - step = ((double) (width - self->priv->margin_left)) / ((double) (DDB_EQUALIZER_bands + 1)); + g_return_val_if_fail (event != NULL, FALSE); + gtkui_get_bar_foreground_color (&_tmp0_); + fore_bright_color = _tmp0_; + _tmp1_ = fore_bright_color; + c1 = _tmp1_; + gtkui_get_bar_background_color (&_tmp2_); + c2 = _tmp2_; + _tmp3_ = c2; + fore_dark_color = _tmp3_; + _tmp4_ = fore_dark_color.red; + _tmp5_ = c1; + _tmp6_ = _tmp5_.red; + _tmp7_ = c2; + _tmp8_ = _tmp7_.red; + fore_dark_color.red = _tmp4_ + ((gint16) ((_tmp6_ - _tmp8_) * 0.5)); + _tmp9_ = fore_dark_color.green; + _tmp10_ = c1; + _tmp11_ = _tmp10_.green; + _tmp12_ = c2; + _tmp13_ = _tmp12_.green; + fore_dark_color.green = _tmp9_ + ((gint16) ((_tmp11_ - _tmp13_) * 0.5)); + _tmp14_ = fore_dark_color.blue; + _tmp15_ = c1; + _tmp16_ = _tmp15_.blue; + _tmp17_ = c2; + _tmp18_ = _tmp17_.blue; + fore_dark_color.blue = _tmp14_ + ((gint16) ((_tmp16_ - _tmp18_) * 0.5)); + gtk_widget_get_allocation ((GtkWidget*) self, &_tmp19_); + alloc = _tmp19_; + _tmp20_ = alloc; + _tmp21_ = _tmp20_.width; + width = _tmp21_; + _tmp22_ = alloc; + _tmp23_ = _tmp22_.height; + height = _tmp23_; + _tmp24_ = gtk_widget_get_window ((GtkWidget*) self); + _tmp25_ = gdk_cairo_create ((GdkDrawable*) _tmp24_); + ctx = _tmp25_; + _tmp26_ = ctx; + cairo_set_antialias (_tmp26_, CAIRO_ANTIALIAS_NONE); + _tmp27_ = ctx; + cairo_set_line_width (_tmp27_, 1.0); + _tmp28_ = ctx; + _tmp29_ = c2; + _tmp30_ = _tmp29_.red; + _tmp31_ = c2; + _tmp32_ = _tmp31_.green; + _tmp33_ = c2; + _tmp34_ = _tmp33_.blue; + cairo_set_source_rgba (_tmp28_, _tmp30_ / 65535.0, _tmp32_ / 65535.0, _tmp34_ / 65535.0, (gdouble) 1); + _tmp35_ = ctx; + _tmp36_ = width; + _tmp37_ = height; + cairo_rectangle (_tmp35_, (gdouble) 0, (gdouble) 0, (gdouble) _tmp36_, (gdouble) _tmp37_); + _tmp38_ = ctx; + cairo_fill (_tmp38_); + _tmp39_ = ctx; + _tmp40_ = fore_dark_color; + _tmp41_ = _tmp40_.red; + _tmp42_ = fore_dark_color; + _tmp43_ = _tmp42_.green; + _tmp44_ = fore_dark_color; + _tmp45_ = _tmp44_.blue; + cairo_set_source_rgba (_tmp39_, _tmp41_ / 65535.0, _tmp43_ / 65535.0, _tmp45_ / 65535.0, (gdouble) 1); + _tmp46_ = width; + _tmp47_ = self->priv->eq_margin_left; + step = ((gdouble) (_tmp46_ - _tmp47_)) / ((gdouble) (DDB_EQUALIZER_bands + 1)); { - gboolean _tmp4_; + gboolean _tmp48_; i = 0; - _tmp4_ = TRUE; + _tmp48_ = TRUE; while (TRUE) { - if (!_tmp4_) { - i++; + gboolean _tmp49_; + gint _tmp51_; + cairo_t* _tmp52_; + gint _tmp53_; + gdouble _tmp54_; + gint _tmp55_; + cairo_t* _tmp56_; + gint _tmp57_; + gdouble _tmp58_; + gint _tmp59_; + gint _tmp60_; + gint _tmp61_; + _tmp49_ = _tmp48_; + if (!_tmp49_) { + gint _tmp50_; + _tmp50_ = i; + i = _tmp50_ + 1; } - _tmp4_ = FALSE; - if (!(i < DDB_EQUALIZER_bands)) { + _tmp48_ = FALSE; + _tmp51_ = i; + if (!(_tmp51_ < DDB_EQUALIZER_bands)) { break; } - gdk_draw_line (d, gc, ((gint) ((i + 1) * step)) + self->priv->margin_left, 0, ((gint) ((i + 1) * step)) + self->priv->margin_left, height - self->priv->margin_bottom); + _tmp52_ = ctx; + _tmp53_ = i; + _tmp54_ = step; + _tmp55_ = self->priv->eq_margin_left; + cairo_move_to (_tmp52_, (gdouble) (((gint) ((_tmp53_ + 1) * _tmp54_)) + _tmp55_), (gdouble) 0); + _tmp56_ = ctx; + _tmp57_ = i; + _tmp58_ = step; + _tmp59_ = self->priv->eq_margin_left; + _tmp60_ = height; + _tmp61_ = self->priv->eq_margin_bottom; + cairo_line_to (_tmp56_, (gdouble) (((gint) ((_tmp57_ + 1) * _tmp58_)) + _tmp59_), (gdouble) (_tmp60_ - _tmp61_)); } } - vstep = (double) (height - self->priv->margin_bottom); + _tmp62_ = height; + _tmp63_ = self->priv->eq_margin_bottom; + vstep = (gdouble) (_tmp62_ - _tmp63_); { - double di; - di = (double) 0; + gdouble di; + di = (gdouble) 0; { - gboolean _tmp5_; - _tmp5_ = TRUE; + gboolean _tmp64_; + _tmp64_ = TRUE; while (TRUE) { - if (!_tmp5_) { - di = di + 0.25; + gboolean _tmp65_; + gdouble _tmp67_; + cairo_t* _tmp68_; + gint _tmp69_; + gdouble _tmp70_; + gdouble _tmp71_; + gdouble _tmp72_; + cairo_t* _tmp73_; + gint _tmp74_; + gdouble _tmp75_; + gdouble _tmp76_; + gdouble _tmp77_; + _tmp65_ = _tmp64_; + if (!_tmp65_) { + gdouble _tmp66_; + _tmp66_ = di; + di = _tmp66_ + 0.25; } - _tmp5_ = FALSE; - if (!(di < 2)) { + _tmp64_ = FALSE; + _tmp67_ = di; + if (!(_tmp67_ < ((gdouble) 2))) { break; } - gdk_draw_line (d, gc, self->priv->margin_left, (gint) ((di - self->priv->preamp) * vstep), width, (gint) ((di - self->priv->preamp) * vstep)); + _tmp68_ = ctx; + _tmp69_ = self->priv->eq_margin_left; + _tmp70_ = di; + _tmp71_ = self->priv->preamp; + _tmp72_ = vstep; + cairo_move_to (_tmp68_, (gdouble) _tmp69_, (gdouble) ((gint) ((_tmp70_ - _tmp71_) * _tmp72_))); + _tmp73_ = ctx; + _tmp74_ = width; + _tmp75_ = di; + _tmp76_ = self->priv->preamp; + _tmp77_ = vstep; + cairo_line_to (_tmp73_, (gdouble) _tmp74_, (gdouble) ((gint) ((_tmp75_ - _tmp76_) * _tmp77_))); } } } - gdk_gc_set_rgb_fg_color (gc, &fore_bright_color); - l = gtk_widget_create_pango_layout ((GtkWidget*) self, NULL); - ctx = _g_object_ref0 (pango_layout_get_context (l)); - fd = pango_font_description_copy (gtk_widget_get_style ((GtkWidget*) self)->font_desc); - pango_font_description_set_size (fd, (gint) (pango_font_description_get_size (gtk_widget_get_style ((GtkWidget*) self)->font_desc) * 0.7)); - pango_context_set_font_description (ctx, fd); + _tmp78_ = ctx; + cairo_stroke (_tmp78_); + _tmp79_ = ctx; + _tmp80_ = fore_bright_color; + _tmp81_ = _tmp80_.red; + _tmp82_ = fore_bright_color; + _tmp83_ = _tmp82_.green; + _tmp84_ = fore_bright_color; + _tmp85_ = _tmp84_.blue; + cairo_set_source_rgba (_tmp79_, _tmp81_ / 65535.0, _tmp83_ / 65535.0, _tmp85_ / 65535.0, (gdouble) 1); + _tmp86_ = ctx; + _tmp87_ = pango_cairo_create_layout (_tmp86_); + l = _tmp87_; + _tmp88_ = l; + _tmp89_ = pango_layout_get_context (_tmp88_); + _tmp90_ = _g_object_ref0 (_tmp89_); + pctx = _tmp90_; + _tmp91_ = gtk_widget_get_style ((GtkWidget*) self); + _tmp92_ = _tmp91_->font_desc; + _tmp93_ = pango_font_description_copy (_tmp92_); + fd = _tmp93_; + _tmp94_ = fd; + _tmp95_ = gtk_widget_get_style ((GtkWidget*) self); + _tmp96_ = _tmp95_->font_desc; + _tmp97_ = pango_font_description_get_size (_tmp96_); + pango_font_description_set_size (_tmp94_, (gint) (_tmp97_ * 0.7)); + _tmp98_ = pctx; + _tmp99_ = fd; + pango_context_set_font_description (_tmp98_, _tmp99_); { - gboolean _tmp6_; + gboolean _tmp100_; i = 0; - _tmp6_ = TRUE; + _tmp100_ = TRUE; while (TRUE) { + gboolean _tmp101_; + gint _tmp103_; + cairo_t* _tmp104_; + PangoLayout* _tmp105_; + gint _tmp106_; + const gchar* _tmp107_; + gint _tmp108_; + const gchar* _tmp109_; + gint _tmp110_; + gint _tmp111_; PangoRectangle ink = {0}; PangoRectangle log = {0}; + PangoLayout* _tmp112_; + PangoRectangle _tmp113_ = {0}; + PangoRectangle _tmp114_ = {0}; gint offs; - if (!_tmp6_) { - i++; + gint _tmp115_; + cairo_t* _tmp117_; + gint _tmp118_; + gdouble _tmp119_; + gint _tmp120_; + PangoRectangle _tmp121_; + gint _tmp122_; + gint _tmp123_; + gint _tmp124_; + gint _tmp125_; + cairo_t* _tmp126_; + PangoLayout* _tmp127_; + cairo_t* _tmp128_; + _tmp101_ = _tmp100_; + if (!_tmp101_) { + gint _tmp102_; + _tmp102_ = i; + i = _tmp102_ + 1; } - _tmp6_ = FALSE; - if (!(i < DDB_EQUALIZER_bands)) { + _tmp100_ = FALSE; + _tmp103_ = i; + if (!(_tmp103_ < DDB_EQUALIZER_bands)) { break; } - pango_layout_set_text (l, freqs[i], (gint) g_utf8_strlen (freqs[i], -1)); - pango_layout_get_pixel_extents (l, &ink, &log); + _tmp104_ = ctx; + cairo_save (_tmp104_); + _tmp105_ = l; + _tmp106_ = i; + _tmp107_ = freqs[_tmp106_]; + _tmp108_ = i; + _tmp109_ = freqs[_tmp108_]; + _tmp110_ = strlen (_tmp109_); + _tmp111_ = _tmp110_; + pango_layout_set_text (_tmp105_, _tmp107_, (gint) _tmp111_); + _tmp112_ = l; + pango_layout_get_pixel_extents (_tmp112_, &_tmp113_, &_tmp114_); + ink = _tmp113_; + log = _tmp114_; offs = 2; - if ((i % 2) != 0) { - offs = offs + 2; + _tmp115_ = i; + if ((_tmp115_ % 2) != 0) { + gint _tmp116_; + _tmp116_ = offs; + offs = _tmp116_ + 2; } - gdk_draw_layout (d, gc, (((gint) ((i + 1) * step)) + self->priv->margin_left) - (ink.width / 2), (height - self->priv->margin_bottom) + offs, l); + _tmp117_ = ctx; + _tmp118_ = i; + _tmp119_ = step; + _tmp120_ = self->priv->eq_margin_left; + _tmp121_ = ink; + _tmp122_ = _tmp121_.width; + _tmp123_ = height; + _tmp124_ = self->priv->eq_margin_bottom; + _tmp125_ = offs; + cairo_move_to (_tmp117_, (gdouble) ((((gint) ((_tmp118_ + 1) * _tmp119_)) + _tmp120_) - (_tmp122_ / 2)), (gdouble) ((_tmp123_ - _tmp124_) + _tmp125_)); + _tmp126_ = ctx; + _tmp127_ = l; + pango_cairo_show_layout (_tmp126_, _tmp127_); + _tmp128_ = ctx; + cairo_restore (_tmp128_); } } - pango_font_description_set_size (fd, (gint) pango_font_description_get_size (gtk_widget_get_style ((GtkWidget*) self)->font_desc)); - pango_context_set_font_description (ctx, fd); - pango_layout_set_width (l, self->priv->margin_left - 1); - pango_layout_set_alignment (l, PANGO_ALIGN_RIGHT); - fontsize = (gint) ((pango_units_to_double (pango_font_description_get_size (fd)) * gdk_screen_get_resolution (gdk_screen_get_default ())) / 72); - if (self->priv->mouse_y >= 0) { - _tmp7_ = self->priv->mouse_y < (height - self->priv->margin_bottom); + _tmp129_ = fd; + _tmp130_ = gtk_widget_get_style ((GtkWidget*) self); + _tmp131_ = _tmp130_->font_desc; + _tmp132_ = pango_font_description_get_size (_tmp131_); + pango_font_description_set_size (_tmp129_, (gint) _tmp132_); + _tmp133_ = pctx; + _tmp134_ = fd; + pango_context_set_font_description (_tmp133_, _tmp134_); + _tmp135_ = l; + _tmp136_ = self->priv->eq_margin_left; + pango_layout_set_width (_tmp135_, _tmp136_ - 1); + _tmp137_ = l; + pango_layout_set_alignment (_tmp137_, PANGO_ALIGN_RIGHT); + _tmp138_ = fd; + _tmp139_ = pango_font_description_get_size (_tmp138_); + _tmp140_ = pango_units_to_double (_tmp139_); + _tmp141_ = gdk_screen_get_default (); + _tmp142_ = gdk_screen_get_resolution (_tmp141_); + fontsize = (gint) ((_tmp140_ * _tmp142_) / 72); + _tmp144_ = self->priv->mouse_y; + if (_tmp144_ >= 0) { + gint _tmp145_; + gint _tmp146_; + gint _tmp147_; + _tmp145_ = self->priv->mouse_y; + _tmp146_ = height; + _tmp147_ = self->priv->eq_margin_bottom; + _tmp143_ = _tmp145_ < (_tmp146_ - _tmp147_); } else { - _tmp7_ = FALSE; + _tmp143_ = FALSE; } - if (_tmp7_) { - double db; - const char* _tmp8_; - char* tmp; - db = ddb_equalizer_scale (self, ((double) (self->priv->mouse_y - 1)) / ((double) ((height - self->priv->margin_bottom) - 2))); - _tmp8_ = NULL; - if (db > 0) { - _tmp8_ = "+"; + _tmp148_ = _tmp143_; + if (_tmp148_) { + cairo_t* _tmp149_; + gint _tmp150_; + gint _tmp151_; + gint _tmp152_; + gdouble _tmp153_ = 0.0; + gdouble db; + const gchar* _tmp154_ = NULL; + gdouble _tmp155_; + const gchar* _tmp156_; + gdouble _tmp157_; + gchar* _tmp158_ = NULL; + gchar* tmp; + PangoLayout* _tmp159_; + const gchar* _tmp160_; + const gchar* _tmp161_; + gint _tmp162_; + gint _tmp163_; + cairo_t* _tmp164_; + gint _tmp165_; + gint _tmp166_; + cairo_t* _tmp167_; + PangoLayout* _tmp168_; + cairo_t* _tmp169_; + _tmp149_ = ctx; + cairo_save (_tmp149_); + _tmp150_ = self->priv->mouse_y; + _tmp151_ = height; + _tmp152_ = self->priv->eq_margin_bottom; + _tmp153_ = ddb_equalizer_scale (self, ((gdouble) (_tmp150_ - 1)) / ((gdouble) ((_tmp151_ - _tmp152_) - 2))); + db = _tmp153_; + _tmp155_ = db; + if (_tmp155_ > ((gdouble) 0)) { + _tmp154_ = "+"; } else { - _tmp8_ = ""; + _tmp154_ = ""; } - tmp = g_strdup_printf ("%s%.1fdB", _tmp8_, db); - pango_layout_set_text (l, tmp, (gint) g_utf8_strlen (tmp, -1)); - gdk_draw_layout (d, gc, self->priv->margin_left - 1, self->priv->mouse_y - 3, l); + _tmp156_ = _tmp154_; + _tmp157_ = db; + _tmp158_ = g_strdup_printf ("%s%.1fdB", _tmp156_, _tmp157_); + tmp = _tmp158_; + _tmp159_ = l; + _tmp160_ = tmp; + _tmp161_ = tmp; + _tmp162_ = strlen (_tmp161_); + _tmp163_ = _tmp162_; + pango_layout_set_text (_tmp159_, _tmp160_, (gint) _tmp163_); + _tmp164_ = ctx; + _tmp165_ = self->priv->eq_margin_left; + _tmp166_ = self->priv->mouse_y; + cairo_move_to (_tmp164_, (gdouble) (_tmp165_ - 1), (gdouble) (_tmp166_ - 3)); + _tmp167_ = ctx; + _tmp168_ = l; + pango_cairo_show_layout (_tmp167_, _tmp168_); + _tmp169_ = ctx; + cairo_restore (_tmp169_); _g_free0 (tmp); } - tmp = NULL; - val = ddb_equalizer_scale (self, (double) 1); - _tmp9_ = NULL; - if (val > 0) { - _tmp9_ = "+"; + _tmp170_ = ctx; + cairo_save (_tmp170_); + _tmp171_ = ddb_equalizer_scale (self, (gdouble) 1); + val = _tmp171_; + _tmp173_ = val; + if (_tmp173_ > ((gdouble) 0)) { + _tmp172_ = "+"; } else { - _tmp9_ = ""; + _tmp172_ = ""; } - tmp = (_tmp10_ = g_strdup_printf ("%s%.1fdB", _tmp9_, val), _g_free0 (tmp), _tmp10_); - pango_layout_set_text (l, tmp, (gint) g_utf8_strlen (tmp, -1)); - gdk_draw_layout (d, gc, self->priv->margin_left - 1, (height - self->priv->margin_bottom) - fontsize, l); - val = ddb_equalizer_scale (self, (double) 0); - _tmp11_ = NULL; - if (val > 0) { - _tmp11_ = "+"; + _tmp174_ = _tmp172_; + _tmp175_ = val; + _tmp176_ = g_strdup_printf ("%s%.1fdB", _tmp174_, _tmp175_); + _g_free0 (tmp); + tmp = _tmp176_; + _tmp177_ = l; + _tmp178_ = tmp; + _tmp179_ = tmp; + _tmp180_ = strlen (_tmp179_); + _tmp181_ = _tmp180_; + pango_layout_set_text (_tmp177_, _tmp178_, (gint) _tmp181_); + _tmp182_ = ctx; + _tmp183_ = self->priv->eq_margin_left; + _tmp184_ = height; + _tmp185_ = self->priv->eq_margin_bottom; + _tmp186_ = fontsize; + cairo_move_to (_tmp182_, (gdouble) (_tmp183_ - 1), (gdouble) ((_tmp184_ - _tmp185_) - _tmp186_)); + _tmp187_ = ctx; + _tmp188_ = l; + pango_cairo_show_layout (_tmp187_, _tmp188_); + _tmp189_ = ctx; + cairo_restore (_tmp189_); + _tmp190_ = ctx; + cairo_save (_tmp190_); + _tmp191_ = ddb_equalizer_scale (self, (gdouble) 0); + val = _tmp191_; + _tmp193_ = val; + if (_tmp193_ > ((gdouble) 0)) { + _tmp192_ = "+"; } else { - _tmp11_ = ""; + _tmp192_ = ""; } - tmp = (_tmp12_ = g_strdup_printf ("%s%.1fdB", _tmp11_, val), _g_free0 (tmp), _tmp12_); - pango_layout_set_text (l, tmp, (gint) g_utf8_strlen (tmp, -1)); - gdk_draw_layout (d, gc, self->priv->margin_left - 1, 1, l); - pango_layout_set_text (l, "+0dB", 4); - gdk_draw_layout (d, gc, self->priv->margin_left - 1, ((gint) ((1 - self->priv->preamp) * (height - self->priv->margin_bottom))) - (fontsize / 2), l); - pango_layout_set_text (l, "preamp", 6); - pango_layout_set_alignment (l, PANGO_ALIGN_LEFT); - gdk_draw_layout (d, gc, 1, (height - self->priv->margin_bottom) + 2, l); - gdk_draw_rectangle (d, gc, FALSE, self->priv->margin_left, 0, (width - self->priv->margin_left) - 1, (height - self->priv->margin_bottom) - 1); - gdk_gc_set_line_attributes (gc, 2, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER); - gdk_gc_set_clip_rectangle (gc, (_tmp14_ = (_tmp13_.x = 0, _tmp13_.y = (gint) (self->priv->preamp * (height - self->priv->margin_bottom)), _tmp13_.width = 11, _tmp13_.height = height, _tmp13_), &_tmp14_)); - gdk_gc_set_rgb_fg_color (gc, &fore_bright_color); - count = ((gint) ((height - self->priv->margin_bottom) / 6)) + 1; + _tmp194_ = _tmp192_; + _tmp195_ = val; + _tmp196_ = g_strdup_printf ("%s%.1fdB", _tmp194_, _tmp195_); + _g_free0 (tmp); + tmp = _tmp196_; + _tmp197_ = l; + _tmp198_ = tmp; + _tmp199_ = tmp; + _tmp200_ = strlen (_tmp199_); + _tmp201_ = _tmp200_; + pango_layout_set_text (_tmp197_, _tmp198_, (gint) _tmp201_); + _tmp202_ = ctx; + _tmp203_ = self->priv->eq_margin_left; + cairo_move_to (_tmp202_, (gdouble) (_tmp203_ - 1), (gdouble) 1); + _tmp204_ = ctx; + _tmp205_ = l; + pango_cairo_show_layout (_tmp204_, _tmp205_); + _tmp206_ = ctx; + cairo_restore (_tmp206_); + _tmp207_ = ctx; + cairo_save (_tmp207_); + _tmp208_ = l; + pango_layout_set_text (_tmp208_, "+0dB", 4); + _tmp209_ = ctx; + _tmp210_ = self->priv->eq_margin_left; + _tmp211_ = self->priv->preamp; + _tmp212_ = height; + _tmp213_ = self->priv->eq_margin_bottom; + _tmp214_ = fontsize; + cairo_move_to (_tmp209_, (gdouble) (_tmp210_ - 1), (gdouble) (((gint) ((1 - _tmp211_) * (_tmp212_ - _tmp213_))) - (_tmp214_ / 2))); + _tmp215_ = ctx; + _tmp216_ = l; + pango_cairo_show_layout (_tmp215_, _tmp216_); + _tmp217_ = ctx; + cairo_restore (_tmp217_); + _tmp218_ = ctx; + cairo_save (_tmp218_); + _tmp219_ = l; + pango_layout_set_text (_tmp219_, "preamp", 6); + _tmp220_ = l; + pango_layout_set_alignment (_tmp220_, PANGO_ALIGN_LEFT); + _tmp221_ = ctx; + _tmp222_ = height; + _tmp223_ = self->priv->eq_margin_bottom; + cairo_move_to (_tmp221_, (gdouble) 1, (gdouble) ((_tmp222_ - _tmp223_) + 2)); + _tmp224_ = ctx; + _tmp225_ = l; + pango_cairo_show_layout (_tmp224_, _tmp225_); + _tmp226_ = ctx; + cairo_restore (_tmp226_); + _tmp227_ = ctx; + _tmp228_ = self->priv->eq_margin_left; + _tmp229_ = width; + _tmp230_ = self->priv->eq_margin_left; + _tmp231_ = height; + _tmp232_ = self->priv->eq_margin_bottom; + cairo_rectangle (_tmp227_, (gdouble) _tmp228_, (gdouble) 0, (gdouble) ((_tmp229_ - _tmp230_) - 1), (gdouble) ((_tmp231_ - _tmp232_) - 1)); + _tmp233_ = ctx; + cairo_stroke (_tmp233_); + _tmp234_ = ctx; + _tmp235_ = self->priv->preamp; + _tmp236_ = height; + _tmp237_ = self->priv->eq_margin_bottom; + _tmp238_ = height; + cairo_rectangle (_tmp234_, (gdouble) 0, (gdouble) ((gint) (_tmp235_ * (_tmp236_ - _tmp237_))), (gdouble) 11, (gdouble) _tmp238_); + _tmp239_ = ctx; + cairo_clip (_tmp239_); + _tmp240_ = ctx; + _tmp241_ = fore_bright_color; + _tmp242_ = _tmp241_.red; + _tmp243_ = fore_bright_color; + _tmp244_ = _tmp243_.green; + _tmp245_ = fore_bright_color; + _tmp246_ = _tmp245_.blue; + cairo_set_source_rgba (_tmp240_, _tmp242_ / 65535.0, _tmp244_ / 65535.0, _tmp246_ / 65535.0, 1.0); + _tmp247_ = height; + _tmp248_ = self->priv->eq_margin_bottom; + count = ((gint) ((_tmp247_ - _tmp248_) / 6)) + 1; { gint j; j = 0; { - gboolean _tmp15_; - _tmp15_ = TRUE; + gboolean _tmp249_; + _tmp249_ = TRUE; while (TRUE) { - if (!_tmp15_) { - j++; + gboolean _tmp250_; + gint _tmp252_; + gint _tmp253_; + cairo_t* _tmp254_; + gint _tmp255_; + gint _tmp256_; + gint _tmp257_; + _tmp250_ = _tmp249_; + if (!_tmp250_) { + gint _tmp251_; + _tmp251_ = j; + j = _tmp251_ + 1; } - _tmp15_ = FALSE; - if (!(j < count)) { + _tmp249_ = FALSE; + _tmp252_ = j; + _tmp253_ = count; + if (!(_tmp252_ < _tmp253_)) { break; } - gdk_draw_rectangle (d, gc, TRUE, 1, ((height - self->priv->margin_bottom) - (j * 6)) - 6, 11, 4); + _tmp254_ = ctx; + _tmp255_ = height; + _tmp256_ = self->priv->eq_margin_bottom; + _tmp257_ = j; + cairo_rectangle (_tmp254_, (gdouble) 1, (gdouble) (((_tmp255_ - _tmp256_) - (_tmp257_ * 6)) - 6), (gdouble) 11, (gdouble) 4); } } } - gdk_gc_set_clip_rectangle (gc, (_tmp17_ = (_tmp16_.x = self->priv->margin_left + 1, _tmp16_.y = 1, _tmp16_.width = (width - self->priv->margin_left) - 2, _tmp16_.height = (height - self->priv->margin_bottom) - 2, _tmp16_), &_tmp17_)); - gdk_gc_set_rgb_fg_color (gc, &fore_bright_color); + _tmp258_ = ctx; + cairo_fill (_tmp258_); + _tmp259_ = ctx; + cairo_reset_clip (_tmp259_); bar_w = 11; - if (step < bar_w) { - bar_w = ((gint) step) - 1; + _tmp260_ = step; + _tmp261_ = bar_w; + if (_tmp260_ < ((gdouble) _tmp261_)) { + gdouble _tmp262_; + _tmp262_ = step; + bar_w = ((gint) _tmp262_) - 1; } { - gboolean _tmp18_; + gboolean _tmp263_; i = 0; - _tmp18_ = TRUE; + _tmp263_ = TRUE; while (TRUE) { - GdkRectangle _tmp19_ = {0}; - GdkRectangle _tmp20_; - if (!_tmp18_) { - i++; + gboolean _tmp264_; + gint _tmp266_; + cairo_t* _tmp267_; + cairo_t* _tmp268_; + gint _tmp269_; + gdouble _tmp270_; + gint _tmp271_; + gint _tmp272_; + gdouble* _tmp273_; + gint _tmp273__length1; + gint _tmp274_; + gdouble _tmp275_; + gint _tmp276_; + gint _tmp277_; + gint _tmp278_; + cairo_t* _tmp279_; + gint _tmp280_; + gint _tmp281_; + gdouble* _tmp282_; + gint _tmp282__length1; + gint _tmp283_; + gdouble _tmp284_; + cairo_t* _tmp299_; + _tmp264_ = _tmp263_; + if (!_tmp264_) { + gint _tmp265_; + _tmp265_ = i; + i = _tmp265_ + 1; } - _tmp18_ = FALSE; - if (!(i < DDB_EQUALIZER_bands)) { + _tmp263_ = FALSE; + _tmp266_ = i; + if (!(_tmp266_ < DDB_EQUALIZER_bands)) { break; } - gdk_gc_set_clip_rectangle (gc, (_tmp20_ = (_tmp19_.x = (((gint) ((i + 1) * step)) + self->priv->margin_left) - (bar_w / 2), _tmp19_.y = (gint) (self->priv->values[i] * (height - self->priv->margin_bottom)), _tmp19_.width = 11, _tmp19_.height = height, _tmp19_), &_tmp20_)); - count = ((gint) (((height - self->priv->margin_bottom) * (1 - self->priv->values[i])) / 6)) + 1; + _tmp267_ = ctx; + cairo_reset_clip (_tmp267_); + _tmp268_ = ctx; + _tmp269_ = i; + _tmp270_ = step; + _tmp271_ = self->priv->eq_margin_left; + _tmp272_ = bar_w; + _tmp273_ = self->priv->values; + _tmp273__length1 = self->priv->values_length1; + _tmp274_ = i; + _tmp275_ = _tmp273_[_tmp274_]; + _tmp276_ = height; + _tmp277_ = self->priv->eq_margin_bottom; + _tmp278_ = height; + cairo_rectangle (_tmp268_, (gdouble) ((((gint) ((_tmp269_ + 1) * _tmp270_)) + _tmp271_) - (_tmp272_ / 2)), (gdouble) ((gint) (_tmp275_ * (_tmp276_ - _tmp277_))), (gdouble) 11, (gdouble) _tmp278_); + _tmp279_ = ctx; + cairo_clip (_tmp279_); + _tmp280_ = height; + _tmp281_ = self->priv->eq_margin_bottom; + _tmp282_ = self->priv->values; + _tmp282__length1 = self->priv->values_length1; + _tmp283_ = i; + _tmp284_ = _tmp282_[_tmp283_]; + count = ((gint) (((_tmp280_ - _tmp281_) * (1 - _tmp284_)) / 6)) + 1; { gint j; j = 0; { - gboolean _tmp21_; - _tmp21_ = TRUE; + gboolean _tmp285_; + _tmp285_ = TRUE; while (TRUE) { - if (!_tmp21_) { - j++; + gboolean _tmp286_; + gint _tmp288_; + gint _tmp289_; + cairo_t* _tmp290_; + gint _tmp291_; + gdouble _tmp292_; + gint _tmp293_; + gint _tmp294_; + gint _tmp295_; + gint _tmp296_; + gint _tmp297_; + gint _tmp298_; + _tmp286_ = _tmp285_; + if (!_tmp286_) { + gint _tmp287_; + _tmp287_ = j; + j = _tmp287_ + 1; } - _tmp21_ = FALSE; - if (!(j < count)) { + _tmp285_ = FALSE; + _tmp288_ = j; + _tmp289_ = count; + if (!(_tmp288_ < _tmp289_)) { break; } - gdk_draw_rectangle (d, gc, TRUE, (((gint) ((i + 1) * step)) + self->priv->margin_left) - (bar_w / 2), ((height - self->priv->margin_bottom) - (j * 6)) - 6, bar_w, 4); + _tmp290_ = ctx; + _tmp291_ = i; + _tmp292_ = step; + _tmp293_ = self->priv->eq_margin_left; + _tmp294_ = bar_w; + _tmp295_ = height; + _tmp296_ = self->priv->eq_margin_bottom; + _tmp297_ = j; + _tmp298_ = bar_w; + cairo_rectangle (_tmp290_, (gdouble) ((((gint) ((_tmp291_ + 1) * _tmp292_)) + _tmp293_) - (_tmp294_ / 2)), (gdouble) (((_tmp295_ - _tmp296_) - (_tmp297_ * 6)) - 6), (gdouble) _tmp298_, (gdouble) 4); } } } + _tmp299_ = ctx; + cairo_fill (_tmp299_); } } - gdk_gc_set_clip_rectangle (gc, (_tmp23_ = (_tmp22_.x = 0, _tmp22_.y = 0, _tmp22_.width = width, _tmp22_.height = height, _tmp22_), &_tmp23_)); - gdk_gc_set_line_attributes (gc, 1, GDK_LINE_ON_OFF_DASH, GDK_CAP_NOT_LAST, GDK_JOIN_MITER); - gdk_draw_line (d, gc, self->priv->margin_left + 1, self->priv->mouse_y, width, self->priv->mouse_y); + _tmp300_ = ctx; + cairo_reset_clip (_tmp300_); + _tmp301_ = ctx; + _tmp302_ = g_new0 (gdouble, 2); + _tmp302_[0] = (gdouble) 4; + _tmp302_[1] = (gdouble) 4; + _tmp303_ = _tmp302_; + _tmp303__length1 = 2; + cairo_set_dash (_tmp301_, _tmp303_, 2, (gdouble) 0); + _tmp303_ = (g_free (_tmp303_), NULL); + _tmp304_ = ctx; + _tmp305_ = self->priv->eq_margin_left; + _tmp306_ = self->priv->mouse_y; + cairo_move_to (_tmp304_, (gdouble) (_tmp305_ + 1), (gdouble) _tmp306_); + _tmp307_ = ctx; + _tmp308_ = width; + _tmp309_ = self->priv->mouse_y; + cairo_line_to (_tmp307_, (gdouble) _tmp308_, (gdouble) _tmp309_); + _tmp310_ = ctx; + cairo_stroke (_tmp310_); result = FALSE; _g_free0 (tmp); _pango_font_description_free0 (fd); - _g_object_unref0 (ctx); + _g_object_unref0 (pctx); _g_object_unref0 (l); - _g_object_unref0 (gc); - _g_object_unref0 (d); + _cairo_destroy0 (ctx); return result; } -static inline double ddb_equalizer_scale (DdbEqualizer* self, double val) { - double result = 0.0; - double k; - double d; +static inline gdouble ddb_equalizer_scale (DdbEqualizer* self, gdouble val) { + gdouble result = 0.0; + gdouble k; + gdouble d; + gdouble _tmp0_; + gdouble _tmp1_; g_return_val_if_fail (self != NULL, 0.0); - k = (double) (-40); - d = (double) 20; - result = (((val + self->priv->preamp) - 0.5) * k) + d; + k = (gdouble) (-40); + d = (gdouble) 20; + _tmp0_ = val; + _tmp1_ = self->priv->preamp; + result = (((_tmp0_ + _tmp1_) - 0.5) * k) + d; return result; } -static gboolean ddb_equalizer_in_curve_area (DdbEqualizer* self, double x, double y) { +static gboolean ddb_equalizer_in_curve_area (DdbEqualizer* self, gdouble x, gdouble y) { gboolean result = FALSE; gboolean _tmp0_ = FALSE; gboolean _tmp1_ = FALSE; gboolean _tmp2_ = FALSE; + gdouble _tmp3_; + gint _tmp4_; + gboolean _tmp8_; + gboolean _tmp10_; + gboolean _tmp15_; g_return_val_if_fail (self != NULL, FALSE); - if (x > self->priv->margin_left) { - _tmp2_ = x < (((GtkWidget*) self)->allocation.width - 1); + _tmp3_ = x; + _tmp4_ = self->priv->eq_margin_left; + if (_tmp3_ > ((gdouble) _tmp4_)) { + gdouble _tmp5_; + GtkAllocation _tmp6_; + gint _tmp7_; + _tmp5_ = x; + _tmp6_ = ((GtkWidget*) self)->allocation; + _tmp7_ = _tmp6_.width; + _tmp2_ = _tmp5_ < ((gdouble) (_tmp7_ - 1)); } else { _tmp2_ = FALSE; } - if (_tmp2_) { - _tmp1_ = y > 1; + _tmp8_ = _tmp2_; + if (_tmp8_) { + gdouble _tmp9_; + _tmp9_ = y; + _tmp1_ = _tmp9_ > ((gdouble) 1); } else { _tmp1_ = FALSE; } - if (_tmp1_) { - _tmp0_ = y < (((GtkWidget*) self)->allocation.height - self->priv->margin_bottom); + _tmp10_ = _tmp1_; + if (_tmp10_) { + gdouble _tmp11_; + GtkAllocation _tmp12_; + gint _tmp13_; + gint _tmp14_; + _tmp11_ = y; + _tmp12_ = ((GtkWidget*) self)->allocation; + _tmp13_ = _tmp12_.height; + _tmp14_ = self->priv->eq_margin_bottom; + _tmp0_ = _tmp11_ < ((gdouble) (_tmp13_ - _tmp14_)); } else { _tmp0_ = FALSE; } - result = _tmp0_; + _tmp15_ = _tmp0_; + result = _tmp15_; return result; } -static void ddb_equalizer_update_eq_drag (DdbEqualizer* self, double x, double y) { - double band_width; +static void ddb_equalizer_update_eq_drag (DdbEqualizer* self, gdouble x, gdouble y) { + GtkAllocation _tmp0_; + gint _tmp1_; + gint _tmp2_; + gdouble band_width; + gdouble _tmp3_; + gint _tmp4_; + gdouble _tmp5_; + gdouble _tmp6_ = 0.0; gint band; - gboolean _tmp0_ = FALSE; + gint _tmp7_; + gint _tmp8_; + gboolean _tmp10_ = FALSE; + gint _tmp11_; + gboolean _tmp13_; g_return_if_fail (self != NULL); - band_width = ((double) (((GtkWidget*) self)->allocation.width - self->priv->margin_left)) / ((double) (DDB_EQUALIZER_bands + 1)); - band = (gint) floor (((x - self->priv->margin_left) / band_width) - 0.5); - if (band < 0) { + _tmp0_ = ((GtkWidget*) self)->allocation; + _tmp1_ = _tmp0_.width; + _tmp2_ = self->priv->eq_margin_left; + band_width = ((gdouble) (_tmp1_ - _tmp2_)) / ((gdouble) (DDB_EQUALIZER_bands + 1)); + _tmp3_ = x; + _tmp4_ = self->priv->eq_margin_left; + _tmp5_ = band_width; + _tmp6_ = floor (((_tmp3_ - _tmp4_) / _tmp5_) - 0.5); + band = (gint) _tmp6_; + _tmp7_ = band; + if (_tmp7_ < 0) { band = 0; } - if (band >= DDB_EQUALIZER_bands) { - band = band - 1; + _tmp8_ = band; + if (_tmp8_ >= DDB_EQUALIZER_bands) { + gint _tmp9_; + _tmp9_ = band; + band = _tmp9_ - 1; } - if (band >= 0) { - _tmp0_ = band < DDB_EQUALIZER_bands; + _tmp11_ = band; + if (_tmp11_ >= 0) { + gint _tmp12_; + _tmp12_ = band; + _tmp10_ = _tmp12_ < DDB_EQUALIZER_bands; } else { - _tmp0_ = FALSE; + _tmp10_ = FALSE; } - if (_tmp0_) { - self->priv->values[band] = y / ((double) (((GtkWidget*) self)->allocation.height - self->priv->margin_bottom)); - if (self->priv->values[band] > 1) { - self->priv->values[band] = (double) 1; + _tmp13_ = _tmp10_; + if (_tmp13_) { + gdouble* _tmp14_; + gint _tmp14__length1; + gint _tmp15_; + gdouble _tmp16_; + GtkAllocation _tmp17_; + gint _tmp18_; + gint _tmp19_; + gdouble _tmp20_; + gdouble* _tmp21_; + gint _tmp21__length1; + gint _tmp22_; + gdouble _tmp23_; + _tmp14_ = self->priv->values; + _tmp14__length1 = self->priv->values_length1; + _tmp15_ = band; + _tmp16_ = y; + _tmp17_ = ((GtkWidget*) self)->allocation; + _tmp18_ = _tmp17_.height; + _tmp19_ = self->priv->eq_margin_bottom; + _tmp14_[_tmp15_] = _tmp16_ / ((gdouble) (_tmp18_ - _tmp19_)); + _tmp20_ = _tmp14_[_tmp15_]; + _tmp21_ = self->priv->values; + _tmp21__length1 = self->priv->values_length1; + _tmp22_ = band; + _tmp23_ = _tmp21_[_tmp22_]; + if (_tmp23_ > ((gdouble) 1)) { + gdouble* _tmp24_; + gint _tmp24__length1; + gint _tmp25_; + gdouble _tmp26_; + _tmp24_ = self->priv->values; + _tmp24__length1 = self->priv->values_length1; + _tmp25_ = band; + _tmp24_[_tmp25_] = (gdouble) 1; + _tmp26_ = _tmp24_[_tmp25_]; } else { - if (self->priv->values[band] < 0) { - self->priv->values[band] = (double) 0; + gdouble* _tmp27_; + gint _tmp27__length1; + gint _tmp28_; + gdouble _tmp29_; + _tmp27_ = self->priv->values; + _tmp27__length1 = self->priv->values_length1; + _tmp28_ = band; + _tmp29_ = _tmp27_[_tmp28_]; + if (_tmp29_ < ((gdouble) 0)) { + gdouble* _tmp30_; + gint _tmp30__length1; + gint _tmp31_; + gdouble _tmp32_; + _tmp30_ = self->priv->values; + _tmp30__length1 = self->priv->values_length1; + _tmp31_ = band; + _tmp30_[_tmp31_] = (gdouble) 0; + _tmp32_ = _tmp30_[_tmp31_]; } } g_signal_emit_by_name (self, "on-changed"); @@ -446,38 +1178,103 @@ static void ddb_equalizer_update_eq_drag (DdbEqualizer* self, double x, double y static gboolean ddb_equalizer_real_button_press_event (GtkWidget* base, GdkEventButton* event) { DdbEqualizer * self; gboolean result = FALSE; - gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; - gboolean _tmp2_ = FALSE; + GdkEventButton _tmp0_; + gdouble _tmp1_; + GdkEventButton _tmp2_; + gdouble _tmp3_; + gboolean _tmp4_ = FALSE; + gboolean _tmp11_ = FALSE; + gboolean _tmp12_ = FALSE; + gboolean _tmp13_ = FALSE; + GdkEventButton _tmp14_; + gdouble _tmp15_; + gboolean _tmp18_; + gboolean _tmp24_; + gboolean _tmp27_; self = (DdbEqualizer*) base; - if (ddb_equalizer_in_curve_area (self, (double) ((gint) (*event).x), (double) ((gint) (*event).y))) { + g_return_val_if_fail (event != NULL, FALSE); + _tmp0_ = *event; + _tmp1_ = _tmp0_.x; + _tmp2_ = *event; + _tmp3_ = _tmp2_.y; + _tmp4_ = ddb_equalizer_in_curve_area (self, (gdouble) ((gint) _tmp1_), (gdouble) ((gint) _tmp3_)); + if (_tmp4_) { + GdkEventButton _tmp5_; + gdouble _tmp6_; + GdkEventButton _tmp7_; + gdouble _tmp8_; + GdkEventButton _tmp9_; + gdouble _tmp10_; self->priv->curve_hook = TRUE; - ddb_equalizer_update_eq_drag (self, (double) ((gint) (*event).x), (double) ((gint) (*event).y)); - self->priv->mouse_y = (gint) (*event).y; + _tmp5_ = *event; + _tmp6_ = _tmp5_.x; + _tmp7_ = *event; + _tmp8_ = _tmp7_.y; + ddb_equalizer_update_eq_drag (self, (gdouble) ((gint) _tmp6_), (gdouble) ((gint) _tmp8_)); + _tmp9_ = *event; + _tmp10_ = _tmp9_.y; + self->priv->mouse_y = (gint) _tmp10_; gtk_widget_queue_draw ((GtkWidget*) self); result = FALSE; return result; } - if ((*event).x <= 11) { - _tmp2_ = (*event).y > 1; + _tmp14_ = *event; + _tmp15_ = _tmp14_.x; + if (_tmp15_ <= ((gdouble) 11)) { + GdkEventButton _tmp16_; + gdouble _tmp17_; + _tmp16_ = *event; + _tmp17_ = _tmp16_.y; + _tmp13_ = _tmp17_ > ((gdouble) 1); } else { - _tmp2_ = FALSE; + _tmp13_ = FALSE; } - if (_tmp2_) { - _tmp1_ = (*event).y <= (((GtkWidget*) self)->allocation.height - self->priv->margin_bottom); + _tmp18_ = _tmp13_; + if (_tmp18_) { + GdkEventButton _tmp19_; + gdouble _tmp20_; + GtkAllocation _tmp21_; + gint _tmp22_; + gint _tmp23_; + _tmp19_ = *event; + _tmp20_ = _tmp19_.y; + _tmp21_ = ((GtkWidget*) self)->allocation; + _tmp22_ = _tmp21_.height; + _tmp23_ = self->priv->eq_margin_bottom; + _tmp12_ = _tmp20_ <= ((gdouble) (_tmp22_ - _tmp23_)); } else { - _tmp1_ = FALSE; + _tmp12_ = FALSE; } - if (_tmp1_) { - _tmp0_ = (*event).button == 1; + _tmp24_ = _tmp12_; + if (_tmp24_) { + GdkEventButton _tmp25_; + guint _tmp26_; + _tmp25_ = *event; + _tmp26_ = _tmp25_.button; + _tmp11_ = _tmp26_ == ((guint) 1); } else { - _tmp0_ = FALSE; + _tmp11_ = FALSE; } - if (_tmp0_) { - self->priv->preamp = (*event).y / ((double) (((GtkWidget*) self)->allocation.height - self->priv->margin_bottom)); + _tmp27_ = _tmp11_; + if (_tmp27_) { + GdkEventButton _tmp28_; + gdouble _tmp29_; + GtkAllocation _tmp30_; + gint _tmp31_; + gint _tmp32_; + GdkEventButton _tmp33_; + gdouble _tmp34_; + _tmp28_ = *event; + _tmp29_ = _tmp28_.y; + _tmp30_ = ((GtkWidget*) self)->allocation; + _tmp31_ = _tmp30_.height; + _tmp32_ = self->priv->eq_margin_bottom; + self->priv->preamp = _tmp29_ / ((gdouble) (_tmp31_ - _tmp32_)); g_signal_emit_by_name (self, "on-changed"); self->priv->preamp_hook = TRUE; - self->priv->mouse_y = (gint) (*event).y; + _tmp33_ = *event; + _tmp34_ = _tmp33_.y; + self->priv->mouse_y = (gint) _tmp34_; gtk_widget_queue_draw ((GtkWidget*) self); } result = FALSE; @@ -488,10 +1285,15 @@ static gboolean ddb_equalizer_real_button_press_event (GtkWidget* base, GdkEvent static gboolean ddb_equalizer_real_button_release_event (GtkWidget* base, GdkEventButton* event) { DdbEqualizer * self; gboolean result = FALSE; + GdkWindow* _tmp0_ = NULL; + GdkCursor* _tmp1_; self = (DdbEqualizer*) base; + g_return_val_if_fail (event != NULL, FALSE); self->priv->curve_hook = FALSE; self->priv->preamp_hook = FALSE; - gdk_window_set_cursor (gtk_widget_get_window ((GtkWidget*) self), self->priv->pointer_cursor); + _tmp0_ = gtk_widget_get_window ((GtkWidget*) self); + _tmp1_ = self->priv->pointer_cursor; + gdk_window_set_cursor (_tmp0_, _tmp1_); result = FALSE; return result; } @@ -501,6 +1303,7 @@ static gboolean ddb_equalizer_real_leave_notify_event (GtkWidget* base, GdkEvent DdbEqualizer * self; gboolean result = FALSE; self = (DdbEqualizer*) base; + g_return_val_if_fail (event != NULL, FALSE); self->priv->mouse_y = -1; gtk_widget_queue_draw ((GtkWidget*) self); result = FALSE; @@ -511,30 +1314,77 @@ static gboolean ddb_equalizer_real_leave_notify_event (GtkWidget* base, GdkEvent static gboolean ddb_equalizer_real_motion_notify_event (GtkWidget* base, GdkEventMotion* event) { DdbEqualizer * self; gboolean result = FALSE; - double y; + GdkEventMotion _tmp0_; + gdouble _tmp1_; + GtkAllocation _tmp2_; + gint _tmp3_; + gint _tmp4_; + gdouble y; + gdouble _tmp5_; + gdouble _tmp6_; + gboolean _tmp7_; + GdkEventMotion _tmp9_; + gdouble _tmp10_; + GdkEventMotion _tmp11_; + gdouble _tmp12_; + gboolean _tmp13_ = FALSE; + gboolean _tmp16_; self = (DdbEqualizer*) base; - y = (*event).y / ((double) (((GtkWidget*) self)->allocation.height - self->priv->margin_bottom)); - if (y < 0) { - y = (double) 0; + g_return_val_if_fail (event != NULL, FALSE); + _tmp0_ = *event; + _tmp1_ = _tmp0_.y; + _tmp2_ = ((GtkWidget*) self)->allocation; + _tmp3_ = _tmp2_.height; + _tmp4_ = self->priv->eq_margin_bottom; + y = _tmp1_ / ((gdouble) (_tmp3_ - _tmp4_)); + _tmp5_ = y; + if (_tmp5_ < ((gdouble) 0)) { + y = (gdouble) 0; } - if (y > 1) { - y = (double) 1; + _tmp6_ = y; + if (_tmp6_ > ((gdouble) 1)) { + y = (gdouble) 1; } - if (self->priv->preamp_hook) { - self->priv->preamp = y; + _tmp7_ = self->priv->preamp_hook; + if (_tmp7_) { + gdouble _tmp8_; + _tmp8_ = y; + self->priv->preamp = _tmp8_; g_signal_emit_by_name (self, "on-changed"); gtk_widget_queue_draw ((GtkWidget*) self); result = FALSE; return result; } - if (!ddb_equalizer_in_curve_area (self, (double) ((gint) (*event).x), (double) ((gint) (*event).y))) { + _tmp9_ = *event; + _tmp10_ = _tmp9_.x; + _tmp11_ = *event; + _tmp12_ = _tmp11_.y; + _tmp13_ = ddb_equalizer_in_curve_area (self, (gdouble) ((gint) _tmp10_), (gdouble) ((gint) _tmp12_)); + if (!_tmp13_) { self->priv->mouse_y = -1; } else { - self->priv->mouse_y = (gint) (*event).y; + GdkEventMotion _tmp14_; + gdouble _tmp15_; + _tmp14_ = *event; + _tmp15_ = _tmp14_.y; + self->priv->mouse_y = (gint) _tmp15_; } - if (self->priv->curve_hook) { - ddb_equalizer_update_eq_drag (self, (double) ((gint) (*event).x), (double) ((gint) (*event).y)); - self->priv->mouse_y = (gint) (*event).y; + _tmp16_ = self->priv->curve_hook; + if (_tmp16_) { + GdkEventMotion _tmp17_; + gdouble _tmp18_; + GdkEventMotion _tmp19_; + gdouble _tmp20_; + GdkEventMotion _tmp21_; + gdouble _tmp22_; + _tmp17_ = *event; + _tmp18_ = _tmp17_.x; + _tmp19_ = *event; + _tmp20_ = _tmp19_.y; + ddb_equalizer_update_eq_drag (self, (gdouble) ((gint) _tmp18_), (gdouble) ((gint) _tmp20_)); + _tmp21_ = *event; + _tmp22_ = _tmp21_.y; + self->priv->mouse_y = (gint) _tmp22_; } gtk_widget_queue_draw ((GtkWidget*) self); result = FALSE; @@ -542,37 +1392,59 @@ static gboolean ddb_equalizer_real_motion_notify_event (GtkWidget* base, GdkEven } -void ddb_equalizer_set_band (DdbEqualizer* self, gint band, double v) { +void ddb_equalizer_set_band (DdbEqualizer* self, gint band, gdouble v) { + gdouble* _tmp0_; + gint _tmp0__length1; + gint _tmp1_; + gdouble _tmp2_; + gdouble _tmp3_; g_return_if_fail (self != NULL); - self->priv->values[band] = 1 - ((v + 20.0) / 40.0); + _tmp0_ = self->priv->values; + _tmp0__length1 = self->priv->values_length1; + _tmp1_ = band; + _tmp2_ = v; + _tmp0_[_tmp1_] = 1 - ((_tmp2_ + 20.0) / 40.0); + _tmp3_ = _tmp0_[_tmp1_]; } -double ddb_equalizer_get_band (DdbEqualizer* self, gint band) { - double result = 0.0; +gdouble ddb_equalizer_get_band (DdbEqualizer* self, gint band) { + gdouble result = 0.0; + gdouble* _tmp0_; + gint _tmp0__length1; + gint _tmp1_; + gdouble _tmp2_; g_return_val_if_fail (self != NULL, 0.0); - result = ((1 - self->priv->values[band]) * 40.0) - 20.0; + _tmp0_ = self->priv->values; + _tmp0__length1 = self->priv->values_length1; + _tmp1_ = band; + _tmp2_ = _tmp0_[_tmp1_]; + result = ((1 - _tmp2_) * 40.0) - 20.0; return result; } -void ddb_equalizer_set_preamp (DdbEqualizer* self, double v) { +void ddb_equalizer_set_preamp (DdbEqualizer* self, gdouble v) { + gdouble _tmp0_; g_return_if_fail (self != NULL); - self->priv->preamp = 1 - ((v + 20.0) / 40.0); + _tmp0_ = v; + self->priv->preamp = 1 - ((_tmp0_ + 20.0) / 40.0); } -double ddb_equalizer_get_preamp (DdbEqualizer* self) { - double result = 0.0; +gdouble ddb_equalizer_get_preamp (DdbEqualizer* self) { + gdouble result = 0.0; + gdouble _tmp0_; g_return_val_if_fail (self != NULL, 0.0); - result = ((1 - self->priv->preamp) * 40.0) - 20.0; + _tmp0_ = self->priv->preamp; + result = ((1 - _tmp0_) * 40.0) - 20.0; return result; } DdbEqualizer* ddb_equalizer_construct (GType object_type) { - DdbEqualizer * self; - self = g_object_newv (object_type, 0, NULL); + DdbEqualizer * self = NULL; + self = (DdbEqualizer*) g_object_new (object_type, NULL); return self; } @@ -586,13 +1458,25 @@ static GObject * ddb_equalizer_constructor (GType type, guint n_construct_proper GObject * obj; GObjectClass * parent_class; DdbEqualizer * self; + GtkStyle* _tmp0_ = NULL; + const PangoFontDescription* _tmp1_; + gint _tmp2_ = 0; + gdouble _tmp3_ = 0.0; + GdkScreen* _tmp4_ = NULL; + gdouble _tmp5_ = 0.0; + gint _tmp6_; parent_class = G_OBJECT_CLASS (ddb_equalizer_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = DDB_EQUALIZER (obj); - { - self->priv->margin_bottom = (gint) (((pango_units_to_double (pango_font_description_get_size (gtk_widget_get_style ((GtkWidget*) self)->font_desc)) * gdk_screen_get_resolution (gdk_screen_get_default ())) / 72) + 4); - self->priv->margin_left = self->priv->margin_bottom * 4; - } + _tmp0_ = gtk_widget_get_style ((GtkWidget*) self); + _tmp1_ = _tmp0_->font_desc; + _tmp2_ = pango_font_description_get_size (_tmp1_); + _tmp3_ = pango_units_to_double (_tmp2_); + _tmp4_ = gdk_screen_get_default (); + _tmp5_ = gdk_screen_get_resolution (_tmp4_); + self->priv->eq_margin_bottom = (gint) (((_tmp3_ * _tmp5_) / 72) + 4); + _tmp6_ = self->priv->eq_margin_bottom; + self->priv->eq_margin_left = _tmp6_ * 4; return obj; } @@ -614,17 +1498,21 @@ static void ddb_equalizer_class_init (DdbEqualizerClass * klass) { static void ddb_equalizer_instance_init (DdbEqualizer * self) { + gdouble* _tmp0_ = NULL; + GdkCursor* _tmp1_; self->priv = DDB_EQUALIZER_GET_PRIVATE (self); - self->priv->values = g_new0 (double, DDB_EQUALIZER_bands); + _tmp0_ = g_new0 (gdouble, DDB_EQUALIZER_bands); + self->priv->values = _tmp0_; self->priv->values_length1 = DDB_EQUALIZER_bands; self->priv->_values_size_ = self->priv->values_length1; self->priv->preamp = 0.5; self->priv->mouse_y = -1; self->priv->curve_hook = FALSE; self->priv->preamp_hook = FALSE; - self->priv->margin_bottom = -1; - self->priv->margin_left = -1; - self->priv->pointer_cursor = gdk_cursor_new (GDK_LEFT_PTR); + self->priv->eq_margin_bottom = -1; + self->priv->eq_margin_left = -1; + _tmp1_ = gdk_cursor_new (GDK_LEFT_PTR); + self->priv->pointer_cursor = _tmp1_; } @@ -650,4 +1538,3 @@ GType ddb_equalizer_get_type (void) { - |