X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce04fea5942b08030a0e1734767112a638a09226..974c115dff4da4a370a3569a3576cacb00eef7bb:/src/richtext/richtextstyledlg.cpp diff --git a/src/richtext/richtextstyledlg.cpp b/src/richtext/richtextstyledlg.cpp index fac149e861..6979d66f9e 100644 --- a/src/richtext/richtextstyledlg.cpp +++ b/src/richtext/richtextstyledlg.cpp @@ -67,6 +67,8 @@ BEGIN_EVENT_TABLE( wxRichTextStyleOrganiserDialog, wxDialog ) END_EVENT_TABLE() +IMPLEMENT_HELP_PROVISION(wxRichTextStyleOrganiserDialog) + /*! * wxRichTextStyleOrganiserDialog constructors */ @@ -110,6 +112,7 @@ void wxRichTextStyleOrganiserDialog::Init() m_closeButton = NULL; m_bottomButtonSizer = NULL; m_restartNumberingCtrl = NULL; + m_stdButtonSizer = NULL; m_okButton = NULL; m_cancelButton = NULL; ////@end wxRichTextStyleOrganiserDialog member initialisation @@ -190,7 +193,7 @@ void wxRichTextStyleOrganiserDialog::CreateControls() wxStaticText* itemStaticText6 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Styles:"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5); - m_stylesListBox = new wxRichTextStyleListCtrl( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_STYLES, wxDefaultPosition, wxSize(280, 350), wxSIMPLE_BORDER|listCtrlStyle ); + m_stylesListBox = new wxRichTextStyleListCtrl( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_STYLES, wxDefaultPosition, wxSize(280, 260), listCtrlStyle ); m_stylesListBox->SetHelpText(_("The available styles.")); if (wxRichTextStyleOrganiserDialog::ShowToolTips()) m_stylesListBox->SetToolTip(_("The available styles.")); @@ -202,7 +205,7 @@ void wxRichTextStyleOrganiserDialog::CreateControls() wxStaticText* itemStaticText9 = new wxStaticText( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_CURRENT_STYLE, _(" "), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer8->Add(itemStaticText9, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5); - m_previewCtrl = new wxRichTextCtrl( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_PREVIEW, wxEmptyString, wxDefaultPosition, wxSize(310, 200), wxSIMPLE_BORDER|wxTE_READONLY ); + m_previewCtrl = new wxRichTextCtrl( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_PREVIEW, wxEmptyString, wxDefaultPosition, wxSize(250, 200), wxVSCROLL|wxTE_READONLY ); m_previewCtrl->SetHelpText(_("The style preview.")); if (wxRichTextStyleOrganiserDialog::ShowToolTips()) m_previewCtrl->SetToolTip(_("The style preview.")); @@ -277,23 +280,29 @@ void wxRichTextStyleOrganiserDialog::CreateControls() m_restartNumberingCtrl->SetToolTip(_("Check to restart numbering.")); m_bottomButtonSizer->Add(m_restartNumberingCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - m_bottomButtonSizer->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); + m_stdButtonSizer = new wxStdDialogButtonSizer; + m_bottomButtonSizer->Add(m_stdButtonSizer, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); m_okButton = new wxButton( itemDialog1, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); - m_okButton->SetDefault(); - m_okButton->SetHelpText(_("Click to confirm your selection.")); - if (wxRichTextStyleOrganiserDialog::ShowToolTips()) - m_okButton->SetToolTip(_("Click to confirm your selection.")); - m_bottomButtonSizer->Add(m_okButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + m_stdButtonSizer->AddButton(m_okButton); m_cancelButton = new wxButton( itemDialog1, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - m_cancelButton->SetHelpText(_("Click to cancel this window.")); - if (wxRichTextStyleOrganiserDialog::ShowToolTips()) - m_cancelButton->SetToolTip(_("Click to cancel this window.")); - m_bottomButtonSizer->Add(m_cancelButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + m_stdButtonSizer->AddButton(m_cancelButton); + + wxButton* itemButton28 = new wxButton( itemDialog1, wxID_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize, 0 ); + m_stdButtonSizer->AddButton(itemButton28); + + m_stdButtonSizer->Realize(); ////@end wxRichTextStyleOrganiserDialog content construction + if (GetHelpId() == -1) + { + wxWindow* button = FindWindowById(wxID_HELP); + if (button) + m_stdButtonSizer->Show(button, false); + } + if ((m_flags & wxRICHTEXT_ORGANISER_CREATE_STYLES) == 0) { m_buttonSizer->Show(m_newCharacter, false); @@ -323,8 +332,8 @@ void wxRichTextStyleOrganiserDialog::CreateControls() if ((m_flags & wxRICHTEXT_ORGANISER_OK_CANCEL) == 0) { - m_bottomButtonSizer->Show(m_okButton, false); - m_bottomButtonSizer->Show(m_cancelButton, false); + m_stdButtonSizer->Show(m_okButton, false); + m_stdButtonSizer->Show(m_cancelButton, false); } else { @@ -405,14 +414,14 @@ bool wxRichTextStyleOrganiserDialog::TransferDataToWindow() void wxRichTextStyleOrganiserDialog::ShowPreview(int sel) { static const wxChar* s_para1 = wxT("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \ -Nullam ante sapien, vestibulum nonummy, pulvinar sed, luctus ut, lacus."); +Nullam ante sapien, vestibulum nonummy, pulvinar sed, luctus ut, lacus.\n"); - static const wxChar* s_para2List = wxT("Duis pharetra consequat dui. Nullam vitae justo id mauris lobortis interdum."); + static const wxChar* s_para2List = wxT("Duis pharetra consequat dui. Nullam vitae justo id mauris lobortis interdum.\n"); static const wxChar* s_para2 = wxT("Duis pharetra consequat dui. Cum sociis natoque penatibus \ -et magnis dis parturient montes, nascetur ridiculus mus. Nullam vitae justo id mauris lobortis interdum."); +et magnis dis parturient montes, nascetur ridiculus mus. Nullam vitae justo id mauris lobortis interdum.\n"); - static const wxChar* s_para3 = wxT("\nInteger convallis dolor at augue \ + static const wxChar* s_para3 = wxT("Integer convallis dolor at augue \ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n"); if (sel == -1) @@ -430,13 +439,13 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n"); if (labelCtrl) labelCtrl->SetLabel(def->GetName() + wxT(":")); - wxTextAttr attr(def->GetStyleMergedWithBase(GetStyleSheet())); + wxRichTextAttr attr(def->GetStyleMergedWithBase(GetStyleSheet())); wxFont font(m_previewCtrl->GetFont()); font.SetPointSize(9); m_previewCtrl->SetFont(font); - wxTextAttr normalParaAttr; + wxRichTextAttr normalParaAttr; normalParaAttr.SetFont(font); normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY"))); @@ -455,10 +464,10 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n"); int i; for (i = 0; i < 10; i++) { - wxTextAttr levelAttr = * listDef->GetLevelAttributes(i); + wxRichTextAttr levelAttr = * listDef->GetLevelAttributes(i); levelAttr.SetBulletNumber(1); m_previewCtrl->BeginStyle(levelAttr); - m_previewCtrl->WriteText(wxString::Format(wxT("\nList level %d. "), i+1) + s_para2List); + m_previewCtrl->WriteText(wxString::Format(wxT("List level %d. "), i+1) + s_para2List); m_previewCtrl->EndStyle(); } long listEnd = m_previewCtrl->GetInsertionPoint(); @@ -466,7 +475,7 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n"); } else { - m_previewCtrl->WriteText(wxString(wxT("\n")) + s_para2); + m_previewCtrl->WriteText(s_para2); } m_previewCtrl->EndStyle(); @@ -705,6 +714,7 @@ void wxRichTextStyleOrganiserDialog::OnEditClick( wxCommandEvent& WXUNUSED(event } m_stylesListBox->UpdateStyles(); + m_stylesListBox->GetStyleListBox()->SetSelection(sel); ShowPreview(); } }