diff options
author | Sebastian Geerken <devnull@localhost> | 2012-11-18 14:14:52 +0100 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2012-11-18 14:14:52 +0100 |
commit | 0f9c4a50964f6321b6cc66d968e3ade5b22a1ae2 (patch) | |
tree | 567d759df4db0fa063738397f66797cef99bd1bf | |
parent | 38fb867037d86d741fd003adc5e3cbb4c4aeceb8 (diff) |
Cleaned up and completed configuration for penalties.
-rw-r--r-- | dw/textblock.cc | 28 | ||||
-rw-r--r-- | dw/textblock.hh | 6 | ||||
-rw-r--r-- | src/dillo.cc | 3 | ||||
-rw-r--r-- | src/prefs.c | 3 | ||||
-rw-r--r-- | src/prefs.h | 1 | ||||
-rw-r--r-- | src/prefsparser.cc | 8 |
6 files changed, 42 insertions, 7 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc index a9e94a58..ef8cd300 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -47,17 +47,37 @@ Textblock::DivChar Textblock::divChars[NUM_DIV_CHARS] = { }; int Textblock::penalties[PENALTY_NUM][2] = { - { 100, 1000 }, - { 1000, 1000 }, - { 100, 1000 } + { 100, 800 }, + { 800, 800 }, + { 100, 800 } }; -void Textblock::init (int penaltyHyphen, int penaltyHyphen2) +void Textblock::setPenaltyHyphen (int penaltyHyphen) { penalties[PENALTY_HYPHEN][0] = penaltyHyphen; +} + +void Textblock::setPenaltyHyphen2 (int penaltyHyphen2) +{ penalties[PENALTY_HYPHEN][1] = penaltyHyphen2; } +void Textblock::setPenaltyEmDashLeft (int penaltyLeftEmDash) +{ + penalties[PENALTY_EM_DASH_LEFT][0] = penaltyLeftEmDash; + penalties[PENALTY_EM_DASH_LEFT][1] = penaltyLeftEmDash; +} + +void Textblock::setPenaltyEmDashRight (int penaltyRightEmDash) +{ + penalties[PENALTY_EM_DASH_RIGHT][0] = penaltyRightEmDash; +} + +void Textblock::setPenaltyEmDashRight2 (int penaltyRightEmDash2) +{ + penalties[PENALTY_EM_DASH_RIGHT][1] = penaltyRightEmDash2; +} + Textblock::Textblock (bool limitTextWidth) { registerName ("dw::Textblock", &CLASS_ID); diff --git a/dw/textblock.hh b/dw/textblock.hh index dcf7b244..942236cc 100644 --- a/dw/textblock.hh +++ b/dw/textblock.hh @@ -568,7 +568,11 @@ protected: public: static int CLASS_ID; - static void init (int penaltyHyphen, int penaltyHyphen2); + static void setPenaltyHyphen (int penaltyHyphen); + static void setPenaltyHyphen2 (int penaltyHyphen2); + static void setPenaltyEmDashLeft (int penaltyLeftEmDash); + static void setPenaltyEmDashRight (int penaltyRightEmDash); + static void setPenaltyEmDashRight2 (int penaltyRightEmDash2); Textblock(bool limitTextWidth); ~Textblock(); diff --git a/src/dillo.cc b/src/dillo.cc index cb522b8a..9bab589c 100644 --- a/src/dillo.cc +++ b/src/dillo.cc @@ -360,7 +360,8 @@ int main(int argc, char **argv) a_Cookies_init(); a_Auth_init(); - dw::Textblock::init (prefs.penalty_hyphen, prefs.penalty_hyphen_2); + dw::Textblock::setPenaltyHyphen (prefs.penalty_hyphen); + dw::Textblock::setPenaltyHyphen2 (prefs.penalty_hyphen_2); /* command line options override preferences */ if (options_got & DILLO_CLI_FULLWINDOW) diff --git a/src/prefs.c b/src/prefs.c index da597607..88d10a8d 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -104,6 +104,9 @@ void a_Prefs_init(void) prefs.penalty_hyphen = 100; prefs.penalty_hyphen_2 = 100; + prefs.penalty_em_dash_left = 800; + prefs.penalty_em_dash_right = 100; + prefs.penalty_em_dash_right_2 = 800; } /* diff --git a/src/prefs.h b/src/prefs.h index 7cb4f113..0c392ae5 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -90,6 +90,7 @@ struct _DilloPrefs { bool_t show_extra_warnings; bool_t middle_click_drags_page; int penalty_hyphen, penalty_hyphen_2; + int penalty_em_dash_left, penalty_em_dash_right, penalty_em_dash_right_2; }; /* Global Data */ diff --git a/src/prefsparser.cc b/src/prefsparser.cc index ceba7dd7..6eb8c11d 100644 --- a/src/prefsparser.cc +++ b/src/prefsparser.cc @@ -112,7 +112,13 @@ int PrefsParser::parseOption(char *name, char *value) { "theme", &prefs.theme, PREFS_STRING }, { "w3c_plus_heuristics", &prefs.w3c_plus_heuristics, PREFS_BOOL }, { "penalty_hyphen", &prefs.penalty_hyphen, PREFS_FRACTION_100 }, - { "penalty_hyphen_2", &prefs.penalty_hyphen_2, PREFS_FRACTION_100 } + { "penalty_hyphen_2", &prefs.penalty_hyphen_2, PREFS_FRACTION_100 }, + { "penalty_em_dash_left", &prefs.penalty_em_dash_left, + PREFS_FRACTION_100 }, + { "penalty_em_dash_right", &prefs.penalty_em_dash_right, + PREFS_FRACTION_100 }, + { "penalty_em_dash_right_2", &prefs.penalty_em_dash_right_2, + PREFS_FRACTION_100 } }; node = NULL; |