From c6de30bf7078b0549126ca5c5cca151466080b61 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sun, 17 Nov 2013 12:43:58 +0000 Subject: [PATCH] Removed GetId/GetId and changed span storage to be compatible with 3.0. Fixed border control style. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75223 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/richtext/richtextbuffer.h | 17 +------- interface/wx/richtext/richtextbuffer.h | 10 ----- src/richtext/richtextborderspage.cpp | 2 +- src/richtext/richtextbuffer.cpp | 60 ++++++++++++++++---------- src/richtext/richtextdialogs.pjd | 52 ++++++++++++++-------- src/richtext/richtextxml.cpp | 28 ------------ 6 files changed, 74 insertions(+), 95 deletions(-) diff --git a/include/wx/richtext/richtextbuffer.h b/include/wx/richtext/richtextbuffer.h index bc3b2b7a27..94e1240836 100644 --- a/include/wx/richtext/richtextbuffer.h +++ b/include/wx/richtext/richtextbuffer.h @@ -2746,16 +2746,6 @@ public: */ bool IsShown() const { return m_show; } - /** - Returns the object's unique identifier, if any. - */ - const wxString& GetId() const { return m_id; } - - /** - Sets the object's unique identifier. - */ - void SetId(const wxString& id) { m_id = id; } - // Operations /** @@ -2854,7 +2844,6 @@ protected: int m_descent; // Descent for this object (if any) int m_refCount; bool m_show; - wxString m_id; wxRichTextObject* m_parent; // The range of this object (start position to end position) @@ -5704,7 +5693,7 @@ public: /** Returns the column span. The default is 1. */ - int GetColSpan() const { return m_colSpan; } + int GetColSpan() const; /** Sets the column span. @@ -5714,7 +5703,7 @@ public: /** Returns the row span. The default is 1. */ - int GetRowSpan() const { return m_rowSpan; } + int GetRowSpan() const; /** Sets the row span. @@ -5728,8 +5717,6 @@ public: void Copy(const wxRichTextCell& obj); protected: - int m_colSpan; - int m_rowSpan; }; /** diff --git a/interface/wx/richtext/richtextbuffer.h b/interface/wx/richtext/richtextbuffer.h index ea5107e0ab..38834746fa 100644 --- a/interface/wx/richtext/richtextbuffer.h +++ b/interface/wx/richtext/richtextbuffer.h @@ -2588,16 +2588,6 @@ public: */ bool IsShown() const; - /** - Returns the object's unique identifier, if any. - */ - const wxString& GetId() const; - - /** - Sets the object's unique identifier. - */ - void SetId(const wxString& id); - // Operations /** diff --git a/src/richtext/richtextborderspage.cpp b/src/richtext/richtextborderspage.cpp index 95e6c66620..7acc92af0e 100644 --- a/src/richtext/richtextborderspage.cpp +++ b/src/richtext/richtextborderspage.cpp @@ -605,7 +605,7 @@ void wxRichTextBordersPage::CreateControls() itemBoxSizer3->Add(itemNotebook4, 0, wxGROW|wxALL, 5); - m_borderPreviewCtrl = new wxRichTextBorderPreviewCtrl( itemRichTextDialogPage1, ID_RICHTEXT_BORDER_PREVIEW, wxDefaultPosition, wxSize(60, 60), wxBORDER_THEME ); + m_borderPreviewCtrl = new wxRichTextBorderPreviewCtrl( itemRichTextDialogPage1, ID_RICHTEXT_BORDER_PREVIEW, wxDefaultPosition, wxSize(60, 60), wxBORDER_THEME|wxFULL_REPAINT_ON_RESIZE ); itemBoxSizer3->Add(m_borderPreviewCtrl, 1, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); ////@end wxRichTextBordersPage content construction diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 205fc539f1..1337ee5acc 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -531,7 +531,6 @@ void wxRichTextObject::Copy(const wxRichTextObject& obj) m_properties = obj.m_properties; m_descent = obj.m_descent; m_show = obj.m_show; - m_id = obj.m_id; } // Get/set the top-level container of this object. @@ -7184,9 +7183,6 @@ bool wxRichTextPlainText::CanMerge(wxRichTextObject* object, wxRichTextDrawingCo if (!wxTextAttrEq(GetAttributes(), object->GetAttributes()) || !(m_properties == object->GetProperties())) return false; - if (!otherObj->GetId().IsEmpty() && GetId() != otherObj->GetId()) - return false; - // Check if differing virtual attributes makes it impossible to merge // these strings. @@ -9393,8 +9389,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxRichTextCell, wxRichTextBox) wxRichTextCell::wxRichTextCell(wxRichTextObject* parent): wxRichTextBox(parent) { - m_colSpan = 1; - m_rowSpan = 1; } /// Draw the item @@ -9567,23 +9561,6 @@ bool wxRichTextCell::AdjustAttributes(wxRichTextAttr& attr, wxRichTextDrawingCon void wxRichTextCell::Copy(const wxRichTextCell& obj) { wxRichTextBox::Copy(obj); - - m_colSpan = obj.m_colSpan; - m_rowSpan = obj.m_rowSpan; -} - -void wxRichTextCell::SetColSpan(int span) -{ - wxASSERT(span >= 1); - if (span >= 1) - m_colSpan = span; -} - -void wxRichTextCell::SetRowSpan(int span) -{ - wxASSERT(span >= 1); - if (span >= 1) - m_rowSpan = span; } // Edit properties via a GUI @@ -9666,6 +9643,43 @@ bool wxRichTextCell::EditProperties(wxWindow* parent, wxRichTextBuffer* buffer) return false; } +void wxRichTextCell::SetColSpan(int span) +{ + wxASSERT(span >= 1); + if (span >= 1) + GetProperties().SetProperty(wxT("colspan"), (long) span); +} + +void wxRichTextCell::SetRowSpan(int span) +{ + wxASSERT(span >= 1); + if (span >= 1) + GetProperties().SetProperty(wxT("rowspan"), (long) span); +} + +// The next 2 methods return span values. Note that the default is 1, not 0 +int wxRichTextCell::GetColSpan() const +{ + int span = 1; + if (GetProperties().HasProperty(wxT("colspan"))) + { + span = GetProperties().GetPropertyLong(wxT("colspan")); + } + + return span; +} + +int wxRichTextCell::GetRowSpan() const +{ + int span = 1; + if (GetProperties().HasProperty(wxT("rowspan"))) + { + span = GetProperties().GetPropertyLong(wxT("rowspan")); + } + + return span; +} + WX_DEFINE_OBJARRAY(wxRichTextObjectPtrArrayArray) IMPLEMENT_DYNAMIC_CLASS(wxRichTextTable, wxRichTextBox) diff --git a/src/richtext/richtextdialogs.pjd b/src/richtext/richtextdialogs.pjd index 27a55a4a3c..6412b65f40 100644 --- a/src/richtext/richtextdialogs.pjd +++ b/src/richtext/richtextdialogs.pjd @@ -308,6 +308,14 @@ "wbBoxSizerProxy" "Vertical" "" + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 0 0 0 @@ -2648,6 +2656,14 @@ "wbBoxSizerProxy" "Vertical" "" + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 0 0 0 @@ -5109,6 +5125,14 @@ "wbBoxSizerProxy" "Vertical" "" + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 0 0 0 @@ -5856,6 +5880,14 @@ "wbBoxSizerProxy" "Vertical" "" + "Centre" + "Centre" + 0 + 5 + 1 + 1 + 1 + 1 0 0 0 @@ -15176,14 +15208,6 @@ "wbBoxSizerProxy" "Vertical" "" - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 0 0 0 @@ -22764,14 +22788,6 @@ "wbBoxSizerProxy" "Vertical" "" - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 0 0 0 @@ -27850,8 +27866,8 @@ 0 0 0 - 1 - 0 + 0 + 1 0 0 0 diff --git a/src/richtext/richtextxml.cpp b/src/richtext/richtextxml.cpp index d25601b861..2f8925fc57 100644 --- a/src/richtext/richtextxml.cpp +++ b/src/richtext/richtextxml.cpp @@ -352,7 +352,6 @@ bool wxRichTextObject::ImportFromXML(wxRichTextBuffer* WXUNUSED(buffer), wxXmlNo wxString value = node->GetAttribute(wxT("show"), wxEmptyString); if (!value.IsEmpty()) Show(value == wxT("1")); - SetId(node->GetAttribute(wxT("id"), wxEmptyString)); *recurse = true; @@ -837,15 +836,6 @@ bool wxRichTextParagraphLayoutBox::ImportFromXML(wxRichTextBuffer* buffer, wxXml if (partial == wxT("true")) SetPartialParagraph(true); - wxRichTextCell* cell = wxDynamicCast(this, wxRichTextCell); - if (cell) - { - if (node->HasAttribute(wxT("colspan"))) - cell->SetColSpan(wxAtoi(node->GetAttribute(wxT("colspan"), wxEmptyString))); - if (node->HasAttribute(wxT("rowspan"))) - cell->SetRowSpan(wxAtoi(node->GetAttribute(wxT("rowspan"), wxEmptyString))); - } - wxXmlNode* child = handler->GetHelper().FindNode(node, wxT("stylesheet")); if (child && (handler->GetFlags() & wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET)) { @@ -886,13 +876,6 @@ bool wxRichTextParagraphLayoutBox::ExportXML(wxOutputStream& stream, int indent, if (GetPartialParagraph()) style << wxT(" partialparagraph=\"true\""); - wxRichTextCell* cell = wxDynamicCast(this, wxRichTextCell); - if (cell) - { - style << wxT(" colspan=\"") << wxString::Format(wxT("%d"), cell->GetColSpan()) << wxT("\""); - style << wxT(" rowspan=\"") << wxString::Format(wxT("%d"), cell->GetRowSpan()) << wxT("\""); - } - handler->GetHelper().OutputString(stream, style + wxT(">")); if (GetProperties().GetCount() > 0) @@ -925,13 +908,6 @@ bool wxRichTextParagraphLayoutBox::ExportXML(wxXmlNode* parent, wxRichTextXMLHan if (GetPartialParagraph()) elementNode->AddAttribute(wxT("partialparagraph"), wxT("true")); - wxRichTextCell* cell = wxDynamicCast(this, wxRichTextCell); - if (cell) - { - elementNode->AddAttribute(wxT("colspan"), wxString::Format(wxT("%d"), cell->GetColSpan())); - elementNode->AddAttribute(wxT("rowspan"), wxString::Format(wxT("%d"), cell->GetRowSpan())); - } - size_t i; for (i = 0; i < GetChildCount(); i++) { @@ -2266,8 +2242,6 @@ wxString wxRichTextXMLHelper::AddAttributes(wxRichTextObject* obj, bool isPara) wxString style = AddAttributes(obj->GetAttributes(), isPara); if (!obj->IsShown()) style << wxT(" show=\"0\""); - if (!obj->GetId().IsEmpty()) - style << wxT(" id=\"") << AttributeToXML(obj->GetId()) << wxT("\""); return style; } @@ -2758,8 +2732,6 @@ bool wxRichTextXMLHelper::AddAttributes(wxXmlNode* node, wxRichTextObject* obj, { if (!obj->IsShown()) node->AddAttribute(wxT("show"), wxT("0")); - if (!obj->GetId().IsEmpty()) - node->AddAttribute(wxT("id"), obj->GetId()); } return AddAttributes(node, obj->GetAttributes(), isPara);