diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/form.cc | 4 | ||||
-rw-r--r-- | src/html.cc | 9 | ||||
-rw-r--r-- | src/plain.cc | 2 | ||||
-rw-r--r-- | src/prefs.c | 2 | ||||
-rw-r--r-- | src/prefs.h | 1 | ||||
-rw-r--r-- | src/prefsparser.cc | 18 | ||||
-rw-r--r-- | src/table.cc | 4 |
7 files changed, 31 insertions, 9 deletions
diff --git a/src/form.cc b/src/form.cc index 11f27b47..90dc6d50 100644 --- a/src/form.cc +++ b/src/form.cc @@ -868,10 +868,10 @@ void Html_tag_open_button(DilloHtml *html, const char *tag, int tagsize) html->styleEngine->setNonCssHint (PROPERTY_X_TOOLTIP, CSS_TYPE_STRING, attrbuf); } - /* We used to have Textblock (prefs.limit_text_width) here, + /* We used to have Textblock (prefs.limit_text_width, ...) here, * but it caused 100% CPU usage. */ - page = new Textblock (false); + page = new Textblock (false, prefs.penalty_hyphen); page->setStyle (html->styleEngine->backgroundStyle ()); ResourceFactory *factory = HT2LT(html)->getResourceFactory(); diff --git a/src/html.cc b/src/html.cc index f2bf7e44..b1396fd5 100644 --- a/src/html.cc +++ b/src/html.cc @@ -352,7 +352,8 @@ bool a_Html_tag_set_valign_attr(DilloHtml *html, const char *tag, int tagsize) */ static void Html_add_textblock(DilloHtml *html, int space) { - Textblock *textblock = new Textblock (prefs.limit_text_width); + Textblock *textblock = + new Textblock (prefs.limit_text_width, prefs.penalty_hyphen); HT2TB(html)->addParbreak (space, html->styleEngine->wordStyle ()); HT2TB(html)->addWidget (textblock, html->styleEngine->style ()); @@ -458,7 +459,8 @@ void DilloHtml::initDw() dReturn_if_fail (dw == NULL); /* Create the main widget */ - dw = stack->getRef(0)->textblock = new Textblock (prefs.limit_text_width); + dw = stack->getRef(0)->textblock = + new Textblock (prefs.limit_text_width, prefs.penalty_hyphen); bw->num_page_bugs = 0; dStr_truncate(bw->page_bugs, 0); @@ -3519,7 +3521,8 @@ static void Html_display_listitem(DilloHtml *html) HT2TB(html)->addParbreak (0, wordStyle); - list_item = new ListItem ((ListItem*)*ref_list_item,prefs.limit_text_width); + list_item = new ListItem ((ListItem*)*ref_list_item,prefs.limit_text_width, + prefs.penalty_hyphen); HT2TB(html)->addWidget (list_item, style); HT2TB(html)->addParbreak (0, wordStyle); *ref_list_item = list_item; diff --git a/src/plain.cc b/src/plain.cc index 4da618e4..b29bf226 100644 --- a/src/plain.cc +++ b/src/plain.cc @@ -90,7 +90,7 @@ DilloPlain::DilloPlain(BrowserWindow *p_bw) /* Init internal variables */ bw = p_bw; - dw = new Textblock (prefs.limit_text_width); + dw = new Textblock (prefs.limit_text_width, prefs.penalty_hyphen); Start_Ofs = 0; state = ST_SeekingEol; diff --git a/src/prefs.c b/src/prefs.c index a7fa1bcf..09e48862 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -101,6 +101,8 @@ void a_Prefs_init(void) prefs.start_page = a_Url_new(PREFS_START_PAGE, NULL); prefs.theme = dStrdup(PREFS_THEME); prefs.w3c_plus_heuristics = TRUE; + + prefs.penalty_hyphen = 100; } /* diff --git a/src/prefs.h b/src/prefs.h index 7622aea3..7392d74e 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -89,6 +89,7 @@ struct _DilloPrefs { bool_t show_msg; bool_t show_extra_warnings; bool_t middle_click_drags_page; + int penalty_hyphen; }; /* Global Data */ diff --git a/src/prefsparser.cc b/src/prefsparser.cc index aa810b1e..d555a55f 100644 --- a/src/prefsparser.cc +++ b/src/prefsparser.cc @@ -12,6 +12,8 @@ #include <sys/types.h> #include <stdlib.h> #include <locale.h> /* for setlocale */ +#include <math.h> /* for isinf */ +#include <limits.h> #include "prefs.h" #include "misc.h" @@ -28,6 +30,7 @@ typedef enum { PREFS_URL, PREFS_INT32, PREFS_DOUBLE, + PREFS_FRACTION_100, PREFS_GEOMETRY, PREFS_PANEL_SIZE } PrefType_t; @@ -107,7 +110,8 @@ int PrefsParser::parseOption(char *name, char *value) { "small_icons", &prefs.small_icons, PREFS_BOOL }, { "start_page", &prefs.start_page, PREFS_URL }, { "theme", &prefs.theme, PREFS_STRING }, - { "w3c_plus_heuristics", &prefs.w3c_plus_heuristics, PREFS_BOOL } + { "w3c_plus_heuristics", &prefs.w3c_plus_heuristics, PREFS_BOOL }, + { "penalty_hyphen", &prefs.penalty_hyphen, PREFS_FRACTION_100 }, }; node = NULL; @@ -160,6 +164,18 @@ int PrefsParser::parseOption(char *name, char *value) case PREFS_DOUBLE: *(double *)node->pref = strtod(value, NULL); break; + case PREFS_FRACTION_100: + { + double d = strtod (value, NULL); + if (isinf(d)) { + if (d > 0) + *(int*)node->pref = INT_MAX; + else + *(int*)node->pref = INT_MIN; + } else + *(int*)node->pref = 100 * d; + } + break; case PREFS_GEOMETRY: a_Misc_parse_geometry(value, &prefs.xpos, &prefs.ypos, &prefs.width, &prefs.height); diff --git a/src/table.cc b/src/table.cc index 98157e76..3487bab3 100644 --- a/src/table.cc +++ b/src/table.cc @@ -421,9 +421,9 @@ static void Html_tag_content_table_cell(DilloHtml *html, == TEXT_ALIGN_STRING) col_tb = new dw::TableCell ( ((dw::Table*)S_TOP(html)->table)->getCellRef (), - prefs.limit_text_width); + prefs.limit_text_width, prefs.penalty_hyphen); else - col_tb = new Textblock (prefs.limit_text_width); + col_tb = new Textblock (prefs.limit_text_width, prefs.penalty_hyphen); if (html->styleEngine->style()->borderCollapse == BORDER_MODEL_COLLAPSE){ Html_set_collapsing_border_model(html, col_tb); |