From d7c22f10d544bc6ba3a34eab160e934941041888 Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Mon, 10 Jan 2011 05:19:32 +0100
Subject: Fix drawing of symbol menus.
---
src/ld-window-main.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/ld-window-main.c b/src/ld-window-main.c
index 47e231d..08e18e8 100644
--- a/src/ld-window-main.c
+++ b/src/ld-window-main.c
@@ -48,6 +48,7 @@ struct _SymbolMenuItem
LdSymbol *symbol;
gint width;
+ gdouble dx;
gdouble scale;
};
@@ -693,10 +694,10 @@ on_category_toggle (GtkToggleButton *toggle_button, gpointer user_data)
* in the center of it's symbol menu item.
*/
item->scale = data->menu_height * 0.5
- / MAX (ABS (area.y), ABS (area.y + area.height)) / 2;
- /* FIXME: The width is probably wrong (related to the center). */
- item->width = item->scale * area.width
- + data->menu_height * 0.5;
+ / MAX (ABS (area.y), ABS (area.y + area.height)) * 0.5;
+ item->width = data->menu_height * 0.5 + item->scale * area.width;
+ item->dx = item->width * 0.5 + item->scale * (area.width * 0.5
+ - MAX (ABS (area.x), ABS (area.x + area.width)));
menu_width += item++->width;
}
@@ -743,8 +744,8 @@ on_canvas_exposed (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
cairo_paint (cr);
}
- cairo_translate (cr, x + (gdouble) item->width / 2,
- data->menu_y + (gdouble) data->menu_height / 2);
+ cairo_translate (cr, x + item->dx,
+ data->menu_y + data->menu_height * 0.5);
cairo_scale (cr, item->scale, item->scale);
cairo_set_source_rgb (cr, 0, 0, 0);
--
cgit v1.2.3-70-g09d2