Take basic style into account when showing style under cursor
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@51413 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -714,17 +714,14 @@ wxString wxRichTextStyleListBox::GetStyleToShowInIdleTime(wxRichTextCtrl* ctrl,
|
||||
{
|
||||
int adjustedCaretPos = ctrl->GetAdjustedCaretPosition(ctrl->GetCaretPosition());
|
||||
|
||||
wxRichTextParagraph* para = ctrl->GetBuffer().GetParagraphAtPosition(adjustedCaretPos);
|
||||
wxRichTextObject* obj = ctrl->GetBuffer().GetLeafObjectAtPosition(adjustedCaretPos);
|
||||
|
||||
wxString styleName;
|
||||
|
||||
wxTextAttrEx attr;
|
||||
ctrl->GetStyle(adjustedCaretPos, attr);
|
||||
|
||||
// Take into account current default style just chosen by user
|
||||
if (ctrl->IsDefaultStyleShowing())
|
||||
{
|
||||
wxTextAttrEx attr;
|
||||
|
||||
ctrl->GetStyle(adjustedCaretPos, attr);
|
||||
wxRichTextApplyStyle(attr, ctrl->GetDefaultStyleEx());
|
||||
|
||||
if ((styleType == wxRICHTEXT_STYLE_ALL || styleType == wxRICHTEXT_STYLE_CHARACTER) &&
|
||||
@@ -737,20 +734,20 @@ wxString wxRichTextStyleListBox::GetStyleToShowInIdleTime(wxRichTextCtrl* ctrl,
|
||||
!attr.GetListStyleName().IsEmpty())
|
||||
styleName = attr.GetListStyleName();
|
||||
}
|
||||
else if (obj && (styleType == wxRICHTEXT_STYLE_ALL || styleType == wxRICHTEXT_STYLE_CHARACTER) &&
|
||||
!obj->GetAttributes().GetCharacterStyleName().IsEmpty())
|
||||
else if ((styleType == wxRICHTEXT_STYLE_ALL || styleType == wxRICHTEXT_STYLE_CHARACTER) &&
|
||||
!attr.GetCharacterStyleName().IsEmpty())
|
||||
{
|
||||
styleName = obj->GetAttributes().GetCharacterStyleName();
|
||||
styleName = attr.GetCharacterStyleName();
|
||||
}
|
||||
else if (para && (styleType == wxRICHTEXT_STYLE_ALL || styleType == wxRICHTEXT_STYLE_PARAGRAPH) &&
|
||||
!para->GetAttributes().GetParagraphStyleName().IsEmpty())
|
||||
else if ((styleType == wxRICHTEXT_STYLE_ALL || styleType == wxRICHTEXT_STYLE_PARAGRAPH) &&
|
||||
!attr.GetParagraphStyleName().IsEmpty())
|
||||
{
|
||||
styleName = para->GetAttributes().GetParagraphStyleName();
|
||||
styleName = attr.GetParagraphStyleName();
|
||||
}
|
||||
else if (para && (styleType == wxRICHTEXT_STYLE_ALL || styleType == wxRICHTEXT_STYLE_LIST) &&
|
||||
!para->GetAttributes().GetListStyleName().IsEmpty())
|
||||
else if ((styleType == wxRICHTEXT_STYLE_ALL || styleType == wxRICHTEXT_STYLE_LIST) &&
|
||||
!attr.GetListStyleName().IsEmpty())
|
||||
{
|
||||
styleName = para->GetAttributes().GetListStyleName();
|
||||
styleName = attr.GetListStyleName();
|
||||
}
|
||||
|
||||
return styleName;
|
||||
|
Reference in New Issue
Block a user