X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ee5c8f01f22c96f1bb84ec73fe02850adb79c784..8ca1a013e4e699724040ff1f514dab3b4a11d3c9:/src/richtext/richtextformatdlg.cpp diff --git a/src/richtext/richtextformatdlg.cpp b/src/richtext/richtextformatdlg.cpp index e262d0850a..e93767e702 100644 --- a/src/richtext/richtextformatdlg.cpp +++ b/src/richtext/richtextformatdlg.cpp @@ -38,7 +38,6 @@ #include "wx/bookctrl.h" #include "wx/colordlg.h" -#include "wx/fontenum.h" #include "wx/settings.h" #include "wx/module.h" #include "wx/imaglist.h" @@ -52,20 +51,27 @@ #include "../../src/richtext/richtexttabspage.cpp" #include "../../src/richtext/richtextbulletspage.cpp" #include "../../src/richtext/richtextstylepage.cpp" +#include "../../src/richtext/richtextliststylepage.cpp" #else #include "richtextfontpage.cpp" #include "richtextindentspage.cpp" #include "richtexttabspage.cpp" #include "richtextbulletspage.cpp" +// Digital Mars can't cope with this much code +#ifndef __DMC__ + #include "richtextliststylepage.cpp" +#endif #include "richtextstylepage.cpp" #endif #if 0 // def __WXMAC__ -#define wxRICHTEXT_USE_TOOLBOOK true +#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) @@ -245,7 +251,7 @@ bool wxRichTextFormattingDialogFactory::CreatePages(long pages, wxRichTextFormat int imageIndex = GetPageImage(pageId); dialog->GetBookCtrl()->AddPage(panel, title, !selected, imageIndex); selected = true; - + dialog->AddPageId(pageId); } } @@ -287,6 +293,14 @@ 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 return NULL; } @@ -299,9 +313,10 @@ int wxRichTextFormattingDialogFactory::GetPageId(int i) const wxRICHTEXT_FORMAT_FONT, wxRICHTEXT_FORMAT_INDENTS_SPACING, wxRICHTEXT_FORMAT_BULLETS, - wxRICHTEXT_FORMAT_TABS }; + wxRICHTEXT_FORMAT_TABS, + wxRICHTEXT_FORMAT_LIST_STYLE }; - if (i < 0 || i > 4) + if (i < 0 || i > 5) return -1; return pages[i]; @@ -310,26 +325,30 @@ int wxRichTextFormattingDialogFactory::GetPageId(int i) const /// Get the number of available page identifiers int wxRichTextFormattingDialogFactory::GetPageIdCount() const { +#ifdef __DMC__ return 5; +#else + return 6; +#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; } @@ -337,16 +356,16 @@ 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; } @@ -360,8 +379,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) @@ -385,9 +404,11 @@ void wxRichTextFontPreviewCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) { 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)); @@ -396,6 +417,13 @@ void wxRichTextFontPreviewCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) 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(); } } @@ -541,9 +569,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();