Fixed bugs in, and added operators and copy constructors to, style

sheet classes.
Now merges base, paragraph and content styles dynamically on
display or layout so that we can distinguish between them. This
means appling a paragraph style that has character formatting
doesn't wipe out the original content formatting. The old-style
static method can be enabled by setting wxRICHTEXT_USE_DYNAMIC_STYLES
to 0 in richtextbuffer.h.
The default style is initially empty, so that adding text
reflects the base and paragraph styles. Setting the default style
doesn't merge with the previous setting, but BeginStyle does.
Adding new paragraphs is now sensitive to the previous paragraph's
style and also whether its style has a next-paragraph style indication.
Added wxRichTextCtrl::ApplyStyleSheet which reapplies styles to
paragraphs with named styles.
Added style application command to sample to demonstrate how
styles can be changed and reapplied without affecting content
character formatting.
Fixed some range bugs in UI feedback and clipboard copying and pasting.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41501 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2006-09-29 08:53:23 +00:00
parent 81c330c6f0
commit fe5aa22c17
7 changed files with 765 additions and 129 deletions

View File

@@ -188,6 +188,12 @@ public:
virtual bool GetStyle(long position, wxTextAttr& style);
virtual bool GetStyle(long position, wxTextAttrEx& style);
virtual bool GetStyle(long position, wxRichTextAttr& style);
/// Get the content (uncombined) attributes for this position.
virtual bool GetUncombinedStyle(long position, wxTextAttr& style);
virtual bool GetUncombinedStyle(long position, wxTextAttrEx& style);
virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style);
virtual bool SetDefaultStyle(const wxTextAttrEx& style);
virtual bool SetDefaultStyle(const wxTextAttr& style);
@@ -530,6 +536,9 @@ public:
void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { GetBuffer().SetStyleSheet(styleSheet); }
wxRichTextStyleSheet* GetStyleSheet() const { return GetBuffer().GetStyleSheet(); }
/// Apply the style sheet to the buffer, for example if the styles have changed.
bool ApplyStyleSheet(wxRichTextStyleSheet* styleSheet = NULL);
// Command handlers
void Command(wxCommandEvent& event);
@@ -595,8 +604,6 @@ public:
/// Scrolling
void OnScroll(wxScrollWinEvent& event);
// Implementation
/// Set font, and also default attributes
virtual bool SetFont(const wxFont& font);
@@ -717,6 +724,8 @@ public:
SetCaretPositionForDefaultStyle(GetCaretPosition());
}
// Implementation
#if wxRICHTEXT_DERIVES_FROM_TEXTCTRLBASE
WX_FORWARD_TO_SCROLL_HELPER()
#endif
@@ -845,4 +854,3 @@ typedef void (wxEvtHandler::*wxRichTextEventFunction)(wxRichTextEvent&);
#endif
// _WX_RICHTEXTCTRL_H_