X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5778b3c800f3efe773103430706b6a4e728da50a..062dfc9a96dc9e796c53544f41ff92dc47f26e82:/src/richtext/richtextindentspage.cpp diff --git a/src/richtext/richtextindentspage.cpp b/src/richtext/richtextindentspage.cpp index 6401bf4b14..f73bb16211 100644 --- a/src/richtext/richtextindentspage.cpp +++ b/src/richtext/richtextindentspage.cpp @@ -17,13 +17,13 @@ * wxRichTextIndentsSpacingPage type definition */ -IMPLEMENT_DYNAMIC_CLASS( wxRichTextIndentsSpacingPage, wxPanel ) +IMPLEMENT_DYNAMIC_CLASS( wxRichTextIndentsSpacingPage, wxRichTextDialogPage ) /*! * wxRichTextIndentsSpacingPage event table definition */ -BEGIN_EVENT_TABLE( wxRichTextIndentsSpacingPage, wxPanel ) +BEGIN_EVENT_TABLE( wxRichTextIndentsSpacingPage, wxRichTextDialogPage ) ////@begin wxRichTextIndentsSpacingPage event table entries EVT_RADIOBUTTON( ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_LEFT, wxRichTextIndentsSpacingPage::OnAlignmentLeftSelected ) @@ -42,6 +42,8 @@ BEGIN_EVENT_TABLE( wxRichTextIndentsSpacingPage, wxPanel ) EVT_TEXT( ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT, wxRichTextIndentsSpacingPage::OnIndentRightUpdated ) + EVT_COMBOBOX( ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL, wxRichTextIndentsSpacingPage::OnRichtextOutlinelevelSelected ) + EVT_TEXT( ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE, wxRichTextIndentsSpacingPage::OnSpacingBeforeUpdated ) EVT_TEXT( ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER, wxRichTextIndentsSpacingPage::OnSpacingAfterUpdated ) @@ -52,6 +54,8 @@ BEGIN_EVENT_TABLE( wxRichTextIndentsSpacingPage, wxPanel ) END_EVENT_TABLE() +IMPLEMENT_HELP_PROVISION(wxRichTextIndentsSpacingPage) + /*! * wxRichTextIndentsSpacingPage constructors */ @@ -84,6 +88,7 @@ void wxRichTextIndentsSpacingPage::Init() m_indentLeft = NULL; m_indentLeftFirst = NULL; m_indentRight = NULL; + m_outlineLevelCtrl = NULL; m_spacingBefore = NULL; m_spacingAfter = NULL; m_spacingLine = NULL; @@ -99,7 +104,7 @@ void wxRichTextIndentsSpacingPage::Init() bool wxRichTextIndentsSpacingPage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) { ////@begin wxRichTextIndentsSpacingPage creation - wxPanel::Create( parent, id, pos, size, style ); + wxRichTextDialogPage::Create( parent, id, pos, size, style ); CreateControls(); if (GetSizer()) @@ -118,10 +123,10 @@ bool wxRichTextIndentsSpacingPage::Create( wxWindow* parent, wxWindowID id, cons void wxRichTextIndentsSpacingPage::CreateControls() { ////@begin wxRichTextIndentsSpacingPage content construction - wxRichTextIndentsSpacingPage* itemPanel1 = this; + wxRichTextIndentsSpacingPage* itemRichTextDialogPage1 = this; wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); - itemPanel1->SetSizer(itemBoxSizer2); + itemRichTextDialogPage1->SetSizer(itemBoxSizer2); wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL); itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5); @@ -132,8 +137,8 @@ void wxRichTextIndentsSpacingPage::CreateControls() wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL); itemBoxSizer4->Add(itemBoxSizer5, 0, wxGROW, 5); - wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Alignment"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + wxStaticText* itemStaticText6 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Alignment"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5); wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer5->Add(itemBoxSizer7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); @@ -143,29 +148,44 @@ void wxRichTextIndentsSpacingPage::CreateControls() wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxVERTICAL); itemBoxSizer7->Add(itemBoxSizer9, 0, wxALIGN_CENTER_VERTICAL|wxTOP, 5); - m_alignmentLeft = new wxRadioButton( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_LEFT, _("&Left"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); + m_alignmentLeft = new wxRadioButton( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_LEFT, _("&Left"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); m_alignmentLeft->SetValue(false); + m_alignmentLeft->SetHelpText(_("Left-align text.")); + if (wxRichTextIndentsSpacingPage::ShowToolTips()) + m_alignmentLeft->SetToolTip(_("Left-align text.")); itemBoxSizer9->Add(m_alignmentLeft, 0, wxALIGN_LEFT|wxALL, 5); - m_alignmentRight = new wxRadioButton( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_RIGHT, _("&Right"), wxDefaultPosition, wxDefaultSize, 0 ); + m_alignmentRight = new wxRadioButton( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_RIGHT, _("&Right"), wxDefaultPosition, wxDefaultSize, 0 ); m_alignmentRight->SetValue(false); + m_alignmentRight->SetHelpText(_("Right-align text.")); + if (wxRichTextIndentsSpacingPage::ShowToolTips()) + m_alignmentRight->SetToolTip(_("Right-align text.")); itemBoxSizer9->Add(m_alignmentRight, 0, wxALIGN_LEFT|wxALL, 5); - m_alignmentJustified = new wxRadioButton( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_JUSTIFIED, _("&Justified"), wxDefaultPosition, wxDefaultSize, 0 ); + m_alignmentJustified = new wxRadioButton( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_JUSTIFIED, _("&Justified"), wxDefaultPosition, wxDefaultSize, 0 ); m_alignmentJustified->SetValue(false); + m_alignmentJustified->SetHelpText(_("Justify text left and right.")); + if (wxRichTextIndentsSpacingPage::ShowToolTips()) + m_alignmentJustified->SetToolTip(_("Justify text left and right.")); itemBoxSizer9->Add(m_alignmentJustified, 0, wxALIGN_LEFT|wxALL, 5); - m_alignmentCentred = new wxRadioButton( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_CENTRED, _("Cen&tred"), wxDefaultPosition, wxDefaultSize, 0 ); + m_alignmentCentred = new wxRadioButton( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_CENTRED, _("Cen&tred"), wxDefaultPosition, wxDefaultSize, 0 ); m_alignmentCentred->SetValue(false); + m_alignmentCentred->SetHelpText(_("Centre text.")); + if (wxRichTextIndentsSpacingPage::ShowToolTips()) + m_alignmentCentred->SetToolTip(_("Centre text.")); itemBoxSizer9->Add(m_alignmentCentred, 0, wxALIGN_LEFT|wxALL, 5); - m_alignmentIndeterminate = new wxRadioButton( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_INDETERMINATE, _("&Indeterminate"), wxDefaultPosition, wxDefaultSize, 0 ); + m_alignmentIndeterminate = new wxRadioButton( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_ALIGNMENT_INDETERMINATE, _("&Indeterminate"), wxDefaultPosition, wxDefaultSize, 0 ); m_alignmentIndeterminate->SetValue(false); + m_alignmentIndeterminate->SetHelpText(_("Use the current alignment setting.")); + if (wxRichTextIndentsSpacingPage::ShowToolTips()) + m_alignmentIndeterminate->SetToolTip(_("Use the current alignment setting.")); itemBoxSizer9->Add(m_alignmentIndeterminate, 0, wxALIGN_LEFT|wxALL, 5); itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); - wxStaticLine* itemStaticLine16 = new wxStaticLine( itemPanel1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); + wxStaticLine* itemStaticLine16 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); itemBoxSizer4->Add(itemStaticLine16, 0, wxGROW|wxLEFT|wxBOTTOM, 5); itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); @@ -173,135 +193,156 @@ void wxRichTextIndentsSpacingPage::CreateControls() wxBoxSizer* itemBoxSizer18 = new wxBoxSizer(wxVERTICAL); itemBoxSizer4->Add(itemBoxSizer18, 0, wxGROW, 5); - wxStaticText* itemStaticText19 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Indentation (tenths of a mm)"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer18->Add(itemStaticText19, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + wxStaticText* itemStaticText19 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Indentation (tenths of a mm)"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer18->Add(itemStaticText19, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5); wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer18->Add(itemBoxSizer20, 0, wxALIGN_LEFT|wxALL, 5); itemBoxSizer20->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5); - wxFlexGridSizer* itemFlexGridSizer22 = new wxFlexGridSizer(2, 2, 0, 0); + wxFlexGridSizer* itemFlexGridSizer22 = new wxFlexGridSizer(0, 2, 0, 0); itemBoxSizer20->Add(itemFlexGridSizer22, 0, wxALIGN_CENTER_VERTICAL, 5); - wxStaticText* itemStaticText23 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Left:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemFlexGridSizer22->Add(itemStaticText23, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); + wxStaticText* itemStaticText23 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Left:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemFlexGridSizer22->Add(itemStaticText23, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5); wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxHORIZONTAL); - itemFlexGridSizer22->Add(itemBoxSizer24, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); + itemFlexGridSizer22->Add(itemBoxSizer24, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5); - m_indentLeft = new wxTextCtrl( itemPanel1, - ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT, - wxEmptyString, - wxDefaultPosition, - wxSize(50, wxDefaultCoord), - 0 ); - itemBoxSizer24->Add(m_indentLeft, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + m_indentLeft = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 ); + m_indentLeft->SetHelpText(_("The left indent.")); + if (wxRichTextIndentsSpacingPage::ShowToolTips()) + m_indentLeft->SetToolTip(_("The left indent.")); + itemBoxSizer24->Add(m_indentLeft, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxStaticText* itemStaticText26 = new wxStaticText( itemPanel1, wxID_STATIC, _("Left (&first line):"), wxDefaultPosition, wxDefaultSize, 0 ); - itemFlexGridSizer22->Add(itemStaticText26, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); + wxStaticText* itemStaticText26 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("Left (&first line):"), wxDefaultPosition, wxDefaultSize, 0 ); + itemFlexGridSizer22->Add(itemStaticText26, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5); wxBoxSizer* itemBoxSizer27 = new wxBoxSizer(wxHORIZONTAL); - itemFlexGridSizer22->Add(itemBoxSizer27, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); + itemFlexGridSizer22->Add(itemBoxSizer27, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5); - m_indentLeftFirst = new wxTextCtrl( itemPanel1, - ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST, - wxEmptyString, - wxDefaultPosition, - wxSize(50, wxDefaultCoord), - 0 ); - itemBoxSizer27->Add(m_indentLeftFirst, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + m_indentLeftFirst = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 ); + m_indentLeftFirst->SetHelpText(_("The first line indent.")); + if (wxRichTextIndentsSpacingPage::ShowToolTips()) + m_indentLeftFirst->SetToolTip(_("The first line indent.")); + itemBoxSizer27->Add(m_indentLeftFirst, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxStaticText* itemStaticText29 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Right:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemFlexGridSizer22->Add(itemStaticText29, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); + wxStaticText* itemStaticText29 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Right:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemFlexGridSizer22->Add(itemStaticText29, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5); wxBoxSizer* itemBoxSizer30 = new wxBoxSizer(wxHORIZONTAL); - itemFlexGridSizer22->Add(itemBoxSizer30, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); - - m_indentRight = new wxTextCtrl( itemPanel1, - ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT, - wxEmptyString, - wxDefaultPosition, - wxSize(50, wxDefaultCoord), - 0 ); - itemBoxSizer30->Add(m_indentRight, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + itemFlexGridSizer22->Add(itemBoxSizer30, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5); + + m_indentRight = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 ); + m_indentRight->SetHelpText(_("The right indent.")); + if (wxRichTextIndentsSpacingPage::ShowToolTips()) + m_indentRight->SetToolTip(_("The right indent.")); + itemBoxSizer30->Add(m_indentRight, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxStaticText* itemStaticText32 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Outline level:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemFlexGridSizer22->Add(itemStaticText32, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5); + + wxArrayString m_outlineLevelCtrlStrings; + m_outlineLevelCtrlStrings.Add(_("Normal")); + m_outlineLevelCtrlStrings.Add(_("1")); + m_outlineLevelCtrlStrings.Add(_("2")); + m_outlineLevelCtrlStrings.Add(_("3")); + m_outlineLevelCtrlStrings.Add(_("4")); + m_outlineLevelCtrlStrings.Add(_("5")); + m_outlineLevelCtrlStrings.Add(_("6")); + m_outlineLevelCtrlStrings.Add(_("7")); + m_outlineLevelCtrlStrings.Add(_("8")); + m_outlineLevelCtrlStrings.Add(_("9")); + m_outlineLevelCtrl = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL, _("Normal"), wxDefaultPosition, wxSize(90, -1), m_outlineLevelCtrlStrings, wxCB_READONLY ); + m_outlineLevelCtrl->SetStringSelection(_("Normal")); + m_outlineLevelCtrl->SetHelpText(_("The outline level.")); + if (wxRichTextIndentsSpacingPage::ShowToolTips()) + m_outlineLevelCtrl->SetToolTip(_("The outline level.")); + itemFlexGridSizer22->Add(m_outlineLevelCtrl, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); - wxStaticLine* itemStaticLine33 = new wxStaticLine( itemPanel1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); - itemBoxSizer4->Add(itemStaticLine33, 0, wxGROW|wxTOP|wxBOTTOM, 5); + wxStaticLine* itemStaticLine35 = new wxStaticLine( itemRichTextDialogPage1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); + itemBoxSizer4->Add(itemStaticLine35, 0, wxGROW|wxTOP|wxBOTTOM, 5); itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); - wxBoxSizer* itemBoxSizer35 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer4->Add(itemBoxSizer35, 0, wxGROW, 5); + wxBoxSizer* itemBoxSizer37 = new wxBoxSizer(wxVERTICAL); + itemBoxSizer4->Add(itemBoxSizer37, 0, wxGROW, 5); - wxStaticText* itemStaticText36 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Spacing (tenths of a mm)"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer35->Add(itemStaticText36, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); + wxStaticText* itemStaticText38 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Spacing (tenths of a mm)"), wxDefaultPosition, wxDefaultSize, 0 ); + itemBoxSizer37->Add(itemStaticText38, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5); - wxBoxSizer* itemBoxSizer37 = new wxBoxSizer(wxHORIZONTAL); - itemBoxSizer35->Add(itemBoxSizer37, 0, wxALIGN_LEFT|wxALL, 5); + wxBoxSizer* itemBoxSizer39 = new wxBoxSizer(wxHORIZONTAL); + itemBoxSizer37->Add(itemBoxSizer39, 0, wxALIGN_LEFT|wxALL, 5); - itemBoxSizer37->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5); + itemBoxSizer39->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL, 5); - wxFlexGridSizer* itemFlexGridSizer39 = new wxFlexGridSizer(2, 2, 0, 0); - itemBoxSizer37->Add(itemFlexGridSizer39, 0, wxALIGN_CENTER_VERTICAL, 5); + wxFlexGridSizer* itemFlexGridSizer41 = new wxFlexGridSizer(30, 2, 0, 0); + itemFlexGridSizer41->AddGrowableCol(1); + itemBoxSizer39->Add(itemFlexGridSizer41, 0, wxALIGN_CENTER_VERTICAL, 5); - wxStaticText* itemStaticText40 = new wxStaticText( itemPanel1, wxID_STATIC, _("Before a paragraph:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemFlexGridSizer39->Add(itemStaticText40, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); + wxStaticText* itemStaticText42 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Before a paragraph:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemFlexGridSizer41->Add(itemStaticText42, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxBoxSizer* itemBoxSizer41 = new wxBoxSizer(wxHORIZONTAL); - itemFlexGridSizer39->Add(itemBoxSizer41, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); + wxBoxSizer* itemBoxSizer43 = new wxBoxSizer(wxHORIZONTAL); + itemFlexGridSizer41->Add(itemBoxSizer43, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5); - m_spacingBefore = new wxTextCtrl( itemPanel1, - ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE, - wxEmptyString, - wxDefaultPosition, - wxSize(50, wxDefaultCoord), - 0 ); - itemBoxSizer41->Add(m_spacingBefore, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + m_spacingBefore = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 ); + m_spacingBefore->SetHelpText(_("The spacing before the paragraph.")); + if (wxRichTextIndentsSpacingPage::ShowToolTips()) + m_spacingBefore->SetToolTip(_("The spacing before the paragraph.")); + itemBoxSizer43->Add(m_spacingBefore, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxStaticText* itemStaticText43 = new wxStaticText( itemPanel1, wxID_STATIC, _("After a paragraph:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemFlexGridSizer39->Add(itemStaticText43, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); + wxStaticText* itemStaticText45 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&After a paragraph:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemFlexGridSizer41->Add(itemStaticText45, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxBoxSizer* itemBoxSizer44 = new wxBoxSizer(wxHORIZONTAL); - itemFlexGridSizer39->Add(itemBoxSizer44, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); + wxBoxSizer* itemBoxSizer46 = new wxBoxSizer(wxHORIZONTAL); + itemFlexGridSizer41->Add(itemBoxSizer46, 1, wxGROW|wxALIGN_CENTER_VERTICAL, 5); - m_spacingAfter = new wxTextCtrl( itemPanel1, - ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER, - wxEmptyString, - wxDefaultPosition, - wxSize(50, wxDefaultCoord), - 0 ); - itemBoxSizer44->Add(m_spacingAfter, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + m_spacingAfter = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 ); + if (wxRichTextIndentsSpacingPage::ShowToolTips()) + m_spacingAfter->SetToolTip(_("The spacing after the paragraph.")); + itemBoxSizer46->Add(m_spacingAfter, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxStaticText* itemStaticText46 = new wxStaticText( itemPanel1, wxID_STATIC, _("Line spacing:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemFlexGridSizer39->Add(itemStaticText46, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); + wxStaticText* itemStaticText48 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("L&ine spacing:"), wxDefaultPosition, wxDefaultSize, 0 ); + itemFlexGridSizer41->Add(itemStaticText48, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5); - wxBoxSizer* itemBoxSizer47 = new wxBoxSizer(wxHORIZONTAL); - itemFlexGridSizer39->Add(itemBoxSizer47, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); + wxBoxSizer* itemBoxSizer49 = new wxBoxSizer(wxHORIZONTAL); + itemFlexGridSizer41->Add(itemBoxSizer49, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5); - wxString m_spacingLineStrings[] = { - _("Single"), - _("1.5"), - _("2") - }; - m_spacingLine = new wxComboBox( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_LINE, _("Single"), wxDefaultPosition, wxDefaultSize, 3, m_spacingLineStrings, wxCB_READONLY ); + wxArrayString m_spacingLineStrings; + m_spacingLineStrings.Add(_("Single")); + m_spacingLineStrings.Add(_("1.1")); + m_spacingLineStrings.Add(_("1.2")); + m_spacingLineStrings.Add(_("1.3")); + m_spacingLineStrings.Add(_("1.4")); + m_spacingLineStrings.Add(_("1.5")); + m_spacingLineStrings.Add(_("1.6")); + m_spacingLineStrings.Add(_("1.7")); + m_spacingLineStrings.Add(_("1.8")); + m_spacingLineStrings.Add(_("1.9")); + m_spacingLineStrings.Add(_("2")); + m_spacingLine = new wxComboBox( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_LINE, _("Single"), wxDefaultPosition, wxSize(90, -1), m_spacingLineStrings, wxCB_READONLY ); m_spacingLine->SetStringSelection(_("Single")); - itemBoxSizer47->Add(m_spacingLine, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); + m_spacingLine->SetHelpText(_("The line spacing.")); + if (wxRichTextIndentsSpacingPage::ShowToolTips()) + m_spacingLine->SetToolTip(_("The line spacing.")); + itemBoxSizer49->Add(m_spacingLine, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - itemBoxSizer3->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5); - m_previewCtrl = new wxRichTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_PREVIEW_CTRL, wxEmptyString, wxDefaultPosition, wxSize(350, 180), wxSUNKEN_BORDER ); + m_previewCtrl = new wxRichTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_PREVIEW_CTRL, wxEmptyString, wxDefaultPosition, wxSize(350, 100), wxVSCROLL|wxTE_READONLY ); m_previewCtrl->SetHelpText(_("Shows a preview of the paragraph settings.")); - if (ShowToolTips()) + if (wxRichTextIndentsSpacingPage::ShowToolTips()) m_previewCtrl->SetToolTip(_("Shows a preview of the paragraph settings.")); - itemBoxSizer3->Add(m_previewCtrl, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + itemBoxSizer3->Add(m_previewCtrl, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); ////@end wxRichTextIndentsSpacingPage content construction } -wxTextAttrEx* wxRichTextIndentsSpacingPage::GetAttributes() +wxRichTextAttr* wxRichTextIndentsSpacingPage::GetAttributes() { return wxRichTextFormattingDialog::GetDialogAttributes(this); } @@ -310,35 +351,45 @@ wxTextAttrEx* wxRichTextIndentsSpacingPage::GetAttributes() void wxRichTextIndentsSpacingPage::UpdatePreview() { 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_para2 = wxT("\nDuis pharetra consequat dui. Cum sociis natoque penatibus \ -et magnis dis parturient montes, nascetur ridiculus mus. Nullam vitae justo id mauris lobortis interdum."); + 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.\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"); TransferDataFromWindow(); - wxTextAttrEx attr(*GetAttributes()); + wxRichTextAttr attr(*GetAttributes()); attr.SetFlags(attr.GetFlags() & (wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER| wxTEXT_ATTR_LINE_SPACING| - wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_SYMBOL)); + wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_TEXT)); wxFont font(m_previewCtrl->GetFont()); font.SetPointSize(9); m_previewCtrl->SetFont(font); - font.SetWeight(wxBOLD); - attr.SetFont(font); + wxRichTextAttr normalParaAttr; + normalParaAttr.SetFont(font); + normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY"))); + m_previewCtrl->Freeze(); m_previewCtrl->Clear(); + m_previewCtrl->BeginStyle(normalParaAttr); m_previewCtrl->WriteText(s_para1); + m_previewCtrl->EndStyle(); + m_previewCtrl->BeginStyle(attr); m_previewCtrl->WriteText(s_para2); m_previewCtrl->EndStyle(); + + m_previewCtrl->BeginStyle(normalParaAttr); m_previewCtrl->WriteText(s_para3); + m_previewCtrl->EndStyle(); + + m_previewCtrl->Thaw(); } /// Transfer data from/to window @@ -346,7 +397,7 @@ bool wxRichTextIndentsSpacingPage::TransferDataFromWindow() { wxPanel::TransferDataFromWindow(); - wxTextAttrEx* attr = GetAttributes(); + wxRichTextAttr* attr = GetAttributes(); if (m_alignmentLeft->GetValue()) attr->SetAlignment(wxTEXT_ALIGNMENT_LEFT); @@ -364,9 +415,12 @@ bool wxRichTextIndentsSpacingPage::TransferDataFromWindow() wxString leftIndent(m_indentLeft->GetValue()); wxString leftFirstIndent(m_indentLeftFirst->GetValue()); - if (!leftIndent.empty()) + if (!leftIndent.empty() || !leftFirstIndent.empty()) { - int visualLeftIndent = wxAtoi(leftIndent); + int visualLeftIndent = 0; + if (!leftIndent.empty()) + visualLeftIndent = wxAtoi(leftIndent); + int visualLeftFirstIndent = wxAtoi(leftFirstIndent); int actualLeftIndent = visualLeftFirstIndent; int actualLeftSubIndent = visualLeftIndent - visualLeftFirstIndent; @@ -396,18 +450,18 @@ bool wxRichTextIndentsSpacingPage::TransferDataFromWindow() int spacingIndex = m_spacingLine->GetSelection(); int lineSpacing = 0; - if (spacingIndex == 0) - lineSpacing = 10; - else if (spacingIndex == 1) - lineSpacing = 15; - else if (spacingIndex == 2) - lineSpacing = 20; + if (spacingIndex != -1) + lineSpacing = 10 + spacingIndex; if (lineSpacing == 0) attr->SetFlags(attr->GetFlags() & (~wxTEXT_ATTR_LINE_SPACING)); else attr->SetLineSpacing(lineSpacing); + int outlineLevel = m_outlineLevelCtrl->GetSelection(); + if (outlineLevel != wxNOT_FOUND) + attr->SetOutlineLevel(outlineLevel); + return true; } @@ -417,7 +471,7 @@ bool wxRichTextIndentsSpacingPage::TransferDataToWindow() wxPanel::TransferDataToWindow(); - wxTextAttrEx* attr = GetAttributes(); + wxRichTextAttr* attr = GetAttributes(); if (attr->HasAlignment()) { @@ -481,12 +535,8 @@ bool wxRichTextIndentsSpacingPage::TransferDataToWindow() int index = 0; int lineSpacing = attr->GetLineSpacing(); - if (lineSpacing == 10) - index = 0; - else if (lineSpacing == 15) - index = 1; - else if (lineSpacing == 20) - index = 2; + if (lineSpacing >= 10 && lineSpacing <= 20) + index = lineSpacing - 10; else index = -1; @@ -495,6 +545,19 @@ bool wxRichTextIndentsSpacingPage::TransferDataToWindow() else m_spacingLine->SetSelection(-1); + if (attr->HasOutlineLevel()) + { + int outlineLevel = attr->GetOutlineLevel(); + if (outlineLevel < 0) + outlineLevel = 0; + if (outlineLevel > 9) + outlineLevel = 9; + + m_outlineLevelCtrl->SetSelection(outlineLevel); + } + else + m_outlineLevelCtrl->SetSelection(-1); + UpdatePreview(); m_dontUpdate = false; @@ -509,7 +572,7 @@ bool wxRichTextIndentsSpacingPage::TransferDataToWindow() bool wxRichTextIndentsSpacingPage::ShowToolTips() { - return true; + return wxRichTextFormattingDialog::ShowToolTips(); } /*! @@ -656,4 +719,14 @@ void wxRichTextIndentsSpacingPage::OnSpacingLineSelected( wxCommandEvent& WXUNUS UpdatePreview(); } +/*! + * wxEVT_COMMAND_COMBOBOX_SELECTED event handler for ID_RICHTEXTINDENTSSPACINGPAGE_OUTLINELEVEL + */ + +void wxRichTextIndentsSpacingPage::OnRichtextOutlinelevelSelected( wxCommandEvent& WXUNUSED(event) ) +{ + if (!m_dontUpdate) + UpdatePreview(); +} + #endif // wxUSE_RICHTEXT