Added box style functionality to style manager dialog

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70267 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2012-01-04 19:38:31 +00:00
parent eb3d8a3319
commit cd72035387
5 changed files with 199 additions and 89 deletions

View File

@ -67,7 +67,8 @@ class WXDLLIMPEXP_FWD_CORE wxCheckBox;
#define wxRICHTEXT_ORGANISER_SHOW_CHARACTER 0x0100
#define wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH 0x0200
#define wxRICHTEXT_ORGANISER_SHOW_LIST 0x0400
#define wxRICHTEXT_ORGANISER_SHOW_ALL 0x0800
#define wxRICHTEXT_ORGANISER_SHOW_BOX 0x0800
#define wxRICHTEXT_ORGANISER_SHOW_ALL 0x1000
// Common combinations
#define wxRICHTEXT_ORGANISER_ORGANISE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_DELETE_STYLES|wxRICHTEXT_ORGANISER_CREATE_STYLES|wxRICHTEXT_ORGANISER_APPLY_STYLES|wxRICHTEXT_ORGANISER_EDIT_STYLES|wxRICHTEXT_ORGANISER_RENAME_STYLES)
@ -160,6 +161,12 @@ public:
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST
void OnNewListUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX
void OnNewBoxClick( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX
void OnNewBoxUpdate( wxUpdateUIEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY
void OnApplyClick( wxCommandEvent& event );
@ -204,6 +211,7 @@ public:
wxButton* m_newCharacter;
wxButton* m_newParagraph;
wxButton* m_newList;
wxButton* m_newBox;
wxButton* m_applyStyle;
wxButton* m_renameStyle;
wxButton* m_editStyle;
@ -223,6 +231,7 @@ public:
ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_CHAR = 10504,
ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_PARA = 10505,
ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST = 10508,
ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX = 10512,
ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY = 10503,
ID_RICHTEXTSTYLEORGANISERDIALOG_RENAME = 10502,
ID_RICHTEXTSTYLEORGANISERDIALOG_EDIT = 10506,

View File

@ -265,7 +265,7 @@ void wxRichTextBulletsPage::CreateControls()
wxStaticText* itemStaticText30 = new wxStaticText( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_NUMBERSTATIC, _("&Number:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer18->Add(itemStaticText30, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
m_numberCtrl = new wxSpinCtrl( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, wxT("0"), wxDefaultPosition, wxSize(50, -1), wxSP_ARROW_KEYS, 0, 100000, 0 );
m_numberCtrl = new wxSpinCtrl( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_NUMBERCTRL, _T("0"), wxDefaultPosition, wxSize(50, -1), wxSP_ARROW_KEYS, 0, 100000, 0 );
m_numberCtrl->SetHelpText(_("The list item number."));
if (wxRichTextBulletsPage::ShowToolTips())
m_numberCtrl->SetToolTip(_("The list item number."));
@ -273,7 +273,7 @@ void wxRichTextBulletsPage::CreateControls()
itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5);
m_previewCtrl = new wxRichTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_PREVIEW_CTRL, wxEmptyString, wxDefaultPosition, wxSize(350, 100), wxVSCROLL|wxTE_READONLY );
m_previewCtrl = new wxRichTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTBULLETSPAGE_PREVIEW_CTRL, wxEmptyString, wxDefaultPosition, wxSize(350, 100), wxBORDER_THEME|wxVSCROLL|wxTE_READONLY );
m_previewCtrl->SetHelpText(_("Shows a preview of the bullet settings."));
if (wxRichTextBulletsPage::ShowToolTips())
m_previewCtrl->SetToolTip(_("Shows a preview of the bullet settings."));

View File

@ -306,6 +306,14 @@
<string name="proxy-type">"wbBoxSizerProxy"</string>
<string name="proxy-Orientation">"Vertical"</string>
<string name="proxy-Member variable name">""</string>
<string name="proxy-AlignH">"Centre"</string>
<string name="proxy-AlignV">"Centre"</string>
<long name="proxy-Stretch factor">0</long>
<long name="proxy-Border">5</long>
<bool name="proxy-wxLEFT">1</bool>
<bool name="proxy-wxRIGHT">1</bool>
<bool name="proxy-wxTOP">1</bool>
<bool name="proxy-wxBOTTOM">1</bool>
<bool name="proxy-wxSHAPED">0</bool>
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
@ -2208,14 +2216,6 @@
<string name="proxy-type">"wbBoxSizerProxy"</string>
<string name="proxy-Orientation">"Vertical"</string>
<string name="proxy-Member variable name">""</string>
<string name="proxy-AlignH">"Centre"</string>
<string name="proxy-AlignV">"Centre"</string>
<long name="proxy-Stretch factor">0</long>
<long name="proxy-Border">5</long>
<bool name="proxy-wxLEFT">1</bool>
<bool name="proxy-wxRIGHT">1</bool>
<bool name="proxy-wxTOP">1</bool>
<bool name="proxy-wxBOTTOM">1</bool>
<bool name="proxy-wxSHAPED">0</bool>
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
@ -4504,7 +4504,7 @@
<bool name="proxy-wxNO_BORDER">0</bool>
<bool name="proxy-wxSIMPLE_BORDER">0</bool>
<bool name="proxy-wxDOUBLE_BORDER">0</bool>
<bool name="proxy-wxBORDER_THEME">0</bool>
<bool name="proxy-wxBORDER_THEME">1</bool>
<bool name="proxy-wxSUNKEN_BORDER">0</bool>
<bool name="proxy-wxRAISED_BORDER">0</bool>
<bool name="proxy-wxSTATIC_BORDER">0</bool>
@ -5373,14 +5373,6 @@
<string name="proxy-type">"wbBoxSizerProxy"</string>
<string name="proxy-Orientation">"Vertical"</string>
<string name="proxy-Member variable name">""</string>
<string name="proxy-AlignH">"Centre"</string>
<string name="proxy-AlignV">"Centre"</string>
<long name="proxy-Stretch factor">0</long>
<long name="proxy-Border">5</long>
<bool name="proxy-wxLEFT">1</bool>
<bool name="proxy-wxRIGHT">1</bool>
<bool name="proxy-wxTOP">1</bool>
<bool name="proxy-wxBOTTOM">1</bool>
<bool name="proxy-wxSHAPED">0</bool>
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
@ -6934,7 +6926,7 @@
<bool name="proxy-wxNO_BORDER">0</bool>
<bool name="proxy-wxSIMPLE_BORDER">0</bool>
<bool name="proxy-wxDOUBLE_BORDER">0</bool>
<bool name="proxy-wxBORDER_THEME">0</bool>
<bool name="proxy-wxBORDER_THEME">1</bool>
<bool name="proxy-wxSUNKEN_BORDER">0</bool>
<bool name="proxy-wxRAISED_BORDER">0</bool>
<bool name="proxy-wxSTATIC_BORDER">0</bool>
@ -7061,14 +7053,6 @@
<string name="proxy-type">"wbBoxSizerProxy"</string>
<string name="proxy-Orientation">"Vertical"</string>
<string name="proxy-Member variable name">""</string>
<string name="proxy-AlignH">"Centre"</string>
<string name="proxy-AlignV">"Centre"</string>
<long name="proxy-Stretch factor">0</long>
<long name="proxy-Border">5</long>
<bool name="proxy-wxLEFT">1</bool>
<bool name="proxy-wxRIGHT">1</bool>
<bool name="proxy-wxTOP">1</bool>
<bool name="proxy-wxBOTTOM">1</bool>
<bool name="proxy-wxSHAPED">0</bool>
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
@ -8929,14 +8913,6 @@
<string name="proxy-type">"wbBoxSizerProxy"</string>
<string name="proxy-Orientation">"Vertical"</string>
<string name="proxy-Member variable name">""</string>
<string name="proxy-AlignH">"Centre"</string>
<string name="proxy-AlignV">"Centre"</string>
<long name="proxy-Stretch factor">0</long>
<long name="proxy-Border">5</long>
<bool name="proxy-wxLEFT">1</bool>
<bool name="proxy-wxRIGHT">1</bool>
<bool name="proxy-wxTOP">1</bool>
<bool name="proxy-wxBOTTOM">1</bool>
<bool name="proxy-wxSHAPED">0</bool>
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
@ -9295,7 +9271,7 @@
<bool name="proxy-wxNO_BORDER">0</bool>
<bool name="proxy-wxSIMPLE_BORDER">0</bool>
<bool name="proxy-wxDOUBLE_BORDER">0</bool>
<bool name="proxy-wxBORDER_THEME">0</bool>
<bool name="proxy-wxBORDER_THEME">1</bool>
<bool name="proxy-wxSUNKEN_BORDER">0</bool>
<bool name="proxy-wxRAISED_BORDER">0</bool>
<bool name="proxy-wxSTATIC_BORDER">0</bool>
@ -9627,6 +9603,73 @@
<string name="proxy-Custom arguments">""</string>
<string name="proxy-Custom ctor arguments">""</string>
</document>
<document>
<string name="title">"wxButton: ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX"</string>
<string name="type">"dialog-control-document"</string>
<string name="filename">""</string>
<string name="icon-name">"dialogcontrol"</string>
<long name="is-transient">0</long>
<long name="owns-file">1</long>
<long name="title-mode">0</long>
<long name="locked">0</long>
<string name="proxy-type">"wbButtonProxy"</string>
<string name="event-handler-0">"wxEVT_COMMAND_BUTTON_CLICKED|OnNewBoxClick|||wxRichTextStyleOrganiserDialog"</string>
<string name="event-handler-1">"wxEVT_UPDATE_UI|OnNewBoxUpdate|||wxRichTextStyleOrganiserDialog"</string>
<string name="proxy-Id name">"ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX"</string>
<long name="proxy-Id value">10512</long>
<string name="proxy-Name">""</string>
<string name="proxy-Class">"wxButton"</string>
<string name="proxy-Base class">"wxButton"</string>
<bool name="proxy-External implementation">1</bool>
<bool name="proxy-Separate files">0</bool>
<string name="proxy-Implementation filename">""</string>
<string name="proxy-Header filename">""</string>
<string name="proxy-Member variable name">"m_newBox"</string>
<string name="proxy-Label">"New &amp;Box Style..."</string>
<bool name="proxy-Default">0</bool>
<string name="proxy-Help text">"Click to create a new box style."</string>
<string name="proxy-Tooltip text">""</string>
<string name="proxy-Data variable">""</string>
<string name="proxy-Data validator">""</string>
<string name="proxy-Data source">""</string>
<string name="proxy-Data class name">""</string>
<string name="proxy-Data class implementation filename">""</string>
<string name="proxy-Data class header filename">""</string>
<string name="proxy-Data class manager window">""</string>
<string name="proxy-Background colour">""</string>
<string name="proxy-Foreground colour">""</string>
<string name="proxy-Font">""</string>
<bool name="proxy-Hidden">0</bool>
<bool name="proxy-Enabled">1</bool>
<string name="proxy-Platform">"&lt;Any platform&gt;"</string>
<bool name="proxy-wxBU_LEFT">0</bool>
<bool name="proxy-wxBU_RIGHT">0</bool>
<bool name="proxy-wxBU_TOP">0</bool>
<bool name="proxy-wxBU_BOTTOM">0</bool>
<bool name="proxy-wxBU_EXACTFIT">0</bool>
<bool name="proxy-wxNO_BORDER">0</bool>
<bool name="proxy-wxWANTS_CHARS">0</bool>
<bool name="proxy-wxNO_FULL_REPAINT_ON_RESIZE">0</bool>
<bool name="proxy-wxFULL_REPAINT_ON_RESIZE">0</bool>
<string name="proxy-Custom styles">""</string>
<long name="proxy-X">-1</long>
<long name="proxy-Y">-1</long>
<long name="proxy-Width">-1</long>
<long name="proxy-Height">-1</long>
<string name="proxy-AlignH">"Expand"</string>
<string name="proxy-AlignV">"Centre"</string>
<long name="proxy-Stretch factor">0</long>
<long name="proxy-Border">5</long>
<bool name="proxy-wxLEFT">1</bool>
<bool name="proxy-wxRIGHT">1</bool>
<bool name="proxy-wxTOP">0</bool>
<bool name="proxy-wxBOTTOM">1</bool>
<bool name="proxy-wxSHAPED">0</bool>
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
<string name="proxy-Custom arguments">""</string>
<string name="proxy-Custom ctor arguments">""</string>
</document>
<document>
<string name="title">"Spacer"</string>
<string name="type">"dialog-control-document"</string>
@ -10432,14 +10475,6 @@
<string name="proxy-type">"wbBoxSizerProxy"</string>
<string name="proxy-Orientation">"Vertical"</string>
<string name="proxy-Member variable name">""</string>
<string name="proxy-AlignH">"Centre"</string>
<string name="proxy-AlignV">"Centre"</string>
<long name="proxy-Stretch factor">0</long>
<long name="proxy-Border">5</long>
<bool name="proxy-wxLEFT">1</bool>
<bool name="proxy-wxRIGHT">1</bool>
<bool name="proxy-wxTOP">1</bool>
<bool name="proxy-wxBOTTOM">1</bool>
<bool name="proxy-wxSHAPED">0</bool>
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
@ -14461,14 +14496,6 @@
<string name="proxy-type">"wbBoxSizerProxy"</string>
<string name="proxy-Orientation">"Vertical"</string>
<string name="proxy-Member variable name">""</string>
<string name="proxy-AlignH">"Centre"</string>
<string name="proxy-AlignV">"Centre"</string>
<long name="proxy-Stretch factor">0</long>
<long name="proxy-Border">5</long>
<bool name="proxy-wxLEFT">1</bool>
<bool name="proxy-wxRIGHT">1</bool>
<bool name="proxy-wxTOP">1</bool>
<bool name="proxy-wxBOTTOM">1</bool>
<bool name="proxy-wxSHAPED">0</bool>
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
@ -14566,14 +14593,6 @@
<string name="proxy-type">"wbBoxSizerProxy"</string>
<string name="proxy-Orientation">"Vertical"</string>
<string name="proxy-Member variable name">""</string>
<string name="proxy-AlignH">"Centre"</string>
<string name="proxy-AlignV">"Centre"</string>
<long name="proxy-Stretch factor">0</long>
<long name="proxy-Border">5</long>
<bool name="proxy-wxLEFT">1</bool>
<bool name="proxy-wxRIGHT">1</bool>
<bool name="proxy-wxTOP">1</bool>
<bool name="proxy-wxBOTTOM">1</bool>
<bool name="proxy-wxSHAPED">0</bool>
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
@ -16853,14 +16872,6 @@
<string name="proxy-type">"wbBoxSizerProxy"</string>
<string name="proxy-Orientation">"Vertical"</string>
<string name="proxy-Member variable name">""</string>
<string name="proxy-AlignH">"Centre"</string>
<string name="proxy-AlignV">"Centre"</string>
<long name="proxy-Stretch factor">0</long>
<long name="proxy-Border">5</long>
<bool name="proxy-wxLEFT">1</bool>
<bool name="proxy-wxRIGHT">1</bool>
<bool name="proxy-wxTOP">1</bool>
<bool name="proxy-wxBOTTOM">1</bool>
<bool name="proxy-wxSHAPED">0</bool>
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
@ -23803,14 +23814,6 @@
<string name="proxy-type">"wbBoxSizerProxy"</string>
<string name="proxy-Orientation">"Vertical"</string>
<string name="proxy-Member variable name">""</string>
<string name="proxy-AlignH">"Centre"</string>
<string name="proxy-AlignV">"Centre"</string>
<long name="proxy-Stretch factor">0</long>
<long name="proxy-Border">5</long>
<bool name="proxy-wxLEFT">1</bool>
<bool name="proxy-wxRIGHT">1</bool>
<bool name="proxy-wxTOP">1</bool>
<bool name="proxy-wxBOTTOM">1</bool>
<bool name="proxy-wxSHAPED">0</bool>
<bool name="proxy-wxADJUST_MINSIZE">0</bool>
<bool name="proxy-wxFIXED_MINSIZE">0</bool>

View File

@ -324,7 +324,7 @@ void wxRichTextIndentsSpacingPage::CreateControls()
itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5);
m_previewCtrl = new wxRichTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_PREVIEW_CTRL, wxEmptyString, wxDefaultPosition, wxSize(350, 100), wxVSCROLL|wxTE_READONLY );
m_previewCtrl = new wxRichTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTINDENTSSPACINGPAGE_PREVIEW_CTRL, wxEmptyString, wxDefaultPosition, wxSize(350, 100), wxBORDER_THEME|wxVSCROLL|wxTE_READONLY );
m_previewCtrl->SetHelpText(_("Shows a preview of the paragraph settings."));
if (wxRichTextIndentsSpacingPage::ShowToolTips())
m_previewCtrl->SetToolTip(_("Shows a preview of the paragraph settings."));

View File

@ -51,6 +51,9 @@ BEGIN_EVENT_TABLE( wxRichTextStyleOrganiserDialog, wxDialog )
EVT_BUTTON( ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST, wxRichTextStyleOrganiserDialog::OnNewListClick )
EVT_UPDATE_UI( ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_LIST, wxRichTextStyleOrganiserDialog::OnNewListUpdate )
EVT_BUTTON( ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX, wxRichTextStyleOrganiserDialog::OnNewBoxClick )
EVT_UPDATE_UI( ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX, wxRichTextStyleOrganiserDialog::OnNewBoxUpdate )
EVT_BUTTON( ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY, wxRichTextStyleOrganiserDialog::OnApplyClick )
EVT_UPDATE_UI( ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY, wxRichTextStyleOrganiserDialog::OnApplyUpdate )
@ -105,6 +108,7 @@ void wxRichTextStyleOrganiserDialog::Init()
m_newCharacter = NULL;
m_newParagraph = NULL;
m_newList = NULL;
m_newBox = NULL;
m_applyStyle = NULL;
m_renameStyle = NULL;
m_editStyle = NULL;
@ -161,6 +165,11 @@ void wxRichTextStyleOrganiserDialog::CreateControls()
typesToShow = wxRichTextStyleListBox::wxRICHTEXT_STYLE_PARAGRAPH;
hideTypeSelector = true;
}
else if ((m_flags & wxRICHTEXT_ORGANISER_SHOW_BOX) != 0)
{
typesToShow = wxRichTextStyleListBox::wxRICHTEXT_STYLE_BOX;
hideTypeSelector = true;
}
else if ((m_flags & wxRICHTEXT_ORGANISER_SHOW_LIST) != 0)
{
typesToShow = wxRichTextStyleListBox::wxRICHTEXT_STYLE_LIST;
@ -205,7 +214,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(250, 200), wxVSCROLL|wxTE_READONLY );
m_previewCtrl = new wxRichTextCtrl( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_PREVIEW, wxEmptyString, wxDefaultPosition, wxSize(250, 200), wxBORDER_THEME|wxVSCROLL|wxTE_READONLY );
m_previewCtrl->SetHelpText(_("The style preview."));
if (wxRichTextStyleOrganiserDialog::ShowToolTips())
m_previewCtrl->SetToolTip(_("The style preview."));
@ -235,6 +244,12 @@ void wxRichTextStyleOrganiserDialog::CreateControls()
m_newList->SetToolTip(_("Click to create a new list style."));
m_buttonSizer->Add(m_newList, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
m_newBox = new wxButton( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX, _("New &Box Style..."), wxDefaultPosition, wxDefaultSize, 0 );
m_newBox->SetHelpText(_("Click to create a new box style."));
if (wxRichTextStyleOrganiserDialog::ShowToolTips())
m_newBox->SetToolTip(_("Click to create a new box style."));
m_buttonSizer->Add(m_newBox, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
m_buttonSizer->Add(5, 5, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
m_applyStyle = new wxButton( itemDialog1, ID_RICHTEXTSTYLEORGANISERDIALOG_APPLY, _("&Apply Style"), wxDefaultPosition, wxDefaultSize, 0 );
@ -289,8 +304,8 @@ void wxRichTextStyleOrganiserDialog::CreateControls()
m_cancelButton = new wxButton( itemDialog1, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
m_stdButtonSizer->AddButton(m_cancelButton);
wxButton* itemButton28 = new wxButton( itemDialog1, wxID_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
m_stdButtonSizer->AddButton(itemButton28);
wxButton* itemButton29 = new wxButton( itemDialog1, wxID_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
m_stdButtonSizer->AddButton(itemButton29);
m_stdButtonSizer->Realize();
@ -308,6 +323,7 @@ void wxRichTextStyleOrganiserDialog::CreateControls()
m_buttonSizer->Show(m_newCharacter, false);
m_buttonSizer->Show(m_newParagraph, false);
m_buttonSizer->Show(m_newList, false);
m_buttonSizer->Show(m_newBox, false);
}
if ((m_flags & wxRICHTEXT_ORGANISER_DELETE_STYLES) == 0)
{
@ -432,8 +448,8 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
}
wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
wxRichTextBoxStyleDefinition* boxDef = wxDynamicCast(def, wxRichTextBoxStyleDefinition);
wxStaticText* labelCtrl = (wxStaticText*) FindWindow(ID_RICHTEXTSTYLEORGANISERDIALOG_CURRENT_STYLE);
if (labelCtrl)
@ -456,10 +472,9 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
m_previewCtrl->WriteText(s_para1);
m_previewCtrl->EndStyle();
m_previewCtrl->BeginStyle(attr);
if (listDef)
{
m_previewCtrl->BeginStyle(attr);
long listStart = m_previewCtrl->GetInsertionPoint() + 1;
int i;
for (i = 0; i < 10; i++)
@ -472,14 +487,32 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
}
long listEnd = m_previewCtrl->GetInsertionPoint();
m_previewCtrl->NumberList(wxRichTextRange(listStart, listEnd), listDef);
m_previewCtrl->EndStyle();
}
else if (boxDef)
{
wxRichTextAttr cellParaAttr;
cellParaAttr.SetFont(font);
cellParaAttr.SetTextColour(*wxBLACK);
wxRichTextBox* textBox = m_previewCtrl->WriteTextBox(attr);
m_previewCtrl->SetFocusObject(textBox);
m_previewCtrl->BeginStyle(cellParaAttr);
wxString text(s_para2);
text.Replace(wxT("\n"), wxEmptyString);
m_previewCtrl->WriteText(text);
m_previewCtrl->EndStyle();
m_previewCtrl->SetFocusObject(NULL); // Set the focus back to the main buffer
m_previewCtrl->SetInsertionPointEnd();
m_previewCtrl->SetDefaultStyle(wxRichTextAttr());
}
else
{
m_previewCtrl->BeginStyle(attr);
m_previewCtrl->WriteText(s_para2);
m_previewCtrl->EndStyle();
}
m_previewCtrl->EndStyle();
m_previewCtrl->BeginStyle(normalParaAttr);
m_previewCtrl->WriteText(s_para3);
m_previewCtrl->EndStyle();
@ -511,12 +544,20 @@ bool wxRichTextStyleOrganiserDialog::ApplyStyle(wxRichTextCtrl* ctrl)
wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
wxRichTextBoxStyleDefinition* boxDef = wxDynamicCast(def, wxRichTextBoxStyleDefinition);
if (listDef && m_restartNumberingCtrl->GetValue())
{
wxRichTextRange range = ctrl->GetSelectionRange();
return ctrl->SetListStyle(range, listDef, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_RENUMBER);
}
else if (boxDef)
{
if (!ctrl->GetFocusObject() || (ctrl->GetFocusObject() && (ctrl->GetFocusObject() == & ctrl->GetBuffer())))
return false;
ctrl->SetStyle(ctrl->GetFocusObject(), def->GetStyleMergedWithBase(m_stylesListBox->GetStyleSheet()));
return true;
}
else
{
return ctrl->ApplyStyle(def);
@ -689,6 +730,10 @@ void wxRichTextStyleOrganiserDialog::OnEditClick( wxCommandEvent& WXUNUSED(event
{
pages |= wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING|wxRICHTEXT_FORMAT_TABS|wxRICHTEXT_FORMAT_BULLETS;
}
else if (def->IsKindOf(CLASSINFO(wxRichTextBoxStyleDefinition)))
{
pages |= wxRICHTEXT_FORMAT_MARGINS|wxRICHTEXT_FORMAT_SIZE|wxRICHTEXT_FORMAT_BORDERS|wxRICHTEXT_FORMAT_BACKGROUND;
}
wxRichTextFormattingDialog formatDlg;
formatDlg.SetStyleDefinition(*def, GetStyleSheet());
@ -699,6 +744,7 @@ void wxRichTextStyleOrganiserDialog::OnEditClick( wxCommandEvent& WXUNUSED(event
wxRichTextParagraphStyleDefinition* paraDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextParagraphStyleDefinition);
wxRichTextCharacterStyleDefinition* charDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextCharacterStyleDefinition);
wxRichTextListStyleDefinition* listDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextListStyleDefinition);
wxRichTextBoxStyleDefinition* boxDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextBoxStyleDefinition);
if (listDef)
{
@ -708,6 +754,10 @@ void wxRichTextStyleOrganiserDialog::OnEditClick( wxCommandEvent& WXUNUSED(event
{
(*((wxRichTextParagraphStyleDefinition* ) def)) = (*paraDef);
}
else if (boxDef)
{
(*((wxRichTextBoxStyleDefinition* ) def)) = (*boxDef);
}
else
{
(*((wxRichTextCharacterStyleDefinition* ) def)) = (*charDef);
@ -751,6 +801,8 @@ void wxRichTextStyleOrganiserDialog::OnDeleteClick( wxCommandEvent& WXUNUSED(eve
GetStyleSheet()->RemoveParagraphStyle((wxRichTextParagraphStyleDefinition*) def, true);
else if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition)))
GetStyleSheet()->RemoveCharacterStyle((wxRichTextCharacterStyleDefinition*) def, true);
else if (def->IsKindOf(CLASSINFO(wxRichTextBoxStyleDefinition)))
GetStyleSheet()->RemoveBoxStyle((wxRichTextBoxStyleDefinition*) def, true);
m_stylesListBox->UpdateStyles();
@ -856,7 +908,7 @@ void wxRichTextStyleOrganiserDialog::OnRenameClick( wxCommandEvent& WXUNUSED(eve
if (styleName == def->GetName())
return;
if (GetStyleSheet()->FindParagraphStyle(styleName) || GetStyleSheet()->FindCharacterStyle(styleName) || GetStyleSheet()->FindListStyle(styleName))
if (GetStyleSheet()->FindParagraphStyle(styleName) || GetStyleSheet()->FindCharacterStyle(styleName) || GetStyleSheet()->FindListStyle(styleName) || GetStyleSheet()->FindBoxStyle(styleName))
{
wxMessageBox(_("Sorry, that name is taken. Please choose another."), _("New Style"), wxICON_EXCLAMATION|wxOK, this);
return;
@ -885,6 +937,52 @@ void wxRichTextStyleOrganiserDialog::OnListSelection(wxCommandEvent& event)
event.Skip();
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX
*/
void wxRichTextStyleOrganiserDialog::OnNewBoxClick( wxCommandEvent& WXUNUSED(event) )
{
wxString styleName = wxGetTextFromUser(_("Enter a box style name"), _("New Style"));
if (!styleName.IsEmpty())
{
if (GetStyleSheet()->FindBoxStyle(styleName))
{
wxMessageBox(_("Sorry, that name is taken. Please choose another."), _("New Style"), wxICON_EXCLAMATION|wxOK, this);
return;
}
wxRichTextBoxStyleDefinition* style = new wxRichTextBoxStyleDefinition(styleName);
int pages = wxRICHTEXT_FORMAT_MARGINS|wxRICHTEXT_FORMAT_SIZE|wxRICHTEXT_FORMAT_BORDERS|wxRICHTEXT_FORMAT_BACKGROUND;
wxRichTextFormattingDialog formatDlg;
formatDlg.SetStyleDefinition(*style, GetStyleSheet());
formatDlg.Create(pages, this);
if (formatDlg.ShowModal() == wxID_OK)
{
wxRichTextBoxStyleDefinition* boxDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextBoxStyleDefinition);
(*((wxRichTextBoxStyleDefinition* ) style)) = (*boxDef);
GetStyleSheet()->AddBoxStyle(style);
m_stylesListBox->UpdateStyles();
ShowPreview();
}
else
delete style;
}
}
/*!
* wxEVT_UPDATE_UI event handler for ID_RICHTEXTSTYLEORGANISERDIALOG_NEW_BOX
*/
void wxRichTextStyleOrganiserDialog::OnNewBoxUpdate( wxUpdateUIEvent& event )
{
event.Enable((GetFlags() & wxRICHTEXT_ORGANISER_CREATE_STYLES) != 0);
}
#endif
// wxUSE_RICHTEXT