X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9a9b00b57f3334315aeb7c73f0798cdb0158a1fb..2028c33ab5a39a12bd410ac953731a56ad6377ba:/src/richtext/richtextsymboldlg.cpp?ds=sidebyside

diff --git a/src/richtext/richtextsymboldlg.cpp b/src/richtext/richtextsymboldlg.cpp
index 13d7834e59..c19891efcd 100644
--- a/src/richtext/richtextsymboldlg.cpp
+++ b/src/richtext/richtextsymboldlg.cpp
@@ -296,6 +296,7 @@ BEGIN_EVENT_TABLE( wxSymbolPickerDialog, wxDialog )
 
 #if defined(__UNICODE__)
     EVT_COMBOBOX( ID_SYMBOLPICKERDIALOG_SUBSET, wxSymbolPickerDialog::OnSubsetSelected )
+    EVT_UPDATE_UI( ID_SYMBOLPICKERDIALOG_SUBSET, wxSymbolPickerDialog::OnSymbolpickerdialogSubsetUpdate )
 #endif
 
 #if defined(__UNICODE__)
@@ -334,7 +335,7 @@ bool wxSymbolPickerDialog::Create( const wxString& symbol, const wxString& fontN
     m_symbol = symbol;
 
 ////@begin wxSymbolPickerDialog creation
-    SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS|wxDIALOG_EX_CONTEXTHELP);
+    SetExtraStyle(wxWS_EX_BLOCK_EVENTS|wxDIALOG_EX_CONTEXTHELP);
     wxDialog::Create( parent, id, caption, pos, size, style );
 
     CreateControls();
@@ -393,10 +394,10 @@ void wxSymbolPickerDialog::CreateControls()
     wxStaticText* itemStaticText6 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Font:"), wxDefaultPosition, wxDefaultSize, 0 );
     itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
 
-    wxString* m_fontCtrlStrings = NULL;
-    m_fontCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_FONT, wxEmptyString, wxDefaultPosition, wxSize(240, -1), 0, m_fontCtrlStrings, wxCB_READONLY );
+    wxArrayString m_fontCtrlStrings;
+    m_fontCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_FONT, wxEmptyString, wxDefaultPosition, wxSize(240, -1), m_fontCtrlStrings, wxCB_READONLY );
     m_fontCtrl->SetHelpText(_("The font from which to take the symbol."));
-    if (ShowToolTips())
+    if (wxSymbolPickerDialog::ShowToolTips())
         m_fontCtrl->SetToolTip(_("The font from which to take the symbol."));
     itemBoxSizer5->Add(m_fontCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
 
@@ -409,16 +410,16 @@ void wxSymbolPickerDialog::CreateControls()
 #endif
 
 #if defined(__UNICODE__)
-    wxString* m_subsetCtrlStrings = NULL;
-    m_subsetCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_SUBSET, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, m_subsetCtrlStrings, wxCB_READONLY );
+    wxArrayString m_subsetCtrlStrings;
+    m_subsetCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_SUBSET, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_subsetCtrlStrings, wxCB_READONLY );
     m_subsetCtrl->SetHelpText(_("Shows a Unicode subset."));
-    if (ShowToolTips())
+    if (wxSymbolPickerDialog::ShowToolTips())
         m_subsetCtrl->SetToolTip(_("Shows a Unicode subset."));
     itemBoxSizer5->Add(m_subsetCtrl, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
 
 #endif
 
-    m_symbolsCtrl = new wxSymbolListCtrl( itemDialog1, ID_SYMBOLPICKERDIALOG_LISTCTRL, wxDefaultPosition, wxSize(500, 240), wxSIMPLE_BORDER );
+    m_symbolsCtrl = new wxSymbolListCtrl( itemDialog1, ID_SYMBOLPICKERDIALOG_LISTCTRL, wxDefaultPosition, wxSize(500, 200), 0 );
     itemBoxSizer3->Add(m_symbolsCtrl, 1, wxGROW|wxALL, 5);
 
     wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL);
@@ -434,7 +435,7 @@ void wxSymbolPickerDialog::CreateControls()
 
     m_characterCodeCtrl = new wxTextCtrl( itemDialog1, ID_SYMBOLPICKERDIALOG_CHARACTERCODE, wxEmptyString, wxDefaultPosition, wxSize(140, -1), wxTE_READONLY|wxTE_CENTRE );
     m_characterCodeCtrl->SetHelpText(_("The character code."));
-    if (ShowToolTips())
+    if (wxSymbolPickerDialog::ShowToolTips())
         m_characterCodeCtrl->SetToolTip(_("The character code."));
     itemBoxSizer12->Add(m_characterCodeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
 
@@ -447,60 +448,34 @@ void wxSymbolPickerDialog::CreateControls()
 #endif
 
 #if defined(__UNICODE__)
-    wxString m_fromUnicodeCtrlStrings[] = {
-        _("ASCII"),
-        _("Unicode")
-    };
-    m_fromUnicodeCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_FROM, _("ASCII"), wxDefaultPosition, wxDefaultSize, 2, m_fromUnicodeCtrlStrings, wxCB_READONLY );
-    m_fromUnicodeCtrl->SetStringSelection(_("ASCII"));
+    wxArrayString m_fromUnicodeCtrlStrings;
+    m_fromUnicodeCtrlStrings.Add(_("ASCII"));
+    m_fromUnicodeCtrlStrings.Add(_("Unicode"));
+    m_fromUnicodeCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_FROM, _("Unicode"), wxDefaultPosition, wxDefaultSize, m_fromUnicodeCtrlStrings, wxCB_READONLY );
+    m_fromUnicodeCtrl->SetStringSelection(_("Unicode"));
     m_fromUnicodeCtrl->SetHelpText(_("The range to show."));
-    if (ShowToolTips())
+    if (wxSymbolPickerDialog::ShowToolTips())
         m_fromUnicodeCtrl->SetToolTip(_("The range to show."));
     itemBoxSizer12->Add(m_fromUnicodeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
 
 #endif
 
-#if defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMGL__) || defined(__WXMOTIF__) || defined(__WXCOCOA__) || defined(__WXX11__) || defined(__WXPALMOS__)
     wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL);
     itemBoxSizer3->Add(itemBoxSizer20, 0, wxGROW, 5);
 
     itemBoxSizer20->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
 
-    wxButton* itemButton22 = new wxButton( itemDialog1, wxID_OK, _("Insert"), wxDefaultPosition, wxDefaultSize, 0 );
-    itemButton22->SetDefault();
-    itemButton22->SetHelpText(_("Inserts the chosen symbol."));
-    if (ShowToolTips())
-        itemButton22->SetToolTip(_("Inserts the chosen symbol."));
-    itemBoxSizer20->Add(itemButton22, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+    wxStdDialogButtonSizer* itemStdDialogButtonSizer22 = new wxStdDialogButtonSizer;
 
-    wxButton* itemButton23 = new wxButton( itemDialog1, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
-    itemButton23->SetHelpText(_("Closes the dialog without inserting a symbol."));
-    if (ShowToolTips())
-        itemButton23->SetToolTip(_("Closes the dialog without inserting a symbol."));
-    itemBoxSizer20->Add(itemButton23, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+    itemBoxSizer20->Add(itemStdDialogButtonSizer22, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
+    wxButton* itemButton23 = new wxButton( itemDialog1, wxID_OK, _("Insert"), wxDefaultPosition, wxDefaultSize, 0 );
+    itemButton23->SetDefault();
+    itemStdDialogButtonSizer22->AddButton(itemButton23);
 
-#endif
-
-#if defined(__WXMAC__)
-    wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxHORIZONTAL);
-    itemBoxSizer3->Add(itemBoxSizer24, 0, wxGROW, 5);
-
-    itemBoxSizer24->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+    wxButton* itemButton24 = new wxButton( itemDialog1, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
+    itemStdDialogButtonSizer22->AddButton(itemButton24);
 
-    wxButton* itemButton26 = new wxButton( itemDialog1, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
-    itemButton26->SetHelpText(_("Closes the dialog without inserting a symbol."));
-    if (ShowToolTips())
-        itemButton26->SetToolTip(_("Closes the dialog without inserting a symbol."));
-    itemBoxSizer24->Add(itemButton26, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
-
-    wxButton* itemButton27 = new wxButton( itemDialog1, wxID_OK, _("Insert"), wxDefaultPosition, wxDefaultSize, 0 );
-    itemButton27->SetDefault();
-    itemButton27->SetHelpText(_("Inserts the chosen symbol."));
-    if (ShowToolTips())
-        itemButton27->SetToolTip(_("Inserts the chosen symbol."));
-    itemBoxSizer24->Add(itemButton27, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
-
-#endif
+    itemStdDialogButtonSizer22->Realize();
 
 ////@end wxSymbolPickerDialog content construction
 
@@ -530,18 +505,12 @@ bool wxSymbolPickerDialog::TransferDataToWindow()
             m_fontCtrl->SetSelection(0);
     }
 
-    if (!m_symbol.empty())
-    {
-        int sel = (int) m_symbol[0];
-        m_symbolsCtrl->SetSelection(sel);
-    }
-
 #if defined(__UNICODE__)
     if (m_subsetCtrl->GetCount() == 0)
     {
         // Insert items into subset combo
         int i;
-        for (i = 0; i < (int) (sizeof(g_UnicodeSubsetTable)/sizeof(g_UnicodeSubsetTable[0])); i++)
+        for (i = 0; i < (int) WXSIZEOF(g_UnicodeSubsetTable); i++)
         {
             m_subsetCtrl->Append(g_UnicodeSubsetTable[i].m_name);
         }
@@ -549,6 +518,16 @@ bool wxSymbolPickerDialog::TransferDataToWindow()
     }
 #endif
 
+#if defined(__UNICODE__)
+    m_symbolsCtrl->SetUnicodeMode(m_fromUnicode);
+#endif
+
+    if (!m_symbol.empty())
+    {
+        int sel = (int) m_symbol[0];
+        m_symbolsCtrl->SetSelection(sel);
+    }
+
     UpdateSymbolDisplay();
 
     m_dontUpdate = false;
@@ -643,7 +622,7 @@ void wxSymbolPickerDialog::OnSymbolSelected( wxCommandEvent& event )
     {
         // Need to make the subset selection reflect the current symbol
         int i;
-        for (i = 0; i < (int) (sizeof(g_UnicodeSubsetTable)/sizeof(g_UnicodeSubsetTable[0])); i++)
+        for (i = 0; i < (int) WXSIZEOF(g_UnicodeSubsetTable); i++)
         {
             if (sel >= g_UnicodeSubsetTable[i].m_low && sel <= g_UnicodeSubsetTable[i].m_high)
             {
@@ -681,6 +660,18 @@ void wxSymbolPickerDialog::OnSubsetSelected( wxCommandEvent& WXUNUSED(event) )
 }
 #endif
 
+#if defined(__UNICODE__)
+
+/*!
+ * wxEVT_UPDATE_UI event handler for ID_SYMBOLPICKERDIALOG_SUBSET
+ */
+
+void wxSymbolPickerDialog::OnSymbolpickerdialogSubsetUpdate( wxUpdateUIEvent& event )
+{
+    event.Enable(m_fromUnicode);
+}
+#endif
+
 /*!
  * wxEVT_UPDATE_UI event handler for wxID_OK
  */
@@ -787,6 +778,10 @@ bool wxSymbolListCtrl::Create(wxWindow *parent,
                         const wxString& name)
 {
     style |= wxWANTS_CHARS | wxFULL_REPAINT_ON_RESIZE;
+
+    if ((style & wxBORDER_MASK) == wxBORDER_DEFAULT)
+        style |= wxBORDER_THEME;
+
     if ( !wxVScrolledWindow::Create(parent, id, pos, size, style, name) )
         return false;
 
@@ -802,6 +797,8 @@ bool wxSymbolListCtrl::Create(wxWindow *parent,
 
     SetupCtrl();
 
+    SetInitialSize(size);
+
     return true;
 }
 
@@ -823,7 +820,7 @@ bool wxSymbolListCtrl::DoSetCurrent(int current)
 {
     wxASSERT_MSG( current == wxNOT_FOUND ||
                     (current >= m_minSymbolValue && current <= m_maxSymbolValue),
-                  _T("wxSymbolListCtrl::DoSetCurrent(): invalid symbol value") );
+                  wxT("wxSymbolListCtrl::DoSetCurrent(): invalid symbol value") );
 
     if ( current == m_current )
     {
@@ -876,7 +873,7 @@ void wxSymbolListCtrl::SetSelection(int selection)
 {
     wxCHECK_RET( selection == wxNOT_FOUND ||
                   (selection >= m_minSymbolValue && selection < m_maxSymbolValue),
-                  _T("wxSymbolListCtrl::SetSelection(): invalid symbol value") );
+                  wxT("wxSymbolListCtrl::SetSelection(): invalid symbol value") );
 
     DoSetCurrent(selection);
 }
@@ -990,7 +987,7 @@ void wxSymbolListCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
 
     dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)));
     dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
-    dc.SetBackgroundMode(wxTRANSPARENT);
+    dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
 
     // iterate over all visible lines
     const size_t lineMax = GetVisibleEnd();