git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42559
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
/// Initialisation
void Init();
/// Initialisation
void Init();
- /// Clears the buffer and resets the command processor
- virtual void Clear();
-
- /// The same as Clear, and adds an empty paragraph.
- virtual void Reset();
+ /// Clears the buffer, adds an empty paragraph, and clears the command processor.
+ virtual void ResetAndClearCommands();
/// Load a file
virtual bool LoadFile(const wxString& filename, int type = wxRICHTEXT_TYPE_ANY);
/// Load a file
virtual bool LoadFile(const wxString& filename, int type = wxRICHTEXT_TYPE_ANY);
Clear();
AddParagraph(wxEmptyString);
Clear();
AddParagraph(wxEmptyString);
+
+ Invalidate(wxRICHTEXT_ALL);
}
/// Invalidate the buffer. With no argument, invalidates whole buffer.
}
/// Invalidate the buffer. With no argument, invalidates whole buffer.
-void wxRichTextBuffer::Clear()
+void wxRichTextBuffer::ResetAndClearCommands()
GetCommandProcessor()->ClearCommands();
GetCommandProcessor()->ClearCommands();
- Modify(false);
- Invalidate(wxRICHTEXT_ALL);
-}
-void wxRichTextBuffer::Reset()
-{
- DeleteChildren();
- AddParagraph(wxEmptyString);
- GetCommandProcessor()->ClearCommands();
Modify(false);
Invalidate(wxRICHTEXT_ALL);
}
Modify(false);
Invalidate(wxRICHTEXT_ALL);
}
SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
}
SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
}
GetBuffer().SetRichTextCtrl(this);
if (style & wxTE_READONLY)
GetBuffer().SetRichTextCtrl(this);
if (style & wxTE_READONLY)
/// Clear all text
void wxRichTextCtrl::Clear()
{
/// Clear all text
void wxRichTextCtrl::Clear()
{
+ m_buffer.ResetAndClearCommands();
m_buffer.SetDirty(true);
m_caretPosition = -1;
m_caretPositionForDefaultStyle = -2;
m_buffer.SetDirty(true);
m_caretPosition = -1;
m_caretPositionForDefaultStyle = -2;
- // Shouldn't this be in Do()?
if (GetLastPosition() == -1)
{
GetBuffer().Reset();
if (GetLastPosition() == -1)
{
GetBuffer().Reset();
- // Shouldn't this be in Do()?
if (GetLastPosition() == -1)
{
GetBuffer().Reset();
if (GetLastPosition() == -1)
{
GetBuffer().Reset();
if (!stream.IsOk())
return false;
if (!stream.IsOk())
return false;
+ buffer->ResetAndClearCommands();
wxXmlDocument* xmlDoc = new wxXmlDocument;
bool success = true;
wxXmlDocument* xmlDoc = new wxXmlDocument;
bool success = true;