diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2010-12-17 13:32:43 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2010-12-17 13:32:43 +0000 |
commit | a01f9508b0ca7bd5235d98e26239ecc41e9d867c (patch) | |
tree | 5e7df8e49024814820392c0c8af30c472ffcc2c4 /desktop/tree.c | |
parent | 4f03905955692eb2c8e0a4262a0486e44b468377 (diff) | |
download | netsurf-a01f9508b0ca7bd5235d98e26239ecc41e9d867c.tar.gz netsurf-a01f9508b0ca7bd5235d98e26239ecc41e9d867c.tar.bz2 |
Base treeview line height on text height, unless that's too small for the icon to fit.
svn path=/trunk/netsurf/; revision=11087
Diffstat (limited to 'desktop/tree.c')
-rw-r--r-- | desktop/tree.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/desktop/tree.c b/desktop/tree.c index 1f7d8ffc3..dd34cb64a 100644 --- a/desktop/tree.c +++ b/desktop/tree.c @@ -46,9 +46,9 @@ #define TREE_TEXT_SIZE_PT 11 #define TREE_ICON_SIZE 17 #define NODE_INSTEP 20 -#define TREE_LINE_HEIGHT 20 static int tree_text_size_px; +static int TREE_LINE_HEIGHT; static plot_font_style_t plot_fstyle = { .family = PLOT_FONT_FAMILY_SANS_SERIF, @@ -206,6 +206,19 @@ struct tree *tree_create(unsigned int flags, tree->callbacks = callbacks; tree->client_data = client_data; + /* Set text height in pixels */ + tree_text_size_px = + (TREE_TEXT_SIZE_PT * FIXTOINT(nscss_screen_dpi) + 36) / + 72; + /* Set line height appropriate for this text height in pixels + * Using 4/3 text height */ + TREE_LINE_HEIGHT = (tree_text_size_px * 8 + 3) / 6; + + /* But if that's too small for the icons, base the line height on + * the icon height. */ + if (TREE_LINE_HEIGHT < TREE_ICON_SIZE + 2) + TREE_LINE_HEIGHT = TREE_ICON_SIZE + 2; + return tree; } @@ -1795,10 +1808,6 @@ void tree_draw(struct tree *tree, int x, int y, if (tree->root->child == NULL || !tree->redraw) return; - tree_text_size_px = - (TREE_TEXT_SIZE_PT * FIXTOINT(nscss_screen_dpi) + 36) / - 72; - /* Set up clip rectangle */ clip.x0 = x + clip_x; clip.y0 = y + clip_y; |