]> git.saurik.com Git - wxWidgets.git/commitdiff
subdindented paragraphs support (patch 933436)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 15 May 2004 18:17:14 +0000 (18:17 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 15 May 2004 18:17:14 +0000 (18:17 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27300 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
docs/latex/wx/text.tex
include/wx/textctrl.h
src/common/textcmn.cpp
src/msw/textctrl.cpp

index d31760736935d95a1734d7296db28aa811ddbd56..ef6a97d7dcd8ca261e574504a9d97d03d7c6bbb6 100644 (file)
@@ -139,6 +139,7 @@ wxMSW:
 - wxFileName::GetModificationTime() works with opened files too now
 - wxDC::GetClippingBox() now works even for clipping regions created by Windows
 - fixed wxFileDataObject in Unicode build (Alex D)
+- subdindented paragraphs support (Tim Kosse)
 
 wxMotif:
 
index 3827c17b19b6d9f9d82dca3788a4c24440abb5cf..0bef1067e59b322a743feac2df84b9584bad723c 100644 (file)
@@ -132,6 +132,14 @@ Return the text font specified by this attribute.
 Returns the left indent in tenths of a millimetre.
 
 
+\membersection{wxTextAttr::GetLeftSubIndent}\label{wxtextattrgetleftsubindent}
+
+\constfunc{int}{GetLeftSubIndent}{\void}
+
+Returns the left sub indent for all lines but the first line in a paragraph in
+tenths of a millimetre.
+
+
 \membersection{wxTextAttr::GetRightIndent}\label{wxtextattrgetrightindent}
 
 \constfunc{int}{GetRightIndent}{\void}
@@ -219,9 +227,11 @@ Sets the text font.
 
 \membersection{wxTextAttr::SetLeftIndent}\label{wxtextattrsetleftindent}
 
-\func{void}{SetLeftIndent}{\param{int }{indent}}
+\func{void}{SetLeftIndent}{\param{int }{indent}, \param{int }{subIndent = 0}}
 
 Sets the left indent in tenths of a millimetre.
+subIndent sets the indent for all lines but the first line in a paragraph 
+relative to the first line.
 
 
 \membersection{wxTextAttr::SetRightIndent}\label{wxtextattrsetrightindent}
index 340e4bf278526951c69ab81709aced3e9960e76c..a0fc80eb0d9112048dc56fb1f3958f7ad2c5b463 100644 (file)
@@ -187,7 +187,7 @@ public:
     void SetFont(const wxFont& font, long flags = wxTEXT_ATTR_FONT) { m_font = font; m_flags |= flags; }
     void SetAlignment(wxTextAttrAlignment alignment) { m_textAlignment = alignment; m_flags |= wxTEXT_ATTR_ALIGNMENT; }
     void SetTabs(const wxArrayInt& tabs) { m_tabs = tabs; m_flags |= wxTEXT_ATTR_TABS; }
-    void SetLeftIndent(int indent) { m_leftIndent = indent; m_flags |= wxTEXT_ATTR_LEFT_INDENT; }
+    void SetLeftIndent(int indent, int subIndent = 0) { m_leftIndent = indent; m_leftSubIndent = subIndent; m_flags |= wxTEXT_ATTR_LEFT_INDENT; }
     void SetRightIndent(int indent) { m_rightIndent = indent; m_flags |= wxTEXT_ATTR_RIGHT_INDENT; }
     void SetFlags(long flags) { m_flags = flags; }
 
@@ -207,6 +207,7 @@ public:
     wxTextAttrAlignment GetAlignment() const { return m_textAlignment; }
     const wxArrayInt& GetTabs() const { return m_tabs; }
     long GetLeftIndent() const { return m_leftIndent; }
+    long GetLeftSubIndent() const { return m_leftSubIndent; }
     long GetRightIndent() const { return m_rightIndent; }
     long GetFlags() const { return m_flags; }
 
@@ -232,6 +233,9 @@ private:
     wxTextAttrAlignment m_textAlignment;
     wxArrayInt          m_tabs; // array of int: tab stops in 1/10 mm
     int                 m_leftIndent; // left indent in 1/10 mm
+    int                 m_leftSubIndent; // left indent for all but the first 
+                                         // line in a paragraph relative to the
+                                         // first line, in 1/10 mm
     int                 m_rightIndent; // right indent in 1/10 mm
 };
 
index 10e92ab2c1f77bac53b432d09ddadc549fb0c0da..d8f297818cb6cca90a7ee74af09be485a7ae900b 100644 (file)
@@ -77,6 +77,7 @@ wxTextAttr::wxTextAttr(const wxColour& colText,
 {
     m_flags = 0;
     m_leftIndent = 0;
+    m_leftSubIndent = 0;
     m_rightIndent = 0;
     if (m_colText.Ok()) m_flags |= wxTEXT_ATTR_TEXT_COLOUR;
     if (m_colBack.Ok()) m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR;
@@ -90,6 +91,7 @@ void wxTextAttr::Init()
     m_textAlignment = wxTEXT_ALIGNMENT_DEFAULT;
     m_flags = 0;
     m_leftIndent = 0;
+    m_leftSubIndent = 0;
     m_rightIndent = 0;
 }
 
@@ -138,9 +140,9 @@ wxTextAttr wxTextAttr::Combine(const wxTextAttr& attr,
         newAttr.SetTabs(attrDef.GetTabs());
     
     if (attr.HasLeftIndent())
-        newAttr.SetLeftIndent(attr.GetLeftIndent());
+        newAttr.SetLeftIndent(attr.GetLeftIndent(), attr.GetLeftSubIndent());
     else if (attrDef.HasLeftIndent())
-        newAttr.SetLeftIndent(attrDef.GetLeftIndent());
+        newAttr.SetLeftIndent(attrDef.GetLeftIndent(), attr.GetLeftSubIndent());
     
     if (attr.HasRightIndent())
         newAttr.SetRightIndent(attr.GetRightIndent());
@@ -157,6 +159,7 @@ void wxTextAttr::operator= (const wxTextAttr& attr)
     m_colBack = attr.m_colBack;
     m_textAlignment = attr.m_textAlignment;
     m_leftIndent = attr.m_leftIndent;
+    m_leftSubIndent = attr.m_leftSubIndent;
     m_rightIndent = attr.m_rightIndent;
     m_tabs = attr.m_tabs;
     m_flags = attr.m_flags;
index 2b9d0b32ed29d67037481fd59104c1a833f7d0b6..e285303d8dca2e57c0c6f5d7f55370662b4f399a 100644 (file)
@@ -2364,12 +2364,11 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
 
     if (style.HasLeftIndent())
     {
-        pf.dwMask |= PFM_STARTINDENT;
+        pf.dwMask |= PFM_STARTINDENT | PFM_OFFSET;
 
         // Convert from 1/10 mm to TWIPS
         pf.dxStartIndent = (int) (((double) style.GetLeftIndent()) * mm2twips / 10.0) ;
-
-        // TODO: do we need to specify dxOffset?
+        pf.dxOffset = (int) (((double) style.GetLeftSubIndent()) * mm2twips / 10.0) ;
     }
 
     if (style.HasRightIndent())
@@ -2531,7 +2530,7 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
     // do format the selection
     (void) ::SendMessage(GetHwnd(), EM_GETPARAFORMAT, 0, (LPARAM) &pf) ;
 
-    style.SetLeftIndent( (int) ((double) pf.dxStartIndent * twips2mm * 10.0) );
+    style.SetLeftIndent( (int) ((double) pf.dxStartIndent * twips2mm * 10.0), (int) ((double) pf.dxOffset * twips2mm * 10.0) );
     style.SetRightIndent( (int) ((double) pf.dxRightIndent * twips2mm * 10.0) );
 
     if (pf.wAlignment == PFA_CENTER)
@@ -2547,7 +2546,7 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
     size_t i;
     for (i = 0; i < (size_t) pf.cTabCount; i++)
     {
-        tabStops[i] = (int) ((double) (pf.rgxTabs[i] & 0xFFFF) * twips2mm * 10.0) ;
+        tabStops.Add( (int) ((double) (pf.rgxTabs[i] & 0xFFFF) * twips2mm * 10.0) );
     }
 
     if ( changeSel )