Mercurial > audlegacy
changeset 4312:45505a00a6cf
store sliders' values as is
author | Eugene Zagidullin <e.asphyx@gmail.com> |
---|---|
date | Sun, 02 Mar 2008 21:50:02 +0300 |
parents | 9eee96d071d5 |
children | 772de6f365cf |
files | src/audacious/ui_skinned_equalizer_slider.c src/audacious/ui_skinned_equalizer_slider.h |
diffstat | 2 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/ui_skinned_equalizer_slider.c Wed Feb 27 17:47:06 2008 +0900 +++ b/src/audacious/ui_skinned_equalizer_slider.c Sun Mar 02 21:50:02 2008 +0300 @@ -45,6 +45,7 @@ gint width, height; gboolean pressed; gint drag_y; + gfloat value; /* store gain as is to prevent truncation --asphyx */ }; static void ui_skinned_equalizer_slider_class_init (UiSkinnedEqualizerSliderClass *klass); @@ -255,6 +256,8 @@ priv->position = 50; if (priv->position >= 24 && priv->position <= 26) priv->position = 25; + + priv->value = ((gfloat) (25 - priv->position) * EQUALIZER_MAX_GAIN / 25.0 ); equalizerwin_eq_changed(); } @@ -296,7 +299,8 @@ priv->position = 50; if (priv->position >= 24 && priv->position <= 26) priv->position = 25; - + + priv->value = ((gfloat) (25 - priv->position) * EQUALIZER_MAX_GAIN / 25.0 ); ui_skinned_equalizer_slider_set_mainwin_text(es); equalizerwin_eq_changed(); gtk_widget_queue_draw(widget); @@ -323,6 +327,7 @@ priv->position = 50; } + priv->value = ((gfloat) (25 - priv->position) * EQUALIZER_MAX_GAIN / 25.0 ); equalizerwin_eq_changed(); gtk_widget_queue_draw(widget); return TRUE; @@ -340,13 +345,14 @@ gtk_widget_queue_draw(GTK_WIDGET(equalizer_slider)); } -void ui_skinned_equalizer_slider_set_position(GtkWidget *widget, gint pos) { +void ui_skinned_equalizer_slider_set_position(GtkWidget *widget, gfloat pos) { g_return_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (widget)); UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget); if (priv->pressed) return; + priv->value = pos; priv->position = 25 - (gint) ((pos * 25.0) / EQUALIZER_MAX_GAIN); if (priv->position < 0) @@ -364,7 +370,7 @@ gfloat ui_skinned_equalizer_slider_get_position(GtkWidget *widget) { g_return_val_if_fail (UI_SKINNED_IS_EQUALIZER_SLIDER (widget), -1); UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget); - return (EQUALIZER_MAX_GAIN - (((gfloat) priv->position * EQUALIZER_MAX_GAIN) / 25.0)); + return priv->value; } void ui_skinned_equalizer_slider_set_mainwin_text(UiSkinnedEqualizerSlider * es) {
--- a/src/audacious/ui_skinned_equalizer_slider.h Wed Feb 27 17:47:06 2008 +0900 +++ b/src/audacious/ui_skinned_equalizer_slider.h Sun Mar 02 21:50:02 2008 +0300 @@ -50,7 +50,7 @@ GtkWidget* ui_skinned_equalizer_slider_new(GtkWidget *fixed, gint x, gint y); GtkType ui_skinned_equalizer_slider_get_type(void); -void ui_skinned_equalizer_slider_set_position(GtkWidget *widget, gint pos); +void ui_skinned_equalizer_slider_set_position(GtkWidget *widget, gfloat pos); gfloat ui_skinned_equalizer_slider_get_position(GtkWidget *widget); #ifdef __cplusplus