+ int sel = m_stylesListBox->GetStyleListBox()->GetSelection();
+ if (sel == -1)
+ return;
+ wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
+ if (!def)
+ return;
+
+ wxString styleName = wxGetTextFromUser(_("Enter a new style name"), _("New Style"), def->GetName());
+ if (!styleName.IsEmpty())
+ {
+ if (styleName == def->GetName())
+ return;
+
+ if (GetStyleSheet()->FindParagraphStyle(styleName) || GetStyleSheet()->FindCharacterStyle(styleName) || GetStyleSheet()->FindListStyle(styleName))
+ {
+ wxMessageBox(_("Sorry, that name is taken. Please choose another."), _("New Style"), wxICON_EXCLAMATION|wxOK, this);
+ return;
+ }
+
+ def->SetName(styleName);
+ m_stylesListBox->UpdateStyles();
+ }