aboutsummaryrefslogtreecommitdiff
path: root/dw
diff options
context:
space:
mode:
Diffstat (limited to 'dw')
-rw-r--r--dw/alignedtextblock.cc4
-rw-r--r--dw/alignedtextblock.hh2
-rw-r--r--dw/listitem.cc4
-rw-r--r--dw/listitem.hh2
-rw-r--r--dw/tablecell.cc4
-rw-r--r--dw/tablecell.hh2
-rw-r--r--dw/textblock.cc15
-rw-r--r--dw/textblock.hh6
8 files changed, 25 insertions, 14 deletions
diff --git a/dw/alignedtextblock.cc b/dw/alignedtextblock.cc
index 934c43ec..dde408b2 100644
--- a/dw/alignedtextblock.cc
+++ b/dw/alignedtextblock.cc
@@ -59,8 +59,8 @@ void AlignedTextblock::List::unref(int pos)
int AlignedTextblock::CLASS_ID = -1;
-AlignedTextblock::AlignedTextblock (bool limitTextWidth, int penaltyHyphen):
- Textblock (limitTextWidth, penaltyHyphen)
+AlignedTextblock::AlignedTextblock (bool limitTextWidth):
+ Textblock (limitTextWidth)
{
registerName ("dw::AlignedTextblock", &CLASS_ID);
}
diff --git a/dw/alignedtextblock.hh b/dw/alignedtextblock.hh
index 084bfcb3..7bac15bb 100644
--- a/dw/alignedtextblock.hh
+++ b/dw/alignedtextblock.hh
@@ -42,7 +42,7 @@ private:
int listPos;
protected:
- AlignedTextblock(bool limitTextWidth, int penaltyHyphen);
+ AlignedTextblock(bool limitTextWidth);
virtual int getValue () = 0;
virtual void setMaxValue (int maxValue, int value) = 0;
diff --git a/dw/listitem.cc b/dw/listitem.cc
index 54901e1a..ed7a2c75 100644
--- a/dw/listitem.cc
+++ b/dw/listitem.cc
@@ -26,8 +26,8 @@ namespace dw {
int ListItem::CLASS_ID = -1;
-ListItem::ListItem (ListItem *ref, bool limitTextWidth, int penaltyHyphen):
- AlignedTextblock (limitTextWidth, penaltyHyphen)
+ListItem::ListItem (ListItem *ref, bool limitTextWidth):
+ AlignedTextblock (limitTextWidth)
{
registerName ("dw::ListItem", &CLASS_ID);
setRefTextblock (ref);
diff --git a/dw/listitem.hh b/dw/listitem.hh
index 31b5cd27..2e303d5d 100644
--- a/dw/listitem.hh
+++ b/dw/listitem.hh
@@ -15,7 +15,7 @@ protected:
public:
static int CLASS_ID;
- ListItem(ListItem *ref, bool limitTextWidth, int penaltyHyphen);
+ ListItem(ListItem *ref, bool limitTextWidth);
~ListItem();
void initWithWidget (core::Widget *widget, core::style::Style *style);
diff --git a/dw/tablecell.cc b/dw/tablecell.cc
index 79bc77d2..90dc310d 100644
--- a/dw/tablecell.cc
+++ b/dw/tablecell.cc
@@ -26,8 +26,8 @@ namespace dw {
int TableCell::CLASS_ID = -1;
-TableCell::TableCell (TableCell *ref, bool limitTextWidth, int penaltyHyphen):
- AlignedTextblock (limitTextWidth, penaltyHyphen)
+TableCell::TableCell (TableCell *ref, bool limitTextWidth):
+ AlignedTextblock (limitTextWidth)
{
registerName ("dw::TableCell", &CLASS_ID);
diff --git a/dw/tablecell.hh b/dw/tablecell.hh
index 11003544..4bb8633c 100644
--- a/dw/tablecell.hh
+++ b/dw/tablecell.hh
@@ -20,7 +20,7 @@ protected:
public:
static int CLASS_ID;
- TableCell(TableCell *ref, bool limitTextWidth, int penaltyHyphen);
+ TableCell(TableCell *ref, bool limitTextWidth);
~TableCell();
};
diff --git a/dw/textblock.cc b/dw/textblock.cc
index 213594d3..f6e1ad9c 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -46,7 +46,18 @@ Textblock::DivChar Textblock::divChars[NUM_DIV_CHARS] = {
{ "\xe2\x80\x94", false, true, PENALTY_HYPHEN, PENALTY_HYPHEN }
};
-Textblock::Textblock (bool limitTextWidth, int penaltyHyphen)
+
+int Textblock::penalties[PENALTY_NUM][2] = {
+ { 100, 100 }
+};
+
+void Textblock::init (int penaltyHyphen, int penaltyHyphen2)
+{
+ penalties[PENALTY_HYPHEN][0] = penaltyHyphen;
+ penalties[PENALTY_HYPHEN][1] = penaltyHyphen2;
+}
+
+Textblock::Textblock (bool limitTextWidth)
{
registerName ("dw::Textblock", &CLASS_ID);
setFlags (BLOCK_LEVEL);
@@ -92,8 +103,6 @@ Textblock::Textblock (bool limitTextWidth, int penaltyHyphen)
availDescent = 0;
this->limitTextWidth = limitTextWidth;
- penalties[PENALTY_HYPHEN][0] = penaltyHyphen;
- penalties[PENALTY_HYPHEN][1] = INT_MAX; // TODO Configuration
for (int layer = 0; layer < core::HIGHLIGHT_NUM_LAYERS; layer++) {
/* hlStart[layer].index > hlEnd[layer].index means no highlighting */
diff --git a/dw/textblock.hh b/dw/textblock.hh
index 5f588a23..b3bb6e98 100644
--- a/dw/textblock.hh
+++ b/dw/textblock.hh
@@ -393,7 +393,7 @@ protected:
* dw::Textblock::BadnessAndPenalty::setPenalty for more
* details. Set from preferences.
*/
- int penalties[PENALTY_NUM][2];
+ static int penalties[PENALTY_NUM][2];
bool limitTextWidth; /* from preferences */
@@ -569,7 +569,9 @@ protected:
public:
static int CLASS_ID;
- Textblock(bool limitTextWidth, int penaltyHyphen);
+ static void init (int penaltyHyphen, int penaltyHyphen2);
+
+ Textblock(bool limitTextWidth);
~Textblock();
core::Iterator *iterator (core::Content::Type mask, bool atEnd);