Made standard bullet names translatable
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61184 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -6489,10 +6489,10 @@ bool wxRichTextStdRenderer::DrawBitmapBullet(wxRichTextParagraph* WXUNUSED(parag
|
|||||||
/// Enumerate the standard bullet names currently supported
|
/// Enumerate the standard bullet names currently supported
|
||||||
bool wxRichTextStdRenderer::EnumerateStandardBulletNames(wxArrayString& bulletNames)
|
bool wxRichTextStdRenderer::EnumerateStandardBulletNames(wxArrayString& bulletNames)
|
||||||
{
|
{
|
||||||
bulletNames.Add(wxT("standard/circle"));
|
bulletNames.Add(wxTRANSLATE("standard/circle"));
|
||||||
bulletNames.Add(wxT("standard/square"));
|
bulletNames.Add(wxTRANSLATE("standard/square"));
|
||||||
bulletNames.Add(wxT("standard/diamond"));
|
bulletNames.Add(wxTRANSLATE("standard/diamond"));
|
||||||
bulletNames.Add(wxT("standard/triangle"));
|
bulletNames.Add(wxTRANSLATE("standard/triangle"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -301,7 +301,9 @@ void wxRichTextBulletsPage::CreateControls()
|
|||||||
if (wxRichTextBuffer::GetRenderer())
|
if (wxRichTextBuffer::GetRenderer())
|
||||||
wxRichTextBuffer::GetRenderer()->EnumerateStandardBulletNames(standardBulletNames);
|
wxRichTextBuffer::GetRenderer()->EnumerateStandardBulletNames(standardBulletNames);
|
||||||
|
|
||||||
m_bulletNameCtrl->Append(standardBulletNames);
|
size_t i;
|
||||||
|
for (i = 0; i < standardBulletNames.GetCount(); i++)
|
||||||
|
m_bulletNameCtrl->Append(wxGetTranslation(standardBulletNames[i]));
|
||||||
|
|
||||||
wxArrayString facenames = wxRichTextCtrl::GetAvailableFontNames();
|
wxArrayString facenames = wxRichTextCtrl::GetAvailableFontNames();
|
||||||
facenames.Sort();
|
facenames.Sort();
|
||||||
@@ -348,7 +350,22 @@ bool wxRichTextBulletsPage::TransferDataFromWindow()
|
|||||||
else if (index == wxRICHTEXT_BULLETINDEX_STANDARD)
|
else if (index == wxRICHTEXT_BULLETINDEX_STANDARD)
|
||||||
{
|
{
|
||||||
bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_STANDARD;
|
bulletStyle |= wxTEXT_ATTR_BULLET_STYLE_STANDARD;
|
||||||
attr->SetBulletName(m_bulletNameCtrl->GetValue());
|
wxArrayString standardBulletNames;
|
||||||
|
if (wxRichTextBuffer::GetRenderer() && m_bulletNameCtrl->GetSelection() != wxNOT_FOUND)
|
||||||
|
{
|
||||||
|
int sel = m_bulletNameCtrl->GetSelection();
|
||||||
|
wxString selName = m_bulletNameCtrl->GetString(sel);
|
||||||
|
|
||||||
|
// Try to get the untranslated name using the current selection index of the combobox.
|
||||||
|
// into account.
|
||||||
|
wxRichTextBuffer::GetRenderer()->EnumerateStandardBulletNames(standardBulletNames);
|
||||||
|
if (sel < (int) standardBulletNames.GetCount() && m_bulletNameCtrl->GetValue() == selName)
|
||||||
|
attr->SetBulletName(standardBulletNames[sel]);
|
||||||
|
else
|
||||||
|
attr->SetBulletName(m_bulletNameCtrl->GetValue());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
attr->SetBulletName(m_bulletNameCtrl->GetValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_parenthesesCtrl->GetValue())
|
if (m_parenthesesCtrl->GetValue())
|
||||||
@@ -466,7 +483,22 @@ bool wxRichTextBulletsPage::TransferDataToWindow()
|
|||||||
m_numberCtrl->SetValue(0);
|
m_numberCtrl->SetValue(0);
|
||||||
|
|
||||||
if (attr->HasBulletName())
|
if (attr->HasBulletName())
|
||||||
m_bulletNameCtrl->SetValue(attr->GetBulletName());
|
{
|
||||||
|
wxArrayString standardBulletNames;
|
||||||
|
if (wxRichTextBuffer::GetRenderer())
|
||||||
|
{
|
||||||
|
// Try to set the control by index in order to take translated combo control strings
|
||||||
|
// into account.
|
||||||
|
wxRichTextBuffer::GetRenderer()->EnumerateStandardBulletNames(standardBulletNames);
|
||||||
|
int idx = standardBulletNames.Index(attr->GetBulletName());
|
||||||
|
if (idx != -1 && idx < (int) m_bulletNameCtrl->GetCount())
|
||||||
|
m_bulletNameCtrl->SetSelection(idx);
|
||||||
|
else
|
||||||
|
m_bulletNameCtrl->SetValue(attr->GetBulletName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_bulletNameCtrl->SetValue(attr->GetBulletName());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
m_bulletNameCtrl->SetValue(wxEmptyString);
|
m_bulletNameCtrl->SetValue(wxEmptyString);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user