diff options
author | corvid <corvid@lavabit.com> | 2010-11-19 16:09:49 +0000 |
---|---|---|
committer | corvid <corvid@lavabit.com> | 2010-11-19 16:09:49 +0000 |
commit | c5387459af97e2ba5007f20ffcbec0876a69e63f (patch) | |
tree | b404d26b9d1efee5e83b6bf7c4c9226308b5925e | |
parent | e41e07e71b157c2c1ff2b54743a6ff0fcc5a7745 (diff) |
don't use text-indent when nesting blocks
-rw-r--r-- | dw/ruler.cc | 1 | ||||
-rw-r--r-- | dw/table.cc | 1 | ||||
-rw-r--r-- | dw/textblock.cc | 14 | ||||
-rw-r--r-- | dw/widget.hh | 6 |
4 files changed, 18 insertions, 4 deletions
diff --git a/dw/ruler.cc b/dw/ruler.cc index 6dce07d0..115dfaa5 100644 --- a/dw/ruler.cc +++ b/dw/ruler.cc @@ -28,6 +28,7 @@ namespace dw { Ruler::Ruler () { + setFlags (BLOCK_LEVEL); unsetFlags (HAS_CONTENTS); } diff --git a/dw/table.cc b/dw/table.cc index 51718587..6708b3f0 100644 --- a/dw/table.cc +++ b/dw/table.cc @@ -34,6 +34,7 @@ int Table::CLASS_ID = -1; Table::Table(bool limitTextWidth) { registerName ("dw::Table", &CLASS_ID); + setFlags (BLOCK_LEVEL); setFlags (USES_HINTS); setButtonSensitive(false); diff --git a/dw/textblock.cc b/dw/textblock.cc index af3d1cb0..326c9dbc 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -35,6 +35,7 @@ int Textblock::CLASS_ID = -1; Textblock::Textblock (bool limitTextWidth) { registerName ("dw::Textblock", &CLASS_ID); + setFlags (BLOCK_LEVEL); setFlags (USES_HINTS); setButtonSensitive(true); @@ -892,11 +893,16 @@ void Textblock::wordWrap(int wordIndex) } else { int indent = 0; - if (core::style::isPerLength(getStyle()->textIndent)) { - indent = misc::roundInt(this->availWidth * - core::style::perLengthVal (getStyle()->textIndent)); + if (word->content.type == core::Content::WIDGET && + word->content.widget->blockLevel() == true) { + /* don't use text-indent when nesting blocks */ } else { - indent = core::style::absLengthVal (getStyle()->textIndent); + if (core::style::isPerLength(getStyle()->textIndent)) { + indent = misc::roundInt(this->availWidth * + core::style::perLengthVal (getStyle()->textIndent)); + } else { + indent = core::style::absLengthVal (getStyle()->textIndent); + } } line1OffsetEff = line1Offset + indent; } diff --git a/dw/widget.hh b/dw/widget.hh index 79a34cd8..727aff05 100644 --- a/dw/widget.hh +++ b/dw/widget.hh @@ -67,6 +67,11 @@ protected: * The dw::Image widget uses this flag, see dw::Image::setBuffer. */ WAS_ALLOCATED = 1 << 5, + + /** + * \brief Set for block-level widgets (as opposed to inline widgets) + */ + BLOCK_LEVEL = 1 << 6, }; private: @@ -238,6 +243,7 @@ public: inline bool wasAllocated () { return flags & WAS_ALLOCATED; } inline bool usesHints () { return flags & USES_HINTS; } inline bool hasContents () { return flags & HAS_CONTENTS; } + inline bool blockLevel () { return flags & BLOCK_LEVEL; } void setParent (Widget *parent); |