diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2010-12-12 22:37:51 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2010-12-12 22:37:51 +0000 |
commit | 2e249ac9e6cb60a743e47bb4593504227c2035aa (patch) | |
tree | 0da30d4fc34c80d31be673050a80faa3a7babd39 /desktop | |
parent | f777a58ec5265b616a84264cb513b8bfb1802157 (diff) | |
download | netsurf-2e249ac9e6cb60a743e47bb4593504227c2035aa.tar.gz netsurf-2e249ac9e6cb60a743e47bb4593504227c2035aa.tar.bz2 |
Set text position with respect to TREE_LINE_HEIGHT.
svn path=/trunk/netsurf/; revision=11043
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/tree.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/desktop/tree.c b/desktop/tree.c index 5dfbe8eed..0f6986bd2 100644 --- a/desktop/tree.c +++ b/desktop/tree.c @@ -28,6 +28,7 @@ #include <string.h> #include "content/content.h" #include "content/hlcache.h" +#include "css/utils.h" #include "desktop/browser.h" #include "desktop/textarea.h" #include "desktop/textinput.h" @@ -42,13 +43,16 @@ #define MAXIMUM_URL_LENGTH 1024 +#define TREE_TEXT_SIZE_PT 11 #define TREE_ICON_SIZE 17 #define NODE_INSTEP 20 -#define TREE_LINE_HEIGHT 50 +#define TREE_LINE_HEIGHT 20 + +static int tree_text_size_px; static plot_font_style_t plot_fstyle = { .family = PLOT_FONT_FAMILY_SANS_SERIF, - .size = 10 * FONT_SIZE_SCALE, /* 10pt. */ + .size = TREE_TEXT_SIZE_PT * FONT_SIZE_SCALE, .weight = 400, .flags = FONTF_NONE, .background = 0xFFCCBB, /* light blue */ @@ -57,7 +61,7 @@ static plot_font_style_t plot_fstyle = { static plot_font_style_t plot_fstyle_selected = { .family = PLOT_FONT_FAMILY_SANS_SERIF, - .size = 10 * FONT_SIZE_SCALE, /* 10pt. */ + .size = TREE_TEXT_SIZE_PT * FONT_SIZE_SCALE, .weight = 400, .flags = FONTF_NONE, .background = 0x000000, /* black */ @@ -1566,9 +1570,11 @@ static void tree_draw_node_element(struct tree *tree, fstyle = &plot_fstyle; } - plot.text(x + 4, y + TREE_LINE_HEIGHT * 0.75, - element->text, strlen(element->text), - fstyle); + plot.text(x + 4, y + + ((TREE_LINE_HEIGHT * 2 + tree_text_size_px) + + 2) / 4, + element->text, strlen(element->text), + fstyle); break; case NODE_ELEMENT_BITMAP: bitmap = element->bitmap; @@ -1714,6 +1720,10 @@ void tree_draw(struct tree *tree, int x, int y, /* don't draw empty trees or trees with redraw flag set to false */ if (tree->root->child == NULL || !tree->redraw) return; + tree_text_size_px = + (TREE_TEXT_SIZE_PT * FIXTOINT(nscss_screen_dpi) + 36) / + 72; + absolute_x = x + clip_x; absolute_y = y + clip_y; plot.rectangle(absolute_x, absolute_y, |