Corrected a clearing bug
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42559 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1588,11 +1588,8 @@ public:
|
|||||||
/// Initialisation
|
/// Initialisation
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
/// Clears the buffer and resets the command processor
|
/// Clears the buffer, adds an empty paragraph, and clears the command processor.
|
||||||
virtual void Clear();
|
virtual void ResetAndClearCommands();
|
||||||
|
|
||||||
/// The same as Clear, and adds an empty paragraph.
|
|
||||||
virtual void Reset();
|
|
||||||
|
|
||||||
/// Load a file
|
/// Load a file
|
||||||
virtual bool LoadFile(const wxString& filename, int type = wxRICHTEXT_TYPE_ANY);
|
virtual bool LoadFile(const wxString& filename, int type = wxRICHTEXT_TYPE_ANY);
|
||||||
|
@@ -2420,6 +2420,8 @@ void wxRichTextParagraphLayoutBox::Reset()
|
|||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
AddParagraph(wxEmptyString);
|
AddParagraph(wxEmptyString);
|
||||||
|
|
||||||
|
Invalidate(wxRICHTEXT_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Invalidate the buffer. With no argument, invalidates whole buffer.
|
/// Invalidate the buffer. With no argument, invalidates whole buffer.
|
||||||
@@ -4545,19 +4547,12 @@ wxRichTextBuffer::~wxRichTextBuffer()
|
|||||||
ClearEventHandlers();
|
ClearEventHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRichTextBuffer::Clear()
|
void wxRichTextBuffer::ResetAndClearCommands()
|
||||||
{
|
{
|
||||||
DeleteChildren();
|
Reset();
|
||||||
|
|
||||||
GetCommandProcessor()->ClearCommands();
|
GetCommandProcessor()->ClearCommands();
|
||||||
Modify(false);
|
|
||||||
Invalidate(wxRICHTEXT_ALL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxRichTextBuffer::Reset()
|
|
||||||
{
|
|
||||||
DeleteChildren();
|
|
||||||
AddParagraph(wxEmptyString);
|
|
||||||
GetCommandProcessor()->ClearCommands();
|
|
||||||
Modify(false);
|
Modify(false);
|
||||||
Invalidate(wxRICHTEXT_ALL);
|
Invalidate(wxRICHTEXT_ALL);
|
||||||
}
|
}
|
||||||
|
@@ -128,6 +128,7 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va
|
|||||||
SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
|
SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GetBuffer().Reset();
|
||||||
GetBuffer().SetRichTextCtrl(this);
|
GetBuffer().SetRichTextCtrl(this);
|
||||||
|
|
||||||
if (style & wxTE_READONLY)
|
if (style & wxTE_READONLY)
|
||||||
@@ -220,7 +221,7 @@ void wxRichTextCtrl::Thaw()
|
|||||||
/// Clear all text
|
/// Clear all text
|
||||||
void wxRichTextCtrl::Clear()
|
void wxRichTextCtrl::Clear()
|
||||||
{
|
{
|
||||||
m_buffer.Reset();
|
m_buffer.ResetAndClearCommands();
|
||||||
m_buffer.SetDirty(true);
|
m_buffer.SetDirty(true);
|
||||||
m_caretPosition = -1;
|
m_caretPosition = -1;
|
||||||
m_caretPositionForDefaultStyle = -2;
|
m_caretPositionForDefaultStyle = -2;
|
||||||
@@ -572,7 +573,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
|
|
||||||
EndBatchUndo();
|
EndBatchUndo();
|
||||||
|
|
||||||
// Shouldn't this be in Do()?
|
|
||||||
if (GetLastPosition() == -1)
|
if (GetLastPosition() == -1)
|
||||||
{
|
{
|
||||||
GetBuffer().Reset();
|
GetBuffer().Reset();
|
||||||
@@ -601,7 +601,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
|
|
||||||
EndBatchUndo();
|
EndBatchUndo();
|
||||||
|
|
||||||
// Shouldn't this be in Do()?
|
|
||||||
if (GetLastPosition() == -1)
|
if (GetLastPosition() == -1)
|
||||||
{
|
{
|
||||||
GetBuffer().Reset();
|
GetBuffer().Reset();
|
||||||
|
@@ -41,7 +41,7 @@ bool wxRichTextXMLHandler::DoLoadFile(wxRichTextBuffer *buffer, wxInputStream& s
|
|||||||
if (!stream.IsOk())
|
if (!stream.IsOk())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
buffer->Clear();
|
buffer->ResetAndClearCommands();
|
||||||
|
|
||||||
wxXmlDocument* xmlDoc = new wxXmlDocument;
|
wxXmlDocument* xmlDoc = new wxXmlDocument;
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
Reference in New Issue
Block a user