changeset 1765:947f7b8bdbea

don't use text-indent when nesting blocks
author corvid <corvid@lavabit.com>
date Fri, 19 Nov 2010 16:09:49 +0000
parents e43e68b39066
children 5b50b51efa06
files dw/ruler.cc dw/table.cc dw/textblock.cc dw/widget.hh
diffstat 4 files changed, 18 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/dw/ruler.cc	Tue Nov 16 02:16:11 2010 +0000
+++ b/dw/ruler.cc	Fri Nov 19 16:09:49 2010 +0000
@@ -28,6 +28,7 @@
 
 Ruler::Ruler ()
 {
+   setFlags (BLOCK_LEVEL);
    unsetFlags (HAS_CONTENTS);
 }
 
--- a/dw/table.cc	Tue Nov 16 02:16:11 2010 +0000
+++ b/dw/table.cc	Fri Nov 19 16:09:49 2010 +0000
@@ -34,6 +34,7 @@
 Table::Table(bool limitTextWidth)
 {
    registerName ("dw::Table", &CLASS_ID);
+   setFlags (BLOCK_LEVEL);
    setFlags (USES_HINTS);
    setButtonSensitive(false);
 
--- a/dw/textblock.cc	Tue Nov 16 02:16:11 2010 +0000
+++ b/dw/textblock.cc	Fri Nov 19 16:09:49 2010 +0000
@@ -35,6 +35,7 @@
 Textblock::Textblock (bool limitTextWidth)
 {
    registerName ("dw::Textblock", &CLASS_ID);
+   setFlags (BLOCK_LEVEL);
    setFlags (USES_HINTS);
    setButtonSensitive(true);
 
@@ -892,11 +893,16 @@
       } 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;
       }
--- a/dw/widget.hh	Tue Nov 16 02:16:11 2010 +0000
+++ b/dw/widget.hh	Fri Nov 19 16:09:49 2010 +0000
@@ -67,6 +67,11 @@
        * 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 @@
    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);