]> git.saurik.com Git - wxWidgets.git/commitdiff
Omission and bug fix
authorJulian Smart <julian@anthemion.co.uk>
Tue, 14 Nov 2006 14:03:53 +0000 (14:03 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 14 Nov 2006 14:03:53 +0000 (14:03 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43411 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/richtext/richtextstyledlg.cpp

index 79080f7959176dffa9271ee602d54bf778c3b4a6..9383e9f2f8bf9cc0f54af505e5eca54753778f17 100644 (file)
@@ -109,7 +109,6 @@ void wxRichTextStyleOrganiserDialog::Init()
     m_deleteStyle = NULL;
     m_closeButton = NULL;
     m_bottomButtonSizer = NULL;
-
     m_restartNumberingCtrl = NULL;
     m_okButton = NULL;
     m_cancelButton = NULL;
@@ -486,7 +485,7 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
 /// Clears the preview
 void wxRichTextStyleOrganiserDialog::ClearPreview()
 {
-    m_richTextCtrl->Clear();
+    m_previewCtrl->Clear();
 }
 
 bool wxRichTextStyleOrganiserDialog::ApplyStyle(wxRichTextCtrl* ctrl)
@@ -835,6 +834,28 @@ void wxRichTextStyleOrganiserDialog::OnNewListUpdate( wxUpdateUIEvent& event )
 
 void wxRichTextStyleOrganiserDialog::OnRenameClick( wxCommandEvent& WXUNUSED(event) )
 {
+    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();
+    }
 }
 
 /*!