Treeview: Add `treeview_font_size` to options.

Default is 11pt, and RISC OS overrides to 12pt.
This commit is contained in:
Michael Drake 2016-08-11 08:13:51 +01:00
parent ebb2a33b0b
commit 1457a049bb
4 changed files with 19 additions and 6 deletions

View File

@ -59,7 +59,10 @@ NSOPTION_STRING(http_proxy_auth_pass, NULL)
/** Proxy omission list */
NSOPTION_STRING(http_proxy_noproxy, "localhost")
/** Default font size / 0.1pt. */
/** Default treeview font size (unit: 0.1pt) */
NSOPTION_INTEGER(treeview_font_size, 110)
/** Default font size (unit: 0.1pt) */
NSOPTION_INTEGER(font_size, 128)
/** Minimum font size. */

View File

@ -3962,11 +3962,7 @@ nserror treeview_init(void)
LOG("Initialising treeview module");
/* TODO: Should we add an extra `treeview_font_size` option for
* treeviews instead of reusing the html rendering default
* font size?
*/
font_pt_size = nsoption_int(font_size);
font_pt_size = nsoption_int(treeview_font_size);
if (font_pt_size <= 0) {
font_pt_size = 11 * 10;
}

View File

@ -314,6 +314,12 @@ static nserror set_defaults(struct nsoption_s *defaults)
*/
nsoption_set_uint(disc_cache_size, 0);
/* Override core default treeview font size with 12 pt.
* TODO: 12 is the normal desktop font size, but users might run
* with something different.
*/
nsoption_set_int(treeview_font_size, 12 * 10);
/* set default system colours for riscos ui */
set_colour_from_wimp(defaults, wimp_COLOUR_BLACK, NSOPTION_sys_colour_ActiveBorder, 0x00000000);
set_colour_from_wimp(defaults, wimp_COLOUR_CREAM, NSOPTION_sys_colour_ActiveCaption, 0x00dddddd);

View File

@ -144,6 +144,14 @@ static void nsoption_validate(struct nsoption_s *opts, struct nsoption_s *defs)
int cloop;
bool black = true;
if (opts[NSOPTION_treeview_font_size].value.i < 50) {
opts[NSOPTION_treeview_font_size].value.i = 50;
}
if (opts[NSOPTION_treeview_font_size].value.i > 1000) {
opts[NSOPTION_treeview_font_size].value.i = 1000;
}
if (opts[NSOPTION_font_size].value.i < 50) {
opts[NSOPTION_font_size].value.i = 50;
}