From 736a9ccdfa6db583a4e328cbbebcec98d74940c0 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 18 Oct 2013 19:27:06 +0000 Subject: [PATCH] Fixed some data transfer bugs git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75047 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/richtext/richtextborderspage.h | 4 ++-- src/richtext/richtextborderspage.cpp | 13 +++++-------- src/richtext/richtextbuffer.cpp | 17 ++++++++--------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/include/wx/richtext/richtextborderspage.h b/include/wx/richtext/richtextborderspage.h index 2bd0f3bedc..03810b69ae 100644 --- a/include/wx/richtext/richtextborderspage.h +++ b/include/wx/richtext/richtextborderspage.h @@ -85,11 +85,11 @@ public: virtual void FillStyleComboBox(wxComboBox* styleComboBox); /// Set the border controls - static void SetBorderValue(wxTextAttrBorder& border, /* wxTextAttrBorder& borderToReset, */ wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox, + static void SetBorderValue(wxTextAttrBorder& border, wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox, wxComboBox* styleCtrl, wxRichTextColourSwatchCtrl* colourCtrl, const wxArrayInt& borderStyles); /// Get data from the border controls - static void GetBorderValue(wxTextAttrBorder& border, /* wxTextAttrBorder& borderToReset, */ wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox, + static void GetBorderValue(wxTextAttrBorder& border, wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox, wxComboBox* styleCtrl, wxRichTextColourSwatchCtrl* colourCtrl, const wxArrayInt& borderStyles); ////@begin wxRichTextBordersPage event handler declarations diff --git a/src/richtext/richtextborderspage.cpp b/src/richtext/richtextborderspage.cpp index 7e9231f3ab..660effe34e 100644 --- a/src/richtext/richtextborderspage.cpp +++ b/src/richtext/richtextborderspage.cpp @@ -610,7 +610,7 @@ bool wxRichTextBordersPage::TransferDataFromWindow() } // Set the border controls -void wxRichTextBordersPage::SetBorderValue(wxTextAttrBorder& border, /* wxTextAttrBorder& borderToReset, */ wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox, +void wxRichTextBordersPage::SetBorderValue(wxTextAttrBorder& border, wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox, wxComboBox* styleCtrl, wxRichTextColourSwatchCtrl* colourCtrl, const wxArrayInt& borderStyles) { if (!border.IsValid()) @@ -628,7 +628,7 @@ void wxRichTextBordersPage::SetBorderValue(wxTextAttrBorder& border, /* wxTextAt units.Add(wxTEXT_ATTR_UNITS_TENTHS_MM); units.Add(wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT); - wxRichTextFormattingDialog::SetDimensionValue(border.GetWidth(), widthValueCtrl, widthUnitsCtrl, checkBox, + wxRichTextFormattingDialog::SetDimensionValue(border.GetWidth(), widthValueCtrl, widthUnitsCtrl, NULL, & units); int sel = borderStyles.Index(border.GetStyle()); @@ -645,7 +645,7 @@ void wxRichTextBordersPage::SetBorderValue(wxTextAttrBorder& border, /* wxTextAt } // Get data from the border controls -void wxRichTextBordersPage::GetBorderValue(wxTextAttrBorder& border, /* wxTextAttrBorder& borderToReset, */ wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox, +void wxRichTextBordersPage::GetBorderValue(wxTextAttrBorder& border, wxTextCtrl* widthValueCtrl, wxComboBox* widthUnitsCtrl, wxCheckBox* checkBox, wxComboBox* styleCtrl, wxRichTextColourSwatchCtrl* colourCtrl, const wxArrayInt& borderStyles) { wxArrayInt units; @@ -653,7 +653,7 @@ void wxRichTextBordersPage::GetBorderValue(wxTextAttrBorder& border, /* wxTextAt units.Add(wxTEXT_ATTR_UNITS_TENTHS_MM); units.Add(wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT); - wxRichTextFormattingDialog::GetDimensionValue(border.GetWidth(), widthValueCtrl, widthUnitsCtrl, checkBox, + wxRichTextFormattingDialog::GetDimensionValue(border.GetWidth(), widthValueCtrl, widthUnitsCtrl, NULL, & units); int sel = styleCtrl->GetSelection(); @@ -663,17 +663,14 @@ void wxRichTextBordersPage::GetBorderValue(wxTextAttrBorder& border, /* wxTextAt { // When we apply the attributes, we won't apply this one, to leave the original unchanged. border.Reset(); - // borderToReset.Reset(); } else if (checkBox->Get3StateValue() == wxCHK_UNCHECKED) { - // We make a note to reset this attribute. - // borderToReset.GetWidth().MakeValid(); border.SetStyle(wxTEXT_BOX_ATTR_BORDER_NONE); + border.GetWidth().SetValue(0); } else { - // borderToReset.Reset(); // Don't reset this, in case we were going to previously. if (sel != -1) border.SetStyle(borderStyles[sel]); } diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index bad11bf400..e4062bdb88 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -3143,7 +3143,6 @@ bool wxRichTextParagraphLayoutBox::PositionToXY(long pos, long* x, long* y) cons } /// Get the leaf object in a paragraph at this position. -/// Given a line number, get the corresponding wxRichTextLine object. wxRichTextObject* wxRichTextParagraphLayoutBox::GetLeafObjectAtPosition(long position) const { wxRichTextParagraph* para = GetParagraphAtPosition(position); @@ -12954,16 +12953,16 @@ bool wxTextBoxAttr::Apply(const wxTextBoxAttr& attr, const wxTextBoxAttr* compar SetBoxStyleName(attr.GetBoxStyleName()); } - m_margins.Apply(attr.m_margins, compareWith ? (& attr.m_margins) : (const wxTextAttrDimensions*) NULL); - m_padding.Apply(attr.m_padding, compareWith ? (& attr.m_padding) : (const wxTextAttrDimensions*) NULL); - m_position.Apply(attr.m_position, compareWith ? (& attr.m_position) : (const wxTextAttrDimensions*) NULL); + m_margins.Apply(attr.m_margins, compareWith ? (& compareWith->m_margins) : (const wxTextAttrDimensions*) NULL); + m_padding.Apply(attr.m_padding, compareWith ? (& compareWith->m_padding) : (const wxTextAttrDimensions*) NULL); + m_position.Apply(attr.m_position, compareWith ? (& compareWith->m_position) : (const wxTextAttrDimensions*) NULL); - m_size.Apply(attr.m_size, compareWith ? (& attr.m_size) : (const wxTextAttrSize*) NULL); - m_minSize.Apply(attr.m_minSize, compareWith ? (& attr.m_minSize) : (const wxTextAttrSize*) NULL); - m_maxSize.Apply(attr.m_maxSize, compareWith ? (& attr.m_maxSize) : (const wxTextAttrSize*) NULL); + m_size.Apply(attr.m_size, compareWith ? (& compareWith->m_size) : (const wxTextAttrSize*) NULL); + m_minSize.Apply(attr.m_minSize, compareWith ? (& compareWith->m_minSize) : (const wxTextAttrSize*) NULL); + m_maxSize.Apply(attr.m_maxSize, compareWith ? (& compareWith->m_maxSize) : (const wxTextAttrSize*) NULL); - m_border.Apply(attr.m_border, compareWith ? (& attr.m_border) : (const wxTextAttrBorders*) NULL); - m_outline.Apply(attr.m_outline, compareWith ? (& attr.m_outline) : (const wxTextAttrBorders*) NULL); + m_border.Apply(attr.m_border, compareWith ? (& compareWith->m_border) : (const wxTextAttrBorders*) NULL); + m_outline.Apply(attr.m_outline, compareWith ? (& compareWith->m_outline) : (const wxTextAttrBorders*) NULL); return true; }