Mercurial > audlegacy
changeset 4217:742f00832961
some more progress, but still broken
author | Cristi Magherusan <majeru@atheme.org> |
---|---|
date | Sun, 27 Jan 2008 21:24:28 +0200 |
parents | 75d99359357b |
children | f1074a07ec09 |
files | src/audacious/ui/carbon-menubar.ui src/audacious/ui/mainwin.ui src/audacious/ui_skinned_equalizer_slider.c src/audacious/ui_skinned_equalizer_slider.h src/audacious/ui_skinned_number.c src/audacious/ui_skinned_number.h src/audacious/ui_skinned_textbox.c src/audacious/ui_skinned_textbox.h src/audacious/ui_vis.c src/audacious/ui_vis.h |
diffstat | 10 files changed, 122 insertions(+), 118 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/ui/carbon-menubar.ui Sun Jan 27 19:43:53 2008 +0200 +++ b/src/audacious/ui/carbon-menubar.ui Sun Jan 27 21:24:28 2008 +0200 @@ -65,7 +65,7 @@ <menuitem action="roll up playlist editor" /> <menuitem action="roll up equalizer" /> <separator /> - <menuitem action="view doublesize" /> + <menuitem action="view scale" /> <menuitem action="view easy move" /> </menu> <menu action="visualization">
--- a/src/audacious/ui/mainwin.ui Sun Jan 27 19:43:53 2008 +0200 +++ b/src/audacious/ui/mainwin.ui Sun Jan 27 21:24:28 2008 +0200 @@ -122,7 +122,7 @@ <menuitem action="roll up playlist editor" /> <menuitem action="roll up equalizer" /> <separator /> - <menuitem action="view doublesize" /> + <menuitem action="view scale" /> <menuitem action="view easy move" /> </menu> <separator />
--- a/src/audacious/ui_skinned_equalizer_slider.c Sun Jan 27 19:43:53 2008 +0200 +++ b/src/audacious/ui_skinned_equalizer_slider.c Sun Jan 27 21:24:28 2008 +0200 @@ -39,7 +39,7 @@ struct _UiSkinnedEqualizerSliderPrivate { SkinPixmapId skin_index; - gboolean double_size; + gboolean scaled; gint position; gint width, height; gboolean pressed; @@ -57,7 +57,7 @@ static gboolean ui_skinned_equalizer_slider_button_release (GtkWidget *widget, GdkEventButton *event); static gboolean ui_skinned_equalizer_slider_motion_notify (GtkWidget *widget, GdkEventMotion *event); static gboolean ui_skinned_equalizer_slider_scroll (GtkWidget *widget, GdkEventScroll *event); -static void ui_skinned_equalizer_slider_toggle_doublesize (UiSkinnedEqualizerSlider *equalizer_slider); +static void ui_skinned_equalizer_slider_toggle_scaled (UiSkinnedEqualizerSlider *equalizer_slider); void ui_skinned_equalizer_slider_set_mainwin_text (UiSkinnedEqualizerSlider * es); static GtkWidgetClass *parent_class = NULL; @@ -104,11 +104,11 @@ widget_class->motion_notify_event = ui_skinned_equalizer_slider_motion_notify; widget_class->scroll_event = ui_skinned_equalizer_slider_scroll; - klass->doubled = ui_skinned_equalizer_slider_toggle_doublesize; + klass->scaled = ui_skinned_equalizer_slider_toggle_scaled; equalizer_slider_signals[DOUBLED] = - g_signal_new ("toggle-double-size", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (UiSkinnedEqualizerSliderClass, doubled), NULL, NULL, + g_signal_new ("toggle-scaled", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (UiSkinnedEqualizerSliderClass, scaled), NULL, NULL, gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); g_type_class_add_private (gobject_class, sizeof (UiSkinnedEqualizerSliderPrivate)); @@ -179,8 +179,8 @@ static void ui_skinned_equalizer_slider_size_request(GtkWidget *widget, GtkRequisition *requisition) { UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(widget); - requisition->width = priv->width*(1+priv->double_size); - requisition->height = priv->height*(1+priv->double_size); + requisition->width = priv->width*(priv->scaled ? cfg.scale_factor : 1); + requisition->height = priv->height*(priv->scaled ? cfg.scale_factor : 1); } static void ui_skinned_equalizer_slider_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { @@ -188,13 +188,13 @@ UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(equalizer_slider); widget->allocation = *allocation; - widget->allocation.x *= (1+priv->double_size); - widget->allocation.y *= (1+priv->double_size); + widget->allocation.x *= (priv->scaled ? cfg.scale_factor : 1); + widget->allocation.y *= (priv->scaled ? cfg.scale_factor : 1); if (GTK_WIDGET_REALIZED (widget)) gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height); - equalizer_slider->x = widget->allocation.x/(priv->double_size ? 2 : 1); - equalizer_slider->y = widget->allocation.y/(priv->double_size ? 2 : 1); + equalizer_slider->x = widget->allocation.x/(priv->scaled ? cfg.scale_factor : 1); + equalizer_slider->y = widget->allocation.y/(priv->scaled ? cfg.scale_factor : 1); } static gboolean ui_skinned_equalizer_slider_expose(GtkWidget *widget, GdkEventExpose *event) { @@ -221,7 +221,7 @@ else skin_draw_pixbuf(widget, bmp_active_skin, obj, priv->skin_index, 0, 164, 1, priv->position, 11, 11); - ui_skinned_widget_draw(widget, obj, priv->width, priv->height, priv->double_size); + ui_skinned_widget_draw(widget, obj, priv->width, priv->height, priv->scaled); g_object_unref(obj); @@ -241,7 +241,7 @@ if (event->type == GDK_BUTTON_PRESS) { if (event->button == 1) { priv->pressed = TRUE; - y = event->y/(priv->double_size ? 2 : 1); + y = event->y/(priv->scaled ? cfg.scale_factor : 1); if (y >= priv->position && y < priv->position + 11) priv->drag_y = y - priv->position; @@ -286,7 +286,7 @@ if (priv->pressed) { gint y; - y = event->y/(priv->double_size ? 2 : 1); + y = event->y/(priv->scaled ? cfg.scale_factor : 1); priv->position = y - priv->drag_y; if (priv->position < 0) @@ -327,13 +327,14 @@ return TRUE; } -static void ui_skinned_equalizer_slider_toggle_doublesize(UiSkinnedEqualizerSlider *equalizer_slider) { +static void ui_skinned_equalizer_slider_toggle_scaled(UiSkinnedEqualizerSlider *equalizer_slider) { GtkWidget *widget = GTK_WIDGET (equalizer_slider); UiSkinnedEqualizerSliderPrivate *priv = UI_SKINNED_EQUALIZER_SLIDER_GET_PRIVATE(equalizer_slider); - priv->double_size = !priv->double_size; + priv->scaled = !priv->scaled; - gtk_widget_set_size_request(widget, priv->width*(1+priv->double_size), priv->height*(1+priv->double_size)); + gtk_widget_set_size_request(widget, priv->width*(priv->scaled ? cfg.scale_factor : 1), + priv->height*(priv->scaled ? cfg.scale_factor : 1)); gtk_widget_queue_draw(GTK_WIDGET(equalizer_slider)); }
--- a/src/audacious/ui_skinned_equalizer_slider.h Sun Jan 27 19:43:53 2008 +0200 +++ b/src/audacious/ui_skinned_equalizer_slider.h Sun Jan 27 21:24:28 2008 +0200 @@ -45,7 +45,7 @@ struct _UiSkinnedEqualizerSliderClass { GtkWidgetClass parent_class; - void (* doubled) (UiSkinnedEqualizerSlider *equalizer_slider); + void (* scaled) (UiSkinnedEqualizerSlider *equalizer_slider); }; GtkWidget* ui_skinned_equalizer_slider_new(GtkWidget *fixed, gint x, gint y);
--- a/src/audacious/ui_skinned_number.c Sun Jan 27 19:43:53 2008 +0200 +++ b/src/audacious/ui_skinned_number.c Sun Jan 27 21:24:28 2008 +0200 @@ -47,7 +47,7 @@ static void ui_skinned_number_size_request (GtkWidget *widget, GtkRequisition *requisition); static void ui_skinned_number_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static gboolean ui_skinned_number_expose (GtkWidget *widget, GdkEventExpose *event); -static void ui_skinned_number_toggle_doublesize (UiSkinnedNumber *number); +static void ui_skinned_number_toggle_scaled (UiSkinnedNumber *number); static GtkWidgetClass *parent_class = NULL; static guint number_signals[LAST_SIGNAL] = { 0 }; @@ -87,11 +87,11 @@ widget_class->size_request = ui_skinned_number_size_request; widget_class->size_allocate = ui_skinned_number_size_allocate; - klass->doubled = ui_skinned_number_toggle_doublesize; + klass->scaled = ui_skinned_number_toggle_scaled; number_signals[DOUBLED] = - g_signal_new ("toggle-double-size", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (UiSkinnedNumberClass, doubled), NULL, NULL, + g_signal_new ("toggle-scaled", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (UiSkinnedNumberClass, scaled), NULL, NULL, gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); } @@ -108,7 +108,7 @@ number->num = 0; number->skin_index = si; - number->double_size = FALSE; + number->scaled = FALSE; gtk_fixed_put(GTK_FIXED(fixed), GTK_WIDGET(number), number->x, number->y); @@ -160,21 +160,21 @@ static void ui_skinned_number_size_request(GtkWidget *widget, GtkRequisition *requisition) { UiSkinnedNumber *number = UI_SKINNED_NUMBER(widget); - requisition->width = number->width*(1+number->double_size); - requisition->height = number->height*(1+number->double_size); + requisition->width = number->width * ( number->scaled ? cfg.scale_factor : 1 ); + requisition->height = number->height*( number->scaled ? cfg.scale_factor : 1); } static void ui_skinned_number_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { UiSkinnedNumber *number = UI_SKINNED_NUMBER (widget); widget->allocation = *allocation; - widget->allocation.x *= (1+number->double_size); - widget->allocation.y *= (1+number->double_size); + widget->allocation.x *= (number->scaled ? cfg.scale_factor: 1 ); + widget->allocation.y *= (number->scaled ? cfg.scale_factor: 1 ); if (GTK_WIDGET_REALIZED (widget)) gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height); - number->x = widget->allocation.x/(number->double_size ? 2 : 1); - number->y = widget->allocation.y/(number->double_size ? 2 : 1); + number->x = widget->allocation.x/(number->scaled ? cfg.scale_factor : 1); + number->y = widget->allocation.y/(number->scaled ? cfg.scale_factor : 1); } static gboolean ui_skinned_number_expose(GtkWidget *widget, GdkEventExpose *event) { @@ -195,18 +195,19 @@ number->skin_index, number->num * 9, 0, 0, 0, number->width, number->height); - ui_skinned_widget_draw(widget, obj, number->width, number->height, number->double_size); + ui_skinned_widget_draw(widget, obj, number->width, number->height, number->scaled); g_object_unref(obj); return FALSE; } -static void ui_skinned_number_toggle_doublesize(UiSkinnedNumber *number) { +static void ui_skinned_number_toggle_scaled(UiSkinnedNumber *number) { GtkWidget *widget = GTK_WIDGET (number); - number->double_size = !number->double_size; + number->scaled = !number->scaled; - gtk_widget_set_size_request(widget, number->width*(1+number->double_size), number->height*(1+number->double_size)); + gtk_widget_set_size_request(widget, number->width * ( number->scaled ? cfg.scale_factor : 1), + number->height * ( number->scaled ? cfg.scale_factor : 1) ); gtk_widget_queue_draw(GTK_WIDGET(number)); } @@ -229,5 +230,6 @@ number->width = width; number->height = height; - gtk_widget_set_size_request(widget, width*(1+number->double_size), height*(1+number->double_size)); + gtk_widget_set_size_request(widget, width*(number->scaled ? cfg.scale_factor : 1 ), + height*(number->scaled ? cfg.scale_factor : 1 )); }
--- a/src/audacious/ui_skinned_number.h Sun Jan 27 19:43:53 2008 +0200 +++ b/src/audacious/ui_skinned_number.h Sun Jan 27 21:24:28 2008 +0200 @@ -40,13 +40,13 @@ gint x, y, width, height; gint num; - gboolean double_size; + gboolean scaled; SkinPixmapId skin_index; }; struct _UiSkinnedNumberClass { GtkWidgetClass parent_class; - void (* doubled) (UiSkinnedNumber *textbox); + void (* scaled) (UiSkinnedNumber *textbox); }; GtkWidget* ui_skinned_number_new (GtkWidget *fixed, gint x, gint y, SkinPixmapId si);
--- a/src/audacious/ui_skinned_textbox.c Sun Jan 27 19:43:53 2008 +0200 +++ b/src/audacious/ui_skinned_textbox.c Sun Jan 27 21:24:28 2008 +0200 @@ -47,7 +47,7 @@ struct _UiSkinnedTextboxPrivate { SkinPixmapId skin_index; - gboolean double_size; + gboolean scaled; gboolean scroll_back; gint nominal_y, nominal_height; gint scroll_timeout; @@ -75,7 +75,7 @@ static gboolean ui_skinned_textbox_button_press (GtkWidget *widget, GdkEventButton *event); static gboolean ui_skinned_textbox_button_release (GtkWidget *widget, GdkEventButton *event); static gboolean ui_skinned_textbox_motion_notify (GtkWidget *widget, GdkEventMotion *event); -static void ui_skinned_textbox_toggle_doublesize (UiSkinnedTextbox *textbox); +static void ui_skinned_textbox_toggle_scaled (UiSkinnedTextbox *textbox); static void ui_skinned_textbox_redraw (UiSkinnedTextbox *textbox); static gboolean ui_skinned_textbox_should_scroll (UiSkinnedTextbox *textbox); static void textbox_generate_xfont_pixmap (UiSkinnedTextbox *textbox, const gchar *pixmaptext); @@ -129,7 +129,7 @@ klass->clicked = NULL; klass->double_clicked = NULL; klass->right_clicked = NULL; - klass->doubled = ui_skinned_textbox_toggle_doublesize; + klass->scaled = ui_skinned_textbox_toggle_scaled; klass->redraw = ui_skinned_textbox_redraw; textbox_signals[CLICKED] = @@ -148,8 +148,8 @@ gtk_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); textbox_signals[DOUBLED] = - g_signal_new ("toggle-double-size", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (UiSkinnedTextboxClass, doubled), NULL, NULL, + g_signal_new ("toggle-scaled", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (UiSkinnedTextboxClass, scaled), NULL, NULL, gtk_marshal_VOID__VOID, G_TYPE_NONE, 0); textbox_signals[REDRAW] = @@ -183,7 +183,7 @@ priv->scroll_timeout = 0; priv->scroll_dummy = 0; - priv->double_size = FALSE; + priv->scaled = FALSE; gtk_fixed_put(GTK_FIXED(fixed), GTK_WIDGET(textbox), textbox->x, textbox->y); @@ -238,8 +238,8 @@ UiSkinnedTextbox *textbox = UI_SKINNED_TEXTBOX(widget); UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); - requisition->width = textbox->width*(1+priv->double_size); - requisition->height = textbox->height*(1+priv->double_size); + requisition->width = textbox->width*(priv->scaled ? cfg.scale_factor : 1); + requisition->height = textbox->height*(priv->scaled ? cfg.scale_factor : 1 ); } static void ui_skinned_textbox_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { @@ -247,20 +247,20 @@ UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); widget->allocation = *allocation; - widget->allocation.x *= (1+priv->double_size); - widget->allocation.y *= (1+priv->double_size); + widget->allocation.x *= (priv->scaled ? cfg.scale_factor : 1); + widget->allocation.y *= (priv->scaled ? cfg.scale_factor : 1); if (GTK_WIDGET_REALIZED (widget)) gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height); - if (textbox->x + priv->move_x == widget->allocation.x/(priv->double_size ? 2 : 1)) + if (textbox->x + priv->move_x == widget->allocation.x/(priv->scaled ? cfg.scale_factor : 1)); priv->move_x = 0; - if (textbox->y + priv->move_y == widget->allocation.y/(priv->double_size ? 2 : 1)) + if (textbox->y + priv->move_y == widget->allocation.y/(priv->scaled ? cfg.scale_factor : 1)); priv->move_y = 0; - textbox->x = widget->allocation.x/(priv->double_size ? 2 : 1); - textbox->y = widget->allocation.y/(priv->double_size ? 2 : 1); + textbox->x = widget->allocation.x/(priv->scaled ? cfg.scale_factor : 1); + textbox->y = widget->allocation.y/(priv->scaled ? cfg.scale_factor : 1); - if (textbox->width != widget->allocation.width/(priv->double_size ? 2 : 1)) { - textbox->width = widget->allocation.width/(priv->double_size ? 2 : 1); + if (textbox->width != (guint) (widget->allocation.width / (priv->scaled ? cfg.scale_factor : 1))) { + textbox->width = (guint) (widget->allocation.width / (priv->scaled ? cfg.scale_factor : 1)); if (priv->pixbuf_text) g_free(priv->pixbuf_text); priv->pixbuf_text = NULL; priv->offset = 0; @@ -317,7 +317,7 @@ } } - ui_skinned_widget_draw(widget, obj, textbox->width, textbox->height, priv->double_size); + ui_skinned_widget_draw(widget, obj, textbox->width, textbox->height, priv->scaled); g_object_unref(obj); } @@ -398,13 +398,14 @@ return TRUE; } -static void ui_skinned_textbox_toggle_doublesize(UiSkinnedTextbox *textbox) { +static void ui_skinned_textbox_toggle_scaled(UiSkinnedTextbox *textbox) { GtkWidget *widget = GTK_WIDGET (textbox); UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE(textbox); - priv->double_size = !priv->double_size; + priv->scaled = !priv->scaled; - gtk_widget_set_size_request(widget, textbox->width*(1+priv->double_size), textbox->height*(1+priv->double_size)); + gtk_widget_set_size_request(widget, textbox->width*(priv->scaled ? cfg.scale_factor : 1 ), + textbox->height*(priv->scaled ? cfg.scale_factor : 1 )); gtk_widget_queue_draw(GTK_WIDGET(textbox)); }
--- a/src/audacious/ui_skinned_textbox.h Sun Jan 27 19:43:53 2008 +0200 +++ b/src/audacious/ui_skinned_textbox.h Sun Jan 27 21:24:28 2008 +0200 @@ -53,7 +53,7 @@ void (* clicked) (UiSkinnedTextbox *textbox); void (* double_clicked) (UiSkinnedTextbox *textbox); void (* right_clicked) (UiSkinnedTextbox *textbox); - void (* doubled) (UiSkinnedTextbox *textbox); + void (* scaled) (UiSkinnedTextbox *textbox); void (* redraw) (UiSkinnedTextbox *textbox); };
--- a/src/audacious/ui_vis.c Sun Jan 27 19:43:53 2008 +0200 +++ b/src/audacious/ui_vis.c Sun Jan 27 21:24:28 2008 +0200 @@ -52,7 +52,7 @@ static void ui_vis_size_request (GtkWidget *widget, GtkRequisition *requisition); static void ui_vis_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static gboolean ui_vis_expose (GtkWidget *widget, GdkEventExpose *event); -static void ui_vis_toggle_doublesize (UiVis *vis); +static void ui_vis_toggle_scaled (UiVis *vis); static GtkWidgetClass *parent_class = NULL; static guint vis_signals[LAST_SIGNAL] = { 0 }; @@ -95,7 +95,7 @@ widget_class->size_request = ui_vis_size_request; widget_class->size_allocate = ui_vis_size_allocate; - klass->doubled = ui_vis_toggle_doublesize; + klass->doubled = ui_vis_toggle_scaled; vis_signals[DOUBLED] = g_signal_new ("toggle-double-size", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, @@ -117,7 +117,7 @@ vis->height = 16; vis->fixed = fixed; - vis->double_size = FALSE; + vis->scaled = FALSE; vis->visible_window = TRUE; vis->event_window = NULL; @@ -225,16 +225,16 @@ static void ui_vis_size_request(GtkWidget *widget, GtkRequisition *requisition) { UiVis *vis = UI_VIS(widget); - requisition->width = vis->width*(1+vis->double_size); - requisition->height = vis->height*(1+vis->double_size); + requisition->width = vis->width*(vis->scaled ? cfg.scale_factor : 1); + requisition->height = vis->height*(vis->scaled ? cfg.scale_factor : 1); } static void ui_vis_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { UiVis *vis = UI_VIS (widget); widget->allocation = *allocation; - widget->allocation.x *= (1+vis->double_size); - widget->allocation.y *= (1+vis->double_size); + widget->allocation.x *= (vis->scaled ? cfg.scale_factor : 1); + widget->allocation.y *= (vis->scaled ? cfg.scale_factor : 1); if (GTK_WIDGET_REALIZED (widget)) { if (vis->event_window != NULL) @@ -243,8 +243,8 @@ gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height); } - vis->x = widget->allocation.x/(vis->double_size ? 2 : 1); - vis->y = widget->allocation.y/(vis->double_size ? 2 : 1); + vis->x = widget->allocation.x/(vis->scaled ? 2 : 1); + vis->y = widget->allocation.y/(vis->scaled ? 2 : 1); } static gboolean ui_vis_expose(GtkWidget *widget, GdkEventExpose *event) { @@ -277,7 +277,7 @@ } cmap = gdk_rgb_cmap_new(colors, 24); - if (!vis->double_size) { + if (!vis->scaled) { if(cfg.vis_type == VIS_VOICEPRINT /*&& cfg.voiceprint_mode != VOICEPRINT_NORMAL*/){ memset(rgb_data, 0, 76 * 16 * 3); } @@ -295,14 +295,14 @@ memset(rgb_data, 0, 3 * 4 * 16 * 76); } else{ - memset(rgb_data, 0, 152 * 32); + memset(rgb_data, 0, (guint)(76 * cfg.scale_factor) * 32); for (y = 1; y < 16; y += 2) { - ptr = rgb_data + (y * 304); + ptr = rgb_data + (y * (guint)(76 * 4 * cfg.scale_factor)); for (x = 0; x < 76; x += 2, ptr += 4) { *ptr = 1; *(ptr + 1) = 1; - *(ptr + 152) = 1; - *(ptr + 153) = 1; + *(ptr + (guint)(76 * cfg.scale_factor)) = 1; + *(ptr + (guint)(76 * cfg.scale_factor)+1) = 1; } } } @@ -315,7 +315,7 @@ h = vis->data[x]; if (h && (cfg.analyzer_type == ANALYZER_LINES || (x % 4) != 3)) { - if (!vis->double_size) { + if (!vis->scaled) { ptr = rgb_data + ((16 - h) * 76) + x; switch (cfg.analyzer_mode) { case ANALYZER_NORMAL: @@ -333,30 +333,30 @@ } } else{ - ptr = rgb_data + ((16 - h) * 304) + (x << 1); + ptr = rgb_data + ((16 - h) * (guint)(76 * 4 * cfg.scale_factor)) + (guint)(x * cfg.scale_factor); switch (cfg.analyzer_mode) { case ANALYZER_NORMAL: - for (y = 0; y < h; y++, ptr += 304) { + for (y = 0; y < h; y++, ptr += (guint)(76 * 4 * cfg.scale_factor)) { *ptr = 18 - h + y; *(ptr + 1) = 18 - h + y; - *(ptr + 152) = 18 - h + y; - *(ptr + 153) = 18 - h + y; + *(ptr + (guint)(76 * cfg.scale_factor)) = 18 - h + y; + *(ptr + (guint)(76 * cfg.scale_factor)+1) = 18 - h + y; } break; case ANALYZER_FIRE: - for (y = 0; y < h; y++, ptr += 304) { + for (y = 0; y < h; y++, ptr += (guint)(76 * 4 * cfg.scale_factor)) { *ptr = y + 2; *(ptr + 1) = y + 2; - *(ptr + 152) = y + 2; - *(ptr + 153) = y + 2; + *(ptr + (guint)(76 * cfg.scale_factor)) = y + 2; + *(ptr + (guint)(76 * cfg.scale_factor)+1) = y + 2; } break; case ANALYZER_VLINES: - for (y = 0; y < h; y++, ptr += 304) { + for (y = 0; y < h; y++, ptr += (guint)(76 * 4 * cfg.scale_factor)) { *ptr = 18 - h; *(ptr + 1) = 18 - h; - *(ptr + 152) = 18 - h; - *(ptr + 153) = 18 - h; + *(ptr + (guint)(76 * cfg.scale_factor)) = 18 - h; + *(ptr + (guint)(76 * cfg.scale_factor)+1) = 18 - h; } break; @@ -372,15 +372,15 @@ h = vis->peak[x]; if (h && (cfg.analyzer_type == ANALYZER_LINES || (x % 4) != 3)){ - if (!vis->double_size) { + if (!vis->scaled) { rgb_data[(16 - h) * 76 + x] = 23; } else{ - ptr = rgb_data + (16 - h) * 304 + (x << 1); + ptr = rgb_data + (16 - h) * (guint)(76 * 4 * cfg.scale_factor) + (guint)(x * cfg.scale_factor); *ptr = 23; *(ptr + 1) = 23; - *(ptr + 152) = 23; - *(ptr + 153) = 23; + *(ptr + (guint)(76 * cfg.scale_factor)) = 23; + *(ptr + (guint)(76 * cfg.scale_factor)+1) = 23; } } } @@ -445,18 +445,18 @@ voice_c[1] = d < 128 ? d * 2 : 255; voice_c[2] = d < 64 ? d * 4 : 255; } - if(!vis->double_size){ + if(!vis->scaled){ for(n=0;n<3;n++) rgb_data[x * 3 + y * 76*3+n] = voice_c[n]; } else{ - ptr = rgb_data + x * 3 * 2 + y * 2 * 76 * 3 * 2; + ptr = rgb_data + (guint)(x * 3 * cfg.scale_factor) + (guint) (y * 76 * 3 * cfg.scale_factor); for(n=0;n<3;n++) { *(ptr + n) = voice_c[n]; *(ptr + n + 3) = voice_c[n]; - *(ptr + n + 76 * 2 * 3) = voice_c[n]; - *(ptr + n + 3 + 76 * 2 * 3) = voice_c[n]; + *(ptr + (guint)(n + 76 * cfg.scale_factor * 3)) = voice_c[n]; + *(ptr + (guint)(n + 3 + 76 * cfg.scale_factor * 3)) = voice_c[n]; } } } @@ -468,15 +468,15 @@ switch (cfg.scope_mode) { case SCOPE_DOT: h = vis->data[x]; - if (!vis->double_size) { + if (!vis->scaled) { ptr = rgb_data + ((14 - h) * 76) + x; *ptr = vis_scope_colors[h + 1]; }else{ - ptr = rgb_data + ((14 - h) * 304) + (x << 1); + ptr = rgb_data + ((14 - h) * (guint)(76 * 4 * cfg.scale_factor)) + (guint)(x * cfg.scale_factor); *ptr = vis_scope_colors[h + 1]; *(ptr + 1) = vis_scope_colors[h + 1]; - *(ptr + 152) = vis_scope_colors[h + 1]; - *(ptr + 153) = vis_scope_colors[h + 1]; + *(ptr + (guint)(76 * cfg.scale_factor)) = vis_scope_colors[h + 1]; + *(ptr + (guint)(76 * cfg.scale_factor)+1) = vis_scope_colors[h + 1]; } break; case SCOPE_LINE: @@ -488,32 +488,32 @@ h = h2; h2 = y; } - if (!vis->double_size) { + if (!vis->scaled) { ptr = rgb_data + (h * 76) + x; for (y = h; y <= h2; y++, ptr += 76) *ptr = vis_scope_colors[y - 2]; } else{ - ptr = rgb_data + (h * 304) + (x << 1); - for (y = h; y <= h2; y++, ptr += 304) { + ptr = rgb_data + (h * (guint)(76 * 4 * cfg.scale_factor)) + (guint)(x * cfg.scale_factor); + for (y = h; y <= h2; y++, ptr += (guint)(76 * 4 * cfg.scale_factor)) { *ptr = vis_scope_colors[y - 2]; *(ptr + 1) = vis_scope_colors[y - 2]; - *(ptr + 152) = vis_scope_colors[y - 2]; - *(ptr + 153) = vis_scope_colors[y - 2]; + *(ptr + (guint)(76 * cfg.scale_factor)) = vis_scope_colors[y - 2]; + *(ptr + (guint)(76 * cfg.scale_factor)+1) = vis_scope_colors[y - 2]; } } } else { h = 14 - vis->data[x]; - if (!vis->double_size) { + if (!vis->scaled) { ptr = rgb_data + (h * 76) + x; *ptr = vis_scope_colors[h + 1]; }else{ - ptr = rgb_data + (h * 304) + (x << 1); + ptr = rgb_data + (h * (guint)(76 * 4 * cfg.scale_factor)) + (guint)(x * cfg.scale_factor); *ptr = vis_scope_colors[h + 1]; *(ptr + 1) = vis_scope_colors[h + 1]; - *(ptr + 152) = vis_scope_colors[h + 1]; - *(ptr + 153) = vis_scope_colors[h + 1]; + *(ptr + (guint)(76 * cfg.scale_factor)) = vis_scope_colors[h + 1]; + *(ptr + (guint)(76 * cfg.scale_factor)+1) = vis_scope_colors[h + 1]; } } break; @@ -526,17 +526,17 @@ h = h2; h2 = y; } - if (!vis->double_size) { + if (!vis->scaled) { ptr = rgb_data + (h * 76) + x; for (y = h; y <= h2; y++, ptr += 76) *ptr = c; }else{ - ptr = rgb_data + (h * 304) + (x << 1); - for (y = h; y <= h2; y++, ptr += 304) { + ptr = rgb_data + (h * (guint)(76 * 4 * cfg.scale_factor)) + (guint)(x * cfg.scale_factor); + for (y = h; y <= h2; y++, ptr += (guint)(76 * 4 * cfg.scale_factor)) { *ptr = c; *(ptr + 1) = c; - *(ptr + 152) = c; - *(ptr + 153) = c; + *(ptr + (guint)(76 * cfg.scale_factor)) = c; + *(ptr + (guint)(76 * cfg.scale_factor)+1) = c; } } break; @@ -546,10 +546,10 @@ GdkPixmap *obj = NULL; GdkGC *gc; - obj = gdk_pixmap_new(NULL, vis->width*(1+vis->double_size), vis->height*(1+vis->double_size), gdk_rgb_get_visual()->depth); + obj = gdk_pixmap_new(NULL, vis->width*(vis->scaled ? cfg.scale_factor : 1), vis->height*(vis->scaled ? cfg.scale_factor : 1), gdk_rgb_get_visual()->depth); gc = gdk_gc_new(obj); - if (!vis->double_size) { + if (!vis->scaled) { if (cfg.vis_type == VIS_VOICEPRINT) { gdk_draw_rgb_image(obj, gc, 0, 0, vis->width, vis->height, GDK_RGB_DITHER_NORMAL, (guchar *) rgb_data, @@ -574,25 +574,25 @@ } gdk_draw_drawable (widget->window, gc, obj, 0, 0, 0, 0, - vis->width*(1+vis->double_size), vis->height*(1+vis->double_size)); + vis->width*(vis->scaled ? cfg.scale_factor : 1), vis->height*(vis->scaled ? cfg.scale_factor : 1)); g_object_unref(obj); g_object_unref(gc); gdk_rgb_cmap_free(cmap); return FALSE; } -static void ui_vis_toggle_doublesize(UiVis *vis) { +static void ui_vis_toggle_scaled(UiVis *vis) { GtkWidget *widget = GTK_WIDGET (vis); - vis->double_size = !vis->double_size; + vis->scaled = !vis->scaled; - gtk_widget_set_size_request(widget, vis->width*(1+vis->double_size), vis->height*(1+vis->double_size)); + gtk_widget_set_size_request(widget, vis->width*(vis->scaled ? cfg.scale_factor : 1), vis->height*(vis->scaled ? cfg.scale_factor : 1)); gtk_widget_queue_draw(GTK_WIDGET(vis)); } void ui_vis_draw_pixel(GtkWidget *widget, guchar* texture, gint x, gint y, guint8 colour) { UiVis *vis = UI_VIS (widget); - if (vis->double_size){ + if (vis->scaled){ texture[y * 76 + x] = colour; texture[y * 76 + x + 1] = colour; texture[y * 76 * 4 + x] = colour;
--- a/src/audacious/ui_vis.h Sun Jan 27 19:43:53 2008 +0200 +++ b/src/audacious/ui_vis.h Sun Jan 27 21:24:28 2008 +0200 @@ -73,7 +73,7 @@ gint x, y, width, height; gfloat data[75], peak[75], peak_speed[75]; gint refresh_delay; - gboolean double_size; + gboolean scaled; GtkWidget *fixed; gboolean visible_window; GdkWindow *event_window;