subdindented paragraphs support (patch 933436)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27300 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-05-15 18:17:14 +00:00
parent 99940d1bab
commit 89b674772c
5 changed files with 26 additions and 9 deletions

View 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:

View 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}

View 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
};

View 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;

View 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 )