X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/09f141082101b8208db5cb94ef738cf8c4bcc151..51bc4da1e9e5aa6e8d861b81e862b026febf43d3:/src/richtext/richtextbuffer.cpp diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 82ae7f3c0d..dd30e8ce1a 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -16,14 +16,14 @@ #pragma hdrstop #endif +#if wxUSE_RICHTEXT + +#include "wx/richtext/richtextbuffer.h" + #ifndef WX_PRECOMP #include "wx/wx.h" #endif -#include "wx/image.h" - -#if wxUSE_RICHTEXT - #include "wx/filename.h" #include "wx/clipbrd.h" #include "wx/dataobj.h" @@ -32,14 +32,13 @@ #include "wx/mstream.h" #include "wx/sstream.h" -#include "wx/richtext/richtextbuffer.h" #include "wx/richtext/richtextctrl.h" #include "wx/richtext/richtextstyles.h" #include "wx/listimpl.cpp" -WX_DEFINE_LIST(wxRichTextObjectList); -WX_DEFINE_LIST(wxRichTextLineList); +WX_DEFINE_LIST(wxRichTextObjectList) +WX_DEFINE_LIST(wxRichTextLineList) /*! * wxRichTextObject @@ -1131,8 +1130,6 @@ bool wxRichTextParagraphLayoutBox::InsertFragment(long position, wxRichTextFragm return true; } - - return false; } /// Make a copy of the fragment corresponding to the given range, putting it in 'fragment'. @@ -1592,8 +1589,8 @@ bool wxRichTextParagraphLayoutBox::SetStyle(const wxRichTextRange& range, const wxRichTextObjectList::compatibility_iterator firstNode = newPara->GetChildren().Find(firstObject); wxRichTextObjectList::compatibility_iterator lastNode = newPara->GetChildren().Find(lastObject); - wxASSERT(firstNode != NULL); - wxASSERT(lastNode != NULL); + wxASSERT(firstNode); + wxASSERT(lastNode); wxRichTextObjectList::compatibility_iterator node2 = firstNode; @@ -3410,7 +3407,7 @@ bool wxRichTextBuffer::BeginStyle(const wxTextAttrEx& style) /// End the style bool wxRichTextBuffer::EndStyle() { - if (m_attributeStack.GetFirst() == NULL) + if (!m_attributeStack.GetFirst()) { wxLogDebug(_("Too many EndStyle calls!")); return false; @@ -4113,9 +4110,9 @@ void wxRichTextAction::UpdateAppearance(long caretPosition, bool sendUpdateEvent m_ctrl->SetCaretPosition(caretPosition); if (!m_ctrl->IsFrozen()) { - m_ctrl->Layout(); + m_ctrl->LayoutContent(); m_ctrl->PositionCaret(); - m_ctrl->Refresh(); + m_ctrl->Refresh(false); if (sendUpdateEvent) m_ctrl->SendUpdateEvent(); @@ -4871,8 +4868,8 @@ bool wxRichTextFileHandler::LoadFile(wxRichTextBuffer *buffer, const wxString& f wxFFileInputStream stream(filename); if (stream.Ok()) return LoadFile(buffer, stream); - else - return false; + + return false; } bool wxRichTextFileHandler::SaveFile(wxRichTextBuffer *buffer, const wxString& filename) @@ -4880,8 +4877,8 @@ bool wxRichTextFileHandler::SaveFile(wxRichTextBuffer *buffer, const wxString& f wxFFileOutputStream stream(filename); if (stream.Ok()) return SaveFile(buffer, stream); - else - return false; + + return false; } #endif // wxUSE_STREAMS @@ -4980,8 +4977,7 @@ void wxRichTextImageBlock::Init() void wxRichTextImageBlock::Clear() { - if (m_data) - delete m_data; + delete[] m_data; m_data = NULL; m_dataSize = 0; m_imageType = -1;