Take basic style into account when showing style under cursor
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51412 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());
|
int adjustedCaretPos = ctrl->GetAdjustedCaretPosition(ctrl->GetCaretPosition());
|
||||||
|
|
||||||
wxRichTextParagraph* para = ctrl->GetBuffer().GetParagraphAtPosition(adjustedCaretPos);
|
|
||||||
wxRichTextObject* obj = ctrl->GetBuffer().GetLeafObjectAtPosition(adjustedCaretPos);
|
|
||||||
|
|
||||||
wxString styleName;
|
wxString styleName;
|
||||||
|
|
||||||
|
wxTextAttr attr;
|
||||||
|
ctrl->GetStyle(adjustedCaretPos, attr);
|
||||||
|
|
||||||
// Take into account current default style just chosen by user
|
// Take into account current default style just chosen by user
|
||||||
if (ctrl->IsDefaultStyleShowing())
|
if (ctrl->IsDefaultStyleShowing())
|
||||||
{
|
{
|
||||||
wxTextAttr attr;
|
|
||||||
|
|
||||||
ctrl->GetStyle(adjustedCaretPos, attr);
|
|
||||||
wxRichTextApplyStyle(attr, ctrl->GetDefaultStyleEx());
|
wxRichTextApplyStyle(attr, ctrl->GetDefaultStyleEx());
|
||||||
|
|
||||||
if ((styleType == wxRICHTEXT_STYLE_ALL || styleType == wxRICHTEXT_STYLE_CHARACTER) &&
|
if ((styleType == wxRICHTEXT_STYLE_ALL || styleType == wxRICHTEXT_STYLE_CHARACTER) &&
|
||||||
@@ -737,20 +734,20 @@ wxString wxRichTextStyleListBox::GetStyleToShowInIdleTime(wxRichTextCtrl* ctrl,
|
|||||||
!attr.GetListStyleName().IsEmpty())
|
!attr.GetListStyleName().IsEmpty())
|
||||||
styleName = attr.GetListStyleName();
|
styleName = attr.GetListStyleName();
|
||||||
}
|
}
|
||||||
else if (obj && (styleType == wxRICHTEXT_STYLE_ALL || styleType == wxRICHTEXT_STYLE_CHARACTER) &&
|
else if ((styleType == wxRICHTEXT_STYLE_ALL || styleType == wxRICHTEXT_STYLE_CHARACTER) &&
|
||||||
!obj->GetAttributes().GetCharacterStyleName().IsEmpty())
|
!attr.GetCharacterStyleName().IsEmpty())
|
||||||
{
|
{
|
||||||
styleName = obj->GetAttributes().GetCharacterStyleName();
|
styleName = attr.GetCharacterStyleName();
|
||||||
}
|
}
|
||||||
else if (para && (styleType == wxRICHTEXT_STYLE_ALL || styleType == wxRICHTEXT_STYLE_PARAGRAPH) &&
|
else if ((styleType == wxRICHTEXT_STYLE_ALL || styleType == wxRICHTEXT_STYLE_PARAGRAPH) &&
|
||||||
!para->GetAttributes().GetParagraphStyleName().IsEmpty())
|
!attr.GetParagraphStyleName().IsEmpty())
|
||||||
{
|
{
|
||||||
styleName = para->GetAttributes().GetParagraphStyleName();
|
styleName = attr.GetParagraphStyleName();
|
||||||
}
|
}
|
||||||
else if (para && (styleType == wxRICHTEXT_STYLE_ALL || styleType == wxRICHTEXT_STYLE_LIST) &&
|
else if ((styleType == wxRICHTEXT_STYLE_ALL || styleType == wxRICHTEXT_STYLE_LIST) &&
|
||||||
!para->GetAttributes().GetListStyleName().IsEmpty())
|
!attr.GetListStyleName().IsEmpty())
|
||||||
{
|
{
|
||||||
styleName = para->GetAttributes().GetListStyleName();
|
styleName = attr.GetListStyleName();
|
||||||
}
|
}
|
||||||
|
|
||||||
return styleName;
|
return styleName;
|
||||||
|
Reference in New Issue
Block a user