X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/62b51bfb302dd4a677e2a81b9e1963ea1f9d78d4..4c6fdc3503a732af708610ad8fd5ba43122d4d5d:/src/richtext/richtextformatdlg.cpp diff --git a/src/richtext/richtextformatdlg.cpp b/src/richtext/richtextformatdlg.cpp index b21d5e7b09..2ec7304c44 100644 --- a/src/richtext/richtextformatdlg.cpp +++ b/src/richtext/richtextformatdlg.cpp @@ -18,6 +18,8 @@ #if wxUSE_RICHTEXT +#include "wx/richtext/richtextformatdlg.h" + #ifndef WX_PRECOMP #include "wx/listbox.h" #include "wx/combobox.h" @@ -36,45 +38,70 @@ #include "wx/bookctrl.h" #include "wx/colordlg.h" -#include "wx/fontenum.h" #include "wx/settings.h" #include "wx/module.h" #include "wx/imaglist.h" -#include "wx/richtext/richtextformatdlg.h" #include "wx/richtext/richtextctrl.h" #include "wx/richtext/richtextstyles.h" +#ifdef __WXMAC__ +#include "../../src/richtext/richtextfontpage.cpp" +#include "../../src/richtext/richtextindentspage.cpp" +#include "../../src/richtext/richtexttabspage.cpp" +#include "../../src/richtext/richtextbulletspage.cpp" +#include "../../src/richtext/richtextstylepage.cpp" +#include "../../src/richtext/richtextliststylepage.cpp" +#include "../../src/richtext/richtextsizepage.cpp" +#include "../../src/richtext/richtextmarginspage.cpp" +#include "../../src/richtext/richtextborderspage.cpp" +#include "../../src/richtext/richtextbackgroundpage.cpp" +#else #include "richtextfontpage.cpp" #include "richtextindentspage.cpp" #include "richtexttabspage.cpp" #include "richtextbulletspage.cpp" +#include "richtextmarginspage.cpp" +#include "richtextsizepage.cpp" +#include "richtextborderspage.cpp" +#include "richtextbackgroundpage.cpp" +// Digital Mars can't cope with this much code +#ifndef __DMC__ + #include "richtextliststylepage.cpp" +#endif #include "richtextstylepage.cpp" +#endif -#ifdef __WXMAC__ -#define wxRICHTEXT_USE_TOOLBOOK true +#if 0 // def __WXMAC__ +#define wxRICHTEXT_USE_TOOLBOOK 1 #else -#define wxRICHTEXT_USE_TOOLBOOK false +#define wxRICHTEXT_USE_TOOLBOOK 0 #endif +bool wxRichTextFormattingDialog::sm_showToolTips = false; + IMPLEMENT_CLASS(wxRichTextFormattingDialog, wxPropertySheetDialog) BEGIN_EVENT_TABLE(wxRichTextFormattingDialog, wxPropertySheetDialog) - EVT_NOTEBOOK_PAGE_CHANGED(-1, wxRichTextFormattingDialog::OnTabChanged) + EVT_BOOKCTRL_PAGE_CHANGED(wxID_ANY, wxRichTextFormattingDialog::OnTabChanged) + EVT_BUTTON(wxID_HELP, wxRichTextFormattingDialog::OnHelp) + EVT_UPDATE_UI(wxID_HELP, wxRichTextFormattingDialog::OnUpdateHelp) END_EVENT_TABLE() +IMPLEMENT_HELP_PROVISION(wxRichTextFormattingDialog) + wxRichTextFormattingDialogFactory* wxRichTextFormattingDialog::ms_FormattingDialogFactory = NULL; void wxRichTextFormattingDialog::Init() { - m_imageList = NULL; m_styleDefinition = NULL; m_styleSheet = NULL; + m_object = NULL; + m_options = 0; } wxRichTextFormattingDialog::~wxRichTextFormattingDialog() { - delete m_imageList; delete m_styleDefinition; } @@ -82,13 +109,16 @@ bool wxRichTextFormattingDialog::Create(long flags, wxWindow* parent, const wxSt const wxPoint& pos, const wxSize& sz, long style) { SetExtraStyle(wxDIALOG_EX_CONTEXTHELP|wxWS_EX_VALIDATE_RECURSIVELY); +#ifdef __WXMAC__ + SetWindowVariant(wxWINDOW_VARIANT_SMALL); +#endif int resizeBorder = wxRESIZE_BORDER; GetFormattingDialogFactory()->SetSheetStyle(this); wxPropertySheetDialog::Create(parent, id, title, pos, sz, - style | (int)wxPlatform::IfNot(wxWinCE, resizeBorder) + style | (int)wxPlatform::IfNot(wxOS_WINDOWS_CE, resizeBorder) ); GetFormattingDialogFactory()->CreateButtons(this); @@ -102,7 +132,7 @@ bool wxRichTextFormattingDialog::Create(long flags, wxWindow* parent, const wxSt /// Get attributes from the given range bool wxRichTextFormattingDialog::GetStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range) { - if (ctrl->GetBuffer().GetStyleForRange(range.ToInternal(), m_attributes)) + if (ctrl->GetFocusObject()->GetStyleForRange(range.ToInternal(), m_attributes)) return UpdateDisplay(); else return false; @@ -114,8 +144,20 @@ bool wxRichTextFormattingDialog::ApplyStyle(wxRichTextCtrl* ctrl, const wxRichTe return ctrl->SetStyleEx(range, m_attributes, flags); } +// Apply attributes to the object being edited, if any +bool wxRichTextFormattingDialog::ApplyStyle(wxRichTextCtrl* ctrl, int flags) +{ + if (GetObject()) + { + ctrl->SetStyle(GetObject(), m_attributes, flags); + return true; + } + else + return false; +} + /// Set the attributes and optionally update the display -bool wxRichTextFormattingDialog::SetStyle(const wxTextAttrEx& style, bool update) +bool wxRichTextFormattingDialog::SetStyle(const wxRichTextAttr& style, bool update) { m_attributes = style; if (update) @@ -166,7 +208,7 @@ bool wxRichTextFormattingDialog::UpdateDisplay() /// Apply the styles when a different tab is selected, so the previews are /// up to date -void wxRichTextFormattingDialog::OnTabChanged(wxNotebookEvent& event) +void wxRichTextFormattingDialog::OnTabChanged(wxBookCtrlEvent& event) { if (GetBookCtrl() != event.GetEventObject()) { @@ -191,6 +233,25 @@ void wxRichTextFormattingDialog::OnTabChanged(wxNotebookEvent& event) } } +/// Respond to help command +void wxRichTextFormattingDialog::OnHelp(wxCommandEvent& event) +{ + int selPage = GetBookCtrl()->GetSelection(); + if (selPage != wxNOT_FOUND) + { + int pageId = -1; + if (selPage < (int) m_pageIds.GetCount()) + pageId = m_pageIds[selPage]; + if (!GetFormattingDialogFactory()->ShowHelp(pageId, this)) + event.Skip(); + } +} + +void wxRichTextFormattingDialog::OnUpdateHelp(wxUpdateUIEvent& event) +{ + event.Enable(true); +} + void wxRichTextFormattingDialog::SetFormattingDialogFactory(wxRichTextFormattingDialogFactory* factory) { if (ms_FormattingDialogFactory) @@ -198,6 +259,20 @@ void wxRichTextFormattingDialog::SetFormattingDialogFactory(wxRichTextFormatting ms_FormattingDialogFactory = factory; } +// Find a page by class +wxWindow* wxRichTextFormattingDialog::FindPage(wxClassInfo* info) const +{ + size_t i; + for (i = 0; i < GetBookCtrl()->GetPageCount(); i++) + { + wxWindow* w = GetBookCtrl()->GetPage(i); + if (w && w->GetClassInfo() == info) + return w; + } + return NULL; +} + + /*! * Factory for formatting dialog */ @@ -210,6 +285,7 @@ bool wxRichTextFormattingDialogFactory::CreatePages(long pages, wxRichTextFormat int availablePageCount = GetPageIdCount(); int i; + bool selected = false; for (i = 0; i < availablePageCount; i ++) { int pageId = GetPageId(i); @@ -221,10 +297,14 @@ bool wxRichTextFormattingDialogFactory::CreatePages(long pages, wxRichTextFormat if (panel) { int imageIndex = GetPageImage(pageId); - dialog->GetBookCtrl()->AddPage(panel, title, false, imageIndex); + dialog->GetBookCtrl()->AddPage(panel, title, !selected, imageIndex); + selected = true; + + dialog->AddPageId(pageId); } } } + return true; } @@ -261,6 +341,38 @@ wxPanel* wxRichTextFormattingDialogFactory::CreatePage(int page, wxString& title title = _("Bullets"); return page; } +#ifndef __DMC__ + else if (page == wxRICHTEXT_FORMAT_LIST_STYLE) + { + wxRichTextListStylePage* page = new wxRichTextListStylePage(dialog->GetBookCtrl(), wxID_ANY); + title = _("List Style"); + return page; + } +#endif + else if (page == wxRICHTEXT_FORMAT_SIZE) + { + wxRichTextSizePage* page = new wxRichTextSizePage(dialog->GetBookCtrl(), wxID_ANY); + title = _("Size"); + return page; + } + else if (page == wxRICHTEXT_FORMAT_MARGINS) + { + wxRichTextMarginsPage* page = new wxRichTextMarginsPage(dialog->GetBookCtrl(), wxID_ANY); + title = _("Margins"); + return page; + } + else if (page == wxRICHTEXT_FORMAT_BORDERS) + { + wxRichTextBordersPage* page = new wxRichTextBordersPage(dialog->GetBookCtrl(), wxID_ANY); + title = _("Borders"); + return page; + } + else if (page == wxRICHTEXT_FORMAT_BACKGROUND) + { + wxRichTextBackgroundPage* page = new wxRichTextBackgroundPage(dialog->GetBookCtrl(), wxID_ANY); + title = _("Background"); + return page; + } else return NULL; } @@ -273,9 +385,15 @@ int wxRichTextFormattingDialogFactory::GetPageId(int i) const wxRICHTEXT_FORMAT_FONT, wxRICHTEXT_FORMAT_INDENTS_SPACING, wxRICHTEXT_FORMAT_BULLETS, - wxRICHTEXT_FORMAT_TABS }; - - if (i < 0 || i > 4) + wxRICHTEXT_FORMAT_TABS, + wxRICHTEXT_FORMAT_LIST_STYLE, + wxRICHTEXT_FORMAT_SIZE, + wxRICHTEXT_FORMAT_MARGINS, + wxRICHTEXT_FORMAT_BORDERS, + wxRICHTEXT_FORMAT_BACKGROUND + }; + + if (i < 0 || i >= GetPageIdCount()) return -1; return pages[i]; @@ -284,26 +402,30 @@ int wxRichTextFormattingDialogFactory::GetPageId(int i) const /// Get the number of available page identifiers int wxRichTextFormattingDialogFactory::GetPageIdCount() const { - return 5; +#ifdef __DMC__ + return 9; +#else + return 10; +#endif } /// Set the sheet style, called at the start of wxRichTextFormattingDialog::Create bool wxRichTextFormattingDialogFactory::SetSheetStyle(wxRichTextFormattingDialog* dialog) { - bool useToolBook = wxRICHTEXT_USE_TOOLBOOK; - if (useToolBook) - { - int sheetStyle = wxPROPSHEET_SHRINKTOFIT; +#if wxRICHTEXT_USE_TOOLBOOK + int sheetStyle = wxPROPSHEET_SHRINKTOFIT; #ifdef __WXMAC__ - sheetStyle |= wxPROPSHEET_BUTTONTOOLBOOK; + sheetStyle |= wxPROPSHEET_BUTTONTOOLBOOK; #else - sheetStyle |= wxPROPSHEET_TOOLBOOK; + sheetStyle |= wxPROPSHEET_TOOLBOOK; #endif - dialog->SetSheetStyle(sheetStyle); - dialog->SetSheetInnerBorder(0); - dialog->SetSheetOuterBorder(0); - } + dialog->SetSheetStyle(sheetStyle); + dialog->SetSheetInnerBorder(0); + dialog->SetSheetOuterBorder(0); +#else + wxUnusedVar(dialog); +#endif // wxRICHTEXT_USE_TOOLBOOK return true; } @@ -311,20 +433,42 @@ bool wxRichTextFormattingDialogFactory::SetSheetStyle(wxRichTextFormattingDialog /// Create the main dialog buttons bool wxRichTextFormattingDialogFactory::CreateButtons(wxRichTextFormattingDialog* dialog) { - bool useToolBook = wxRICHTEXT_USE_TOOLBOOK; - - // If using a toolbook, also follow Mac style and don't create buttons int flags = wxOK|wxCANCEL; #ifndef __WXWINCE__ - flags |= wxHELP; + if (dialog->GetWindowStyleFlag() & wxRICHTEXT_FORMAT_HELP_BUTTON) + flags |= wxHELP; #endif - if (!useToolBook) - dialog->CreateButtons(flags); + // If using a toolbook, also follow Mac style and don't create buttons +#if !wxRICHTEXT_USE_TOOLBOOK + dialog->CreateButtons(flags); +#endif return true; } +// Invoke help for the dialog +bool wxRichTextFormattingDialogFactory::ShowHelp(int WXUNUSED(page), wxRichTextFormattingDialog* dialog) +{ + wxRichTextDialogPage* window = NULL; + int sel = dialog->GetBookCtrl()->GetSelection(); + if (sel != -1) + window = wxDynamicCast(dialog->GetBookCtrl()->GetPage(sel), wxRichTextDialogPage); + if (window && window->GetHelpId() != -1) + { + if (window->GetUICustomization()) + return window->GetUICustomization()->ShowHelp(dialog, window->GetHelpId()); + else if (dialog->GetUICustomization()) + return dialog->GetUICustomization()->ShowHelp(dialog, window->GetHelpId()); + else + return false; + } + else if (dialog->GetHelpId() != -1 && dialog->GetUICustomization()) + return dialog->ShowHelp(dialog); + else + return false; +} + /* * Module to initialise and clean up handlers */ @@ -334,8 +478,8 @@ class wxRichTextFormattingDialogModule: public wxModule DECLARE_DYNAMIC_CLASS(wxRichTextFormattingDialogModule) public: wxRichTextFormattingDialogModule() {} - bool OnInit() { wxRichTextFormattingDialog::SetFormattingDialogFactory(new wxRichTextFormattingDialogFactory); return true; }; - void OnExit() { wxRichTextFormattingDialog::SetFormattingDialogFactory(NULL); }; + bool OnInit() { wxRichTextFormattingDialog::SetFormattingDialogFactory(new wxRichTextFormattingDialogFactory); return true; } + void OnExit() { wxRichTextFormattingDialog::SetFormattingDialogFactory(NULL); } }; IMPLEMENT_DYNAMIC_CLASS(wxRichTextFormattingDialogModule, wxModule) @@ -348,6 +492,17 @@ BEGIN_EVENT_TABLE(wxRichTextFontPreviewCtrl, wxWindow) EVT_PAINT(wxRichTextFontPreviewCtrl::OnPaint) END_EVENT_TABLE() +wxRichTextFontPreviewCtrl::wxRichTextFontPreviewCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& sz, long style) +{ + if ((style & wxBORDER_MASK) == wxBORDER_DEFAULT) + style |= wxBORDER_THEME; + + wxWindow::Create(parent, id, pos, sz, style); + + SetBackgroundColour(*wxWHITE); + m_textEffects = 0; +} + void wxRichTextFontPreviewCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); @@ -355,21 +510,41 @@ void wxRichTextFontPreviewCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) wxSize size = GetSize(); wxFont font = GetFont(); - if ( font.Ok() ) + if ((GetTextEffects() & wxTEXT_ATTR_EFFECT_SUPERSCRIPT) || (GetTextEffects() & wxTEXT_ATTR_EFFECT_SUBSCRIPT)) + { + double size = static_cast(font.GetPointSize()) / wxSCRIPT_MUL_FACTOR; + font.SetPointSize( static_cast(size) ); + } + + if ( font.IsOk() ) { dc.SetFont(font); // Calculate vertical and horizontal centre - long w = 0, h = 0; + wxCoord w = 0, h = 0; wxString text(_("ABCDEFGabcdefg12345")); + if (GetTextEffects() & wxTEXT_ATTR_EFFECT_CAPITALS) + text.MakeUpper(); dc.GetTextExtent( text, &w, &h); int cx = wxMax(2, (size.x/2) - (w/2)); int cy = wxMax(2, (size.y/2) - (h/2)); + if ( GetTextEffects() & wxTEXT_ATTR_EFFECT_SUPERSCRIPT ) + cy -= h/2; + if ( GetTextEffects() & wxTEXT_ATTR_EFFECT_SUBSCRIPT ) + cy += h/2; + dc.SetTextForeground(GetForegroundColour()); dc.SetClippingRegion(2, 2, size.x-4, size.y-4); dc.DrawText(text, cx, cy); + + if (GetTextEffects() & wxTEXT_ATTR_EFFECT_STRIKETHROUGH) + { + dc.SetPen(wxPen(GetForegroundColour(), 1)); + dc.DrawLine(cx, (int) (cy + h/2 + 0.5), cx + w, (int) (cy + h/2 + 0.5)); + } + dc.DestroyClippingRegion(); } } @@ -378,15 +553,14 @@ void wxRichTextFontPreviewCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) wxRichTextFormattingDialog* wxRichTextFormattingDialog::GetDialog(wxWindow* win) { wxWindow* p = win->GetParent(); - while (p && !p->IsKindOf(CLASSINFO(wxRichTextFormattingDialog))) + while (p && !wxDynamicCast(p, wxRichTextFormattingDialog)) p = p->GetParent(); wxRichTextFormattingDialog* dialog = wxDynamicCast(p, wxRichTextFormattingDialog); return dialog; } - // Helper for pages to get the attributes -wxTextAttrEx* wxRichTextFormattingDialog::GetDialogAttributes(wxWindow* win) +wxRichTextAttr* wxRichTextFormattingDialog::GetDialogAttributes(wxWindow* win) { wxRichTextFormattingDialog* dialog = GetDialog(win); if (dialog) @@ -395,6 +569,18 @@ wxTextAttrEx* wxRichTextFormattingDialog::GetDialogAttributes(wxWindow* win) return NULL; } +#if 0 +// Helper for pages to get the attributes to reset +wxRichTextAttr* wxRichTextFormattingDialog::GetDialogResetAttributes(wxWindow* win) +{ + wxRichTextFormattingDialog* dialog = GetDialog(win); + if (dialog) + return & dialog->GetResetAttributes(); + else + return NULL; +} +#endif + // Helper for pages to get the style wxRichTextStyleDefinition* wxRichTextFormattingDialog::GetDialogStyleDefinition(wxWindow* win) { @@ -405,6 +591,95 @@ wxRichTextStyleDefinition* wxRichTextFormattingDialog::GetDialogStyleDefinition( return NULL; } +void wxRichTextFormattingDialog::SetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox) +{ + int unitsIdx = 0; + + if (!dim.IsValid()) + { + checkBox->SetValue(false); + valueCtrl->SetValue(wxT("0")); + unitsCtrl->SetSelection(0); +#if 0 + dim.SetValue(0); + dim.SetUnits(wxTEXT_ATTR_UNITS_PIXELS); +#endif + } + else + { + checkBox->SetValue(true); + if (dim.GetUnits() == wxTEXT_ATTR_UNITS_TENTHS_MM) + { + unitsIdx = 1; + float value = float(dim.GetValue()) / 100.0; + valueCtrl->SetValue(wxString::Format(wxT("%.2f"), value)); + } + else if (dim.GetUnits() == wxTEXT_ATTR_UNITS_PERCENTAGE) + { + unitsIdx = 2; + valueCtrl->SetValue(wxString::Format(wxT("%d"), (int) dim.GetValue())); + } + else + { + unitsIdx = 0; + valueCtrl->SetValue(wxString::Format(wxT("%d"), (int) dim.GetValue())); + } + + unitsCtrl->SetSelection(unitsIdx); + } +} + +void wxRichTextFormattingDialog::GetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl, wxCheckBox* checkBox) +{ + if (!checkBox->GetValue()) + { + dim.Reset(); + } + else + { + if (unitsCtrl->GetSelection() == 1) + dim.SetUnits(wxTEXT_ATTR_UNITS_TENTHS_MM); + else if (unitsCtrl->GetSelection() == 2) + dim.SetUnits(wxTEXT_ATTR_UNITS_PERCENTAGE); + else + dim.SetUnits(wxTEXT_ATTR_UNITS_PIXELS); + + int value = 0; + if (ConvertFromString(valueCtrl->GetValue(), value, dim.GetUnits())) + dim.SetValue(value); + } +} + +bool wxRichTextFormattingDialog::ConvertFromString(const wxString& string, int& ret, int scale) +{ + const wxChar* chars = string.GetData(); + int remain = 2; + bool dot = false; + ret = 0; + + for (unsigned int i = 0; i < string.Len() && remain; i++) + { + if (!(chars[i] >= wxT('0') && chars[i] <= wxT('9')) && !(scale == wxTEXT_ATTR_UNITS_TENTHS_MM && chars[i] == wxT('.'))) + return false; + + if (chars[i] == wxT('.')) + { + dot = true; + continue; + } + + if (dot) + remain--; + + ret = ret * 10 + chars[i] - wxT('0'); + } + + while (remain-- > 0 && scale == wxTEXT_ATTR_UNITS_TENTHS_MM) + ret *= 10; + + return true; +} + /* * A control for displaying a small preview of a colour or bitmap */ @@ -415,11 +690,14 @@ END_EVENT_TABLE() IMPLEMENT_CLASS(wxRichTextColourSwatchCtrl, wxControl) -wxRichTextColourSwatchCtrl::wxRichTextColourSwatchCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style): - wxControl(parent, id, pos, size, style) +wxRichTextColourSwatchCtrl::wxRichTextColourSwatchCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) { + if ((style & wxBORDER_MASK) == wxBORDER_DEFAULT) + style |= wxBORDER_THEME; + + wxControl::Create(parent, id, pos, size, style); + SetColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); - SetBackgroundStyle(wxBG_STYLE_COLOUR); } wxRichTextColourSwatchCtrl::~wxRichTextColourSwatchCtrl() @@ -431,16 +709,17 @@ void wxRichTextColourSwatchCtrl::OnMouseEvent(wxMouseEvent& event) if (event.LeftDown()) { wxWindow* parent = GetParent(); - while (parent != NULL && !parent->IsKindOf(CLASSINFO(wxDialog)) && !parent->IsKindOf(CLASSINFO(wxFrame))) + while (parent != NULL && !wxDynamicCast(parent, wxDialog) && !wxDynamicCast(parent, wxFrame)) parent = parent->GetParent(); wxColourData data; data.SetChooseFull(true); data.SetColour(m_colour); +#if wxUSE_COLOURDLG wxColourDialog *dialog = new wxColourDialog(parent, &data); // Crashes on wxMac (no m_peer) #ifndef __WXMAC__ - dialog->SetTitle(_("Background colour")); + dialog->SetTitle(_("Colour")); #endif if (dialog->ShowModal() == wxID_OK) { @@ -449,6 +728,7 @@ void wxRichTextColourSwatchCtrl::OnMouseEvent(wxMouseEvent& event) SetBackgroundColour(m_colour); } dialog->Destroy(); +#endif // wxUSE_COLOURDLG Refresh(); wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, GetId()); @@ -478,6 +758,9 @@ wxRichTextFontListBox::wxRichTextFontListBox(wxWindow* parent, wxWindowID id, co bool wxRichTextFontListBox::Create(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) { + if ((style & wxBORDER_MASK) == wxBORDER_DEFAULT) + style |= wxBORDER_THEME; + return wxHtmlListBox::Create(parent, id, pos, size, style); } @@ -513,9 +796,7 @@ int wxRichTextFontListBox::SetFaceNameSelection(const wxString& name) /// Updates the font list void wxRichTextFontListBox::UpdateFonts() { - wxFontEnumerator enumerator; - enumerator.EnumerateFacenames(); - wxArrayString facenames = enumerator.GetFacenames(); + wxArrayString facenames = wxRichTextCtrl::GetAvailableFontNames(); m_faceNames = facenames; m_faceNames.Sort(); @@ -547,7 +828,7 @@ wxString wxRichTextFontListBox::CreateHTML(const wxString& facename) const if (!facename.IsEmpty() && facename != _("(none)")) str << wxT(" face=\"") << facename << wxT("\""); /* - if (def->GetStyle().GetTextColour().Ok()) + if (def->GetStyle().GetTextColour().IsOk()) str << wxT(" color=\"#") << ColourToHexString(def->GetStyle().GetTextColour()) << wxT("\""); */ @@ -574,4 +855,3 @@ wxString wxRichTextFontListBox::CreateHTML(const wxString& facename) const #endif // wxUSE_RICHTEXT -