+
+ m_currentPosition = -1;
+ }
+}
+
+void RichTextFrame::OnTabStops(wxCommandEvent& WXUNUSED(event))
+{
+ wxString tabsStr = wxGetTextFromUser
+ (
+ _("Please enter the tab stop positions in tenths of a millimetre, separated by spaces.\nLeave empty to reset tab stops."),
+ _("Tab Stops"),
+ wxEmptyString,
+ this
+ );
+
+ wxArrayInt tabs;
+
+ wxStringTokenizer tokens(tabsStr, _T(" "));
+ while (tokens.HasMoreTokens())
+ {
+ wxString token = tokens.GetNextToken();
+ tabs.Add(wxAtoi(token));
+ }
+
+ wxTextAttr attr;
+ attr.SetTabs(tabs);
+
+ long start, end;
+ m_textCtrl->GetSelection(& start, & end);
+ m_textCtrl->SetStyle(start, end, attr);
+
+ m_currentPosition = -1;
+}
+
+void RichTextFrame::OnIdle(wxIdleEvent& WXUNUSED(event))
+{
+ long insertionPoint = m_textCtrl->GetInsertionPoint();
+ if (insertionPoint != m_currentPosition)
+ {
+#if wxUSE_STATUSBAR
+ wxTextAttr attr;
+ if (m_textCtrl->GetStyle(insertionPoint, attr))
+ {
+ wxString msg;
+ wxString facename(wxT("unknown"));
+ if (attr.GetFont().Ok())
+ {
+ facename = attr.GetFont().GetFaceName();
+ }
+ wxString alignment(wxT("unknown alignment"));
+ if (attr.GetAlignment() == wxTEXT_ALIGNMENT_CENTRE)
+ alignment = wxT("centred");
+ else if (attr.GetAlignment() == wxTEXT_ALIGNMENT_RIGHT)
+ alignment = wxT("right-aligned");
+ else if (attr.GetAlignment() == wxTEXT_ALIGNMENT_LEFT)
+ alignment = wxT("left-aligned");
+ else if (attr.GetAlignment() == wxTEXT_ALIGNMENT_JUSTIFIED)
+ alignment = wxT("justified");
+ msg.Printf( "Facename: %s, wxColour(%d, %d, %d), %s", facename,
+ attr.GetTextColour().Red(), attr.GetTextColour().Green(), attr.GetTextColour().Blue(),
+ alignment );
+
+ if (attr.HasFont())
+ {
+ if (attr.GetFont().GetWeight() == wxBOLD)
+ msg += wxT(" BOLD");
+ else if (attr.GetFont().GetWeight() == wxNORMAL)
+ msg += wxT(" NORMAL");
+
+ if (attr.GetFont().GetStyle() == wxITALIC)
+ msg += wxT(" ITALIC");
+
+ if (attr.GetFont().GetUnderlined())
+ msg += wxT(" UNDERLINED");
+ }
+
+ SetStatusText(msg);
+ }
+#endif // wxUSE_STATUSBAR
+ m_currentPosition = insertionPoint;