From 41a852156fab5ee6075b3ab92f8230989547daac Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Fri, 20 Oct 2006 07:48:31 +0000 Subject: [PATCH] Whitespaces and headers cleaning. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42147 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/richtext/richtextbuffer.h | 1 - include/wx/richtext/richtextctrl.h | 1 - include/wx/richtext/richtextformatdlg.h | 4 +- include/wx/richtext/richtextliststylepage.h | 16 +-- include/wx/richtext/richtextstyledlg.h | 36 +++---- include/wx/richtext/richtextstylepage.h | 8 +- include/wx/richtext/richtextstyles.h | 2 +- include/wx/richtext/richtextsymboldlg.h | 2 +- src/richtext/richtextbuffer.cpp | 83 ++++++++-------- src/richtext/richtextbulletspage.cpp | 6 +- src/richtext/richtextctrl.cpp | 23 +++-- src/richtext/richtextfontpage.cpp | 12 +-- src/richtext/richtextformatdlg.cpp | 2 +- src/richtext/richtextindentspage.cpp | 10 +- src/richtext/richtextliststylepage.cpp | 54 +++++----- src/richtext/richtextstyledlg.cpp | 104 ++++++++++---------- src/richtext/richtextstylepage.cpp | 16 +-- src/richtext/richtextstyles.cpp | 85 ++++++++-------- src/richtext/richtextsymboldlg.cpp | 6 +- src/richtext/richtexttabspage.cpp | 4 +- 20 files changed, 235 insertions(+), 240 deletions(-) diff --git a/include/wx/richtext/richtextbuffer.h b/include/wx/richtext/richtextbuffer.h index 656f9d753f..5865f60140 100644 --- a/include/wx/richtext/richtextbuffer.h +++ b/include/wx/richtext/richtextbuffer.h @@ -2081,4 +2081,3 @@ WXDLLIMPEXP_RICHTEXT void wxRichTextModuleInit(); #endif // _WX_RICHTEXTBUFFER_H_ - diff --git a/include/wx/richtext/richtextctrl.h b/include/wx/richtext/richtextctrl.h index fdd15c4d12..d1a681e08c 100644 --- a/include/wx/richtext/richtextctrl.h +++ b/include/wx/richtext/richtextctrl.h @@ -869,4 +869,3 @@ typedef void (wxEvtHandler::*wxRichTextEventFunction)(wxRichTextEvent&); #endif // _WX_RICHTEXTCTRL_H_ - diff --git a/include/wx/richtext/richtextformatdlg.h b/include/wx/richtext/richtextformatdlg.h index a2cf19be47..279231699e 100644 --- a/include/wx/richtext/richtextformatdlg.h +++ b/include/wx/richtext/richtextformatdlg.h @@ -173,10 +173,10 @@ public: /// Should we show tooltips? static bool ShowToolTips() { return sm_showToolTips; } - + /// Determines whether tooltips will be shown static void SetShowToolTips(bool show) { sm_showToolTips = show; } - + /// Map book control page index to our page id void AddPageId(int id) { m_pageIds.Add(id); } diff --git a/include/wx/richtext/richtextliststylepage.h b/include/wx/richtext/richtextliststylepage.h index f1568967f1..61c3e6cfb0 100644 --- a/include/wx/richtext/richtextliststylepage.h +++ b/include/wx/richtext/richtextliststylepage.h @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: richtextliststylepage.h -// Purpose: +// Name: wx/richtext/richtextliststylepage.h +// Purpose: // Author: Julian Smart -// Modified by: +// Modified by: // Created: 10/18/2006 11:36:37 AM -// RCS-ID: +// RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _RICHTEXTLISTSTYLEPAGE_H_ @@ -39,7 +39,7 @@ */ class WXDLLIMPEXP_RICHTEXT wxRichTextListStylePage: public wxPanel -{ +{ DECLARE_DYNAMIC_CLASS( wxRichTextListStylePage ) DECLARE_EVENT_TABLE() @@ -63,7 +63,7 @@ public: /// Transfer data from/to window virtual bool TransferDataFromWindow(); virtual bool TransferDataToWindow(); - + /// Get attributes for selected level wxTextAttrEx* GetAttributesForSelection(); @@ -78,7 +78,7 @@ public: /// Transfer from the window and preview void TransferAndPreview(); - + ////@begin wxRichTextListStylePage event handler declarations /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL diff --git a/include/wx/richtext/richtextstyledlg.h b/include/wx/richtext/richtextstyledlg.h index c74c9a49c0..8b5bc0d0c4 100644 --- a/include/wx/richtext/richtextstyledlg.h +++ b/include/wx/richtext/richtextstyledlg.h @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: richtextstyledlg.h -// Purpose: +// Name: wx/richtext/richtextstyledlg.h +// Purpose: // Author: Julian Smart -// Modified by: +// Modified by: // Created: 10/5/2006 12:05:31 PM -// RCS-ID: +// RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _RICHTEXTSTYLEDLG_H_ @@ -48,7 +48,7 @@ class wxRichTextCtrl; /*! * Flags for specifying permitted operations */ - + #define wxRICHTEXT_ORGANISER_DELETE_STYLES 0x0001 #define wxRICHTEXT_ORGANISER_CREATE_STYLES 0x0002 #define wxRICHTEXT_ORGANISER_APPLY_STYLES 0x0004 @@ -73,7 +73,7 @@ class wxRichTextCtrl; */ class WXDLLIMPEXP_RICHTEXT wxRichTextStyleOrganiserDialog: public wxDialog -{ +{ DECLARE_DYNAMIC_CLASS( wxRichTextStyleOrganiserDialog ) DECLARE_EVENT_TABLE() @@ -87,18 +87,18 @@ public: /// Creates the controls and sizers void CreateControls(); - + /// Initialise member variables void Init(); /// Transfer data from/to window virtual bool TransferDataFromWindow(); virtual bool TransferDataToWindow(); - + /// Set/get style sheet void SetStyleSheet(wxRichTextStyleSheet* sheet) { m_richTextStyleSheet = sheet; } wxRichTextStyleSheet* GetStyleSheet() const { return m_richTextStyleSheet; } - + /// Set/get control void SetRichTextCtrl(wxRichTextCtrl* ctrl) { m_richTextCtrl = ctrl; } wxRichTextCtrl* GetRichTextCtrl() const { return m_richTextCtrl; } @@ -106,30 +106,30 @@ public: /// Set/get flags void SetFlags(int flags) { m_flags = flags; } int GetFlags() const { return m_flags; } - + /// Show preview for given or selected preview void ShowPreview(int sel = -1); - + /// Clears the preview void ClearPreview(); - + /// List selection void OnListSelection(wxCommandEvent& event); - + /// Get/set restart numbering boolean bool GetRestartNumbering() const { return m_restartNumbering; } void SetRestartNumbering(bool restartNumbering) { m_restartNumbering = restartNumbering; } - + /// Get selected style name or definition wxString GetSelectedStyle() const; wxRichTextStyleDefinition* GetSelectedStyleDefinition() const; - + /// Apply the style bool ApplyStyle(wxRichTextCtrl* ctrl = NULL); /// Should we show tooltips? static bool ShowToolTips() { return sm_showToolTips; } - + /// Determines whether tooltips will be shown static void SetShowToolTips(bool show) { sm_showToolTips = show; } @@ -226,7 +226,7 @@ private: wxRichTextCtrl* m_richTextCtrl; wxRichTextStyleSheet* m_richTextStyleSheet; - + bool m_dontUpdate; int m_flags; static bool sm_showToolTips; diff --git a/include/wx/richtext/richtextstylepage.h b/include/wx/richtext/richtextstylepage.h index 39de549b5b..21b6de1266 100644 --- a/include/wx/richtext/richtextstylepage.h +++ b/include/wx/richtext/richtextstylepage.h @@ -1,8 +1,8 @@ ///////////////////////////////////////////////////////////////////////////// // Name: wx/richtext/richtextstylepage.h -// Purpose: +// Purpose: // Author: Julian Smart -// Modified by: +// Modified by: // Created: 10/5/2006 11:34:55 AM // RCS-ID: $Id$ // Copyright: (c) Julian Smart @@ -29,7 +29,7 @@ */ class wxRichTextStylePage: public wxPanel -{ +{ DECLARE_DYNAMIC_CLASS( wxRichTextStylePage ) DECLARE_EVENT_TABLE() @@ -40,7 +40,7 @@ public: /// Creation bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WXRICHTEXTSTYLEPAGE_IDNAME, const wxPoint& pos = SYMBOL_WXRICHTEXTSTYLEPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTSTYLEPAGE_SIZE, long style = SYMBOL_WXRICHTEXTSTYLEPAGE_STYLE ); - + /// Initialise members void Init(); diff --git a/include/wx/richtext/richtextstyles.h b/include/wx/richtext/richtextstyles.h index a9c45d2009..a5be1ee278 100644 --- a/include/wx/richtext/richtextstyles.h +++ b/include/wx/richtext/richtextstyles.h @@ -4,7 +4,7 @@ // Author: Julian Smart // Modified by: // Created: 2005-09-30 -// RCS-ID: +// RCS-ID: $Id$ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/richtext/richtextsymboldlg.h b/include/wx/richtext/richtextsymboldlg.h index 28b9aa6231..38ea1278f1 100644 --- a/include/wx/richtext/richtextsymboldlg.h +++ b/include/wx/richtext/richtextsymboldlg.h @@ -94,7 +94,7 @@ public: /// Should we show tooltips? static bool ShowToolTips() { return sm_showToolTips; } - + /// Determines whether tooltips will be shown static void SetShowToolTips(bool show) { sm_showToolTips = show; } diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 9cdcf263c4..9df7d15069 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -932,7 +932,7 @@ wxRichTextRange wxRichTextParagraphLayoutBox::AddParagraphs(const wxString& text size_t i = 0; size_t len = text.length(); wxString line; - wxRichTextParagraph* para = new wxRichTextParagraph(wxT(""), this, & style); + wxRichTextParagraph* para = new wxRichTextParagraph(wxEmptyString, this, & style); if (paraStyle) para->SetAttributes(*paraStyle); @@ -949,7 +949,7 @@ wxRichTextRange wxRichTextParagraphLayoutBox::AddParagraphs(const wxString& text wxRichTextPlainText* plainText = (wxRichTextPlainText*) para->GetChildren().GetFirst()->GetData(); plainText->SetText(line); - para = new wxRichTextParagraph(wxT(""), this, & style); + para = new wxRichTextParagraph(wxEmptyString, this, & style); if (paraStyle) para->SetAttributes(*paraStyle); @@ -1617,7 +1617,7 @@ bool wxRichTextParagraphLayoutBox::SetStyle(const wxRichTextRange& range, const } else newPara = para; - + if (paragraphStyle && !charactersOnly) { if (applyMinimal) @@ -2433,7 +2433,7 @@ bool wxRichTextParagraphLayoutBox::ApplyStyleSheet(wxRichTextStyleSheet* styleSh // Problem: when changing from one list style to another, there's a danger that the level info will get lost. // So when changing a list style interactively, could retrieve level based on current style, then // set appropriate indent and apply new style. - + if (!para->GetAttributes().GetParagraphStyleName().IsEmpty() && !para->GetAttributes().GetListStyleName().IsEmpty()) { int currentIndent = para->GetAttributes().GetLeftIndent(); @@ -2467,9 +2467,9 @@ bool wxRichTextParagraphLayoutBox::ApplyStyleSheet(wxRichTextStyleSheet* styleSh wxRichTextListStyleDefinition* listDef = styleSheet->FindListStyle(para->GetAttributes().GetListStyleName()); - // Overall list definition style + // Overall list definition style para->GetAttributes() = listDef->GetStyle(); - + // Style for this level wxRichTextApplyStyle(para->GetAttributes(), * listDef->GetLevelAttributes(listDef->FindLevelForIndent(currentIndent))); @@ -2498,10 +2498,10 @@ bool wxRichTextParagraphLayoutBox::SetListStyle(const wxRichTextRange& range, wx // bool applyMinimal = ((flags & wxRICHTEXT_SETSTYLE_OPTIMIZE) != 0); bool specifyLevel = ((flags & wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL) != 0); bool renumber = ((flags & wxRICHTEXT_SETSTYLE_RENUMBER) != 0); - + // Current number, if numbering int n = startFrom; - + wxASSERT (!specifyLevel || (specifyLevel && (specifiedLevel >= 0))); // If we are associated with a control, make undoable; otherwise, apply immediately @@ -2546,12 +2546,12 @@ bool wxRichTextParagraphLayoutBox::SetListStyle(const wxRichTextRange& range, wx } else newPara = para; - + if (def) { int thisIndent = newPara->GetAttributes().GetLeftIndent(); int thisLevel = specifyLevel ? specifiedLevel : def->FindLevelForIndent(thisIndent); - + // How is numbering going to work? // If we are renumbering, or numbering for the first time, we need to keep // track of the number for each level. But we might be simply applying a different @@ -2563,13 +2563,13 @@ bool wxRichTextParagraphLayoutBox::SetListStyle(const wxRichTextRange& range, wx // Apply the overall list style, and item style for this level wxTextAttrEx listStyle(def->GetCombinedStyleForLevel(thisLevel)); wxRichTextApplyStyle(newPara->GetAttributes(), listStyle); - + // Now we need to check numbering if (renumber) { newPara->GetAttributes().SetBulletNumber(n); } - + n ++; } else if (!newPara->GetAttributes().GetListStyleName().IsEmpty()) @@ -2579,10 +2579,10 @@ bool wxRichTextParagraphLayoutBox::SetListStyle(const wxRichTextRange& range, wx newPara->GetAttributes().SetListStyleName(wxEmptyString); newPara->GetAttributes().SetLeftIndent(0, 0); - + // Eliminate the main list-related attributes newPara->GetAttributes().SetFlags(newPara->GetAttributes().GetFlags() & ~wxTEXT_ATTR_LEFT_INDENT & ~wxTEXT_ATTR_BULLET_STYLE & ~wxTEXT_ATTR_BULLET_NUMBER & ~wxTEXT_ATTR_BULLET_SYMBOL & wxTEXT_ATTR_LIST_STYLE_NAME); - + wxRichTextStyleSheet* styleSheet = GetStyleSheet(); if (styleSheet && !newPara->GetAttributes().GetParagraphStyleName().IsEmpty()) { @@ -2638,17 +2638,17 @@ bool wxRichTextParagraphLayoutBox::DoNumberList(const wxRichTextRange& range, co bool specifyLevel = ((flags & wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL) != 0); bool renumber = ((flags & wxRICHTEXT_SETSTYLE_RENUMBER) != 0); - + // Max number of levels const int maxLevels = 10; - + // The level we're looking at now int currentLevel = -1; - + // The item number for each level int levels[maxLevels]; int i; - + // Reset all numbering for (i = 0; i < maxLevels; i++) { @@ -2659,7 +2659,7 @@ bool wxRichTextParagraphLayoutBox::DoNumberList(const wxRichTextRange& range, co else levels[i] = -1; // start from the number we found, if any } - + wxASSERT(!specifyLevel || (specifyLevel && (specifiedLevel >= 0))); // If we are associated with a control, make undoable; otherwise, apply immediately @@ -2704,16 +2704,16 @@ bool wxRichTextParagraphLayoutBox::DoNumberList(const wxRichTextRange& range, co } else newPara = para; - + wxRichTextListStyleDefinition* defToUse = def; if (!defToUse) { wxRichTextStyleSheet* sheet = GetStyleSheet(); - + if (sheet && !newPara->GetAttributes().GetListStyleName().IsEmpty()) defToUse = sheet->FindListStyle(newPara->GetAttributes().GetListStyleName()); } - + if (defToUse) { int thisIndent = newPara->GetAttributes().GetLeftIndent(); @@ -2723,7 +2723,7 @@ bool wxRichTextParagraphLayoutBox::DoNumberList(const wxRichTextRange& range, co // change the level. if (thisIndent == 0 || specifiedLevel != -1) thisLevel = specifiedLevel; - + // Do promotion if specified if ((promoteBy != 0) && !para->GetRange().IsOutside(promotionRange)) { @@ -2733,16 +2733,16 @@ bool wxRichTextParagraphLayoutBox::DoNumberList(const wxRichTextRange& range, co if (thisLevel > 9) thisLevel = 9; } - + // Apply the overall list style, and item style for this level wxTextAttrEx listStyle(defToUse->GetCombinedStyleForLevel(thisLevel)); wxRichTextApplyStyle(newPara->GetAttributes(), listStyle); - + // OK, we've (re)applied the style, now let's get the numbering right. - + if (currentLevel == -1) currentLevel = thisLevel; - + // Same level as before, do nothing except increment level's number afterwards if (currentLevel == thisLevel) { @@ -2759,7 +2759,7 @@ bool wxRichTextParagraphLayoutBox::DoNumberList(const wxRichTextRange& range, co else if (thisLevel < currentLevel) { currentLevel = thisLevel; - } + } // Use the current numbering if -1 and we have a bullet number already if (levels[currentLevel] == -1) @@ -2769,10 +2769,10 @@ bool wxRichTextParagraphLayoutBox::DoNumberList(const wxRichTextRange& range, co else levels[currentLevel] = 1; } - + newPara->GetAttributes().SetBulletNumber(levels[currentLevel]); - levels[currentLevel] ++; + levels[currentLevel] ++; } } } @@ -2811,9 +2811,9 @@ bool wxRichTextParagraphLayoutBox::PromoteList(int promoteBy, const wxRichTextRa // list position will start from 1. // Similarly, we look after the last para in the promote range for an indentation that is less (or no list style). // We can end the renumbering at this point. - + // For now, only renumber within the promotion range. - + return DoNumberList(range, range, promoteBy, def, flags, 1, specifiedLevel); } @@ -4030,12 +4030,12 @@ bool wxRichTextPlainText::Draw(wxDC& dc, const wxRichTextRange& range, const wxR // Compensate for kerning difference wxString stringFragment2(m_text.Mid(r1 - offset, fragmentLen+1)); wxString stringFragment3(m_text.Mid(r1 - offset + fragmentLen, 1)); - + wxCoord w1, h1, w2, h2, w3, h3; dc.GetTextExtent(stringFragment, & w1, & h1); dc.GetTextExtent(stringFragment2, & w2, & h2); dc.GetTextExtent(stringFragment3, & w3, & h3); - + int kerningDiff = (w1 + w3) - w2; x = x - kerningDiff; } @@ -4061,12 +4061,12 @@ bool wxRichTextPlainText::Draw(wxDC& dc, const wxRichTextRange& range, const wxR // Compensate for kerning difference wxString stringFragment2(m_text.Mid(s1 - offset, fragmentLen+1)); wxString stringFragment3(m_text.Mid(s1 - offset + fragmentLen, 1)); - + wxCoord w1, h1, w2, h2, w3, h3; dc.GetTextExtent(stringFragment, & w1, & h1); dc.GetTextExtent(stringFragment2, & w2, & h2); dc.GetTextExtent(stringFragment3, & w3, & h3); - + int kerningDiff = (w1 + w3) - w2; x = x - kerningDiff; } @@ -4243,14 +4243,14 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz tabArray = textAttr.GetTabs(); int tabCount = tabArray.GetCount(); - + for (int i = 0; i < tabCount; ++i) { int pos = tabArray[i]; pos = ((wxRichTextPlainText*) this)->ConvertTenthsMMToPixels(dc, pos); tabArray[i] = pos; } - + int nextTabPos = -1; while (stringChunk.Find(wxT('\t')) >= 0) @@ -4437,7 +4437,7 @@ bool wxRichTextBuffer::PushStyleSheet(wxRichTextStyleSheet* styleSheet) styleSheet->InsertSheet(m_styleSheet); SetStyleSheet(styleSheet); - + return true; } @@ -4449,7 +4449,7 @@ wxRichTextStyleSheet* wxRichTextBuffer::PopStyleSheet() wxRichTextStyleSheet* oldSheet = m_styleSheet; m_styleSheet = oldSheet->GetNextSheet(); oldSheet->Unlink(); - + return oldSheet; } else @@ -5146,6 +5146,8 @@ wxString wxRichTextBuffer::GetExtWildcard(bool combine, bool save, wxArrayInt* t /// Load a file bool wxRichTextBuffer::LoadFile(const wxString& filename, int type) + + { wxRichTextFileHandler* handler = FindHandlerFilenameOrType(filename, type); if (handler) @@ -7296,4 +7298,3 @@ bool wxRichTextBufferDataObject::SetData(size_t WXUNUSED(len), const void *buf) #endif // wxUSE_RICHTEXT - diff --git a/src/richtext/richtextbulletspage.cpp b/src/richtext/richtextbulletspage.cpp index c11d9a9b24..efad695f0b 100644 --- a/src/richtext/richtextbulletspage.cpp +++ b/src/richtext/richtextbulletspage.cpp @@ -165,7 +165,7 @@ void wxRichTextBulletsPage::CreateControls() itemBoxSizer11->Add(itemBoxSizer13, 0, wxGROW, 5); wxString* m_symbolCtrlStrings = NULL; - m_symbolCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, _T(""), wxDefaultPosition, wxSize(60, -1), 0, m_symbolCtrlStrings, wxCB_DROPDOWN ); + m_symbolCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0, m_symbolCtrlStrings, wxCB_DROPDOWN ); m_symbolCtrl->SetHelpText(_("The bullet character.")); if (ShowToolTips()) m_symbolCtrl->SetToolTip(_("The bullet character.")); @@ -183,7 +183,7 @@ void wxRichTextBulletsPage::CreateControls() itemBoxSizer11->Add(itemStaticText17, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); wxString* m_symbolFontCtrlStrings = NULL; - m_symbolFontCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_symbolFontCtrlStrings, wxCB_DROPDOWN ); + m_symbolFontCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTBULLETSPAGE_SYMBOLFONTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, m_symbolFontCtrlStrings, wxCB_DROPDOWN ); m_symbolFontCtrl->SetHelpText(_("Available fonts.")); if (ShowToolTips()) m_symbolFontCtrl->SetToolTip(_("Available fonts.")); @@ -402,7 +402,7 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n"); m_previewCtrl->BeginStyle(normalParaAttr); m_previewCtrl->WriteText(s_para1); m_previewCtrl->EndStyle(); - + m_previewCtrl->BeginStyle(attr); m_previewCtrl->WriteText(s_para2); m_previewCtrl->EndStyle(); diff --git a/src/richtext/richtextctrl.cpp b/src/richtext/richtextctrl.cpp index ad63479c42..58057e12a1 100644 --- a/src/richtext/richtextctrl.cpp +++ b/src/richtext/richtextctrl.cpp @@ -644,7 +644,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) event.Skip(); return; } - + if (keycode == wxT('\t')) { // See if we need to promote or demote the selection or paragraph at the cursor @@ -658,7 +658,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) range = GetSelectionRange(); else range = para->GetRange().FromInternal(); - + int promoteBy = event.ShiftDown() ? 1 : -1; PromoteList(promoteBy, range, NULL); @@ -2776,20 +2776,20 @@ bool wxRichTextCtrl::ApplyStyle(wxRichTextStyleDefinition* def) if (def->IsKindOf(CLASSINFO(wxRichTextListStyleDefinition))) { flags |= wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY; - + wxRichTextRange range; - + if (HasSelection()) range = GetSelectionRange(); else { - long pos = GetAdjustedCaretPosition(GetCaretPosition()); + long pos = GetAdjustedCaretPosition(GetCaretPosition()); range = wxRichTextRange(pos, pos+1); } - - return SetListStyle(range, (wxRichTextListStyleDefinition*) def, flags); - } - + + return SetListStyle(range, (wxRichTextListStyleDefinition*) def, flags); + } + // Make sure the attr has the style name if (def->IsKindOf(CLASSINFO(wxRichTextParagraphStyleDefinition))) { @@ -2916,12 +2916,12 @@ bool wxRichTextCtrl::ClearListStyle(const wxRichTextRange& range, int flags) /// Number/renumber any list elements in the given range bool wxRichTextCtrl::NumberList(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags, int startFrom, int specifiedLevel) { - return GetBuffer().NumberList(range.ToInternal(), def, flags, startFrom, specifiedLevel); + return GetBuffer().NumberList(range.ToInternal(), def, flags, startFrom, specifiedLevel); } bool wxRichTextCtrl::NumberList(const wxRichTextRange& range, const wxString& defName, int flags, int startFrom, int specifiedLevel) { - return GetBuffer().NumberList(range.ToInternal(), defName, flags, startFrom, specifiedLevel); + return GetBuffer().NumberList(range.ToInternal(), defName, flags, startFrom, specifiedLevel); } /// Promote the list items within the given range. promoteBy can be a positive or negative number, e.g. 1 or -1 @@ -2952,4 +2952,3 @@ void wxRichTextCtrl::ClearAvailableFontNames() #endif // wxUSE_RICHTEXT - diff --git a/src/richtext/richtextfontpage.cpp b/src/richtext/richtextfontpage.cpp index b6c2f58aa0..fc220dd740 100644 --- a/src/richtext/richtextfontpage.cpp +++ b/src/richtext/richtextfontpage.cpp @@ -9,7 +9,7 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#include "../../include/wx/richtext/richtextfontpage.h" +#include "wx/richtext/richtextfontpage.h" /*! * wxRichTextFontPage type definition @@ -122,7 +122,7 @@ void wxRichTextFontPage::CreateControls() wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Font:"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - m_faceTextCtrl = new wxTextCtrl( itemPanel1, ID_RICHTEXTFONTPAGE_FACETEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); + m_faceTextCtrl = new wxTextCtrl( itemPanel1, ID_RICHTEXTFONTPAGE_FACETEXTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_faceTextCtrl->SetHelpText(_("Type a font name.")); if (ShowToolTips()) m_faceTextCtrl->SetToolTip(_("Type a font name.")); @@ -140,7 +140,7 @@ void wxRichTextFontPage::CreateControls() wxStaticText* itemStaticText10 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Size:"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer9->Add(itemStaticText10, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - m_sizeTextCtrl = new wxTextCtrl( itemPanel1, ID_RICHTEXTFONTPAGE_SIZETEXTCTRL, _T(""), wxDefaultPosition, wxSize(50, -1), 0 ); + m_sizeTextCtrl = new wxTextCtrl( itemPanel1, ID_RICHTEXTFONTPAGE_SIZETEXTCTRL, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 ); m_sizeTextCtrl->SetHelpText(_("Type a size in points.")); if (ShowToolTips()) m_sizeTextCtrl->SetToolTip(_("Type a size in points.")); @@ -163,7 +163,7 @@ void wxRichTextFontPage::CreateControls() itemBoxSizer14->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); wxString* m_styleCtrlStrings = NULL; - m_styleCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTFONTPAGE_STYLECTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_styleCtrlStrings, wxCB_READONLY ); + m_styleCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTFONTPAGE_STYLECTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, m_styleCtrlStrings, wxCB_READONLY ); m_styleCtrl->SetHelpText(_("Select regular or italic style.")); if (ShowToolTips()) m_styleCtrl->SetToolTip(_("Select regular or italic style.")); @@ -176,7 +176,7 @@ void wxRichTextFontPage::CreateControls() itemBoxSizer17->Add(itemStaticText18, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); wxString* m_weightCtrlStrings = NULL; - m_weightCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTFONTPAGE_WEIGHTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_weightCtrlStrings, wxCB_READONLY ); + m_weightCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTFONTPAGE_WEIGHTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, m_weightCtrlStrings, wxCB_READONLY ); m_weightCtrl->SetHelpText(_("Select regular or bold.")); if (ShowToolTips()) m_weightCtrl->SetToolTip(_("Select regular or bold.")); @@ -189,7 +189,7 @@ void wxRichTextFontPage::CreateControls() itemBoxSizer20->Add(itemStaticText21, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); wxString* m_underliningCtrlStrings = NULL; - m_underliningCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_underliningCtrlStrings, wxCB_READONLY ); + m_underliningCtrl = new wxComboBox( itemPanel1, ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, m_underliningCtrlStrings, wxCB_READONLY ); m_underliningCtrl->SetHelpText(_("Select underlining or no underlining.")); if (ShowToolTips()) m_underliningCtrl->SetToolTip(_("Select underlining or no underlining.")); diff --git a/src/richtext/richtextformatdlg.cpp b/src/richtext/richtextformatdlg.cpp index 13a7d85a84..bfe3c2565c 100644 --- a/src/richtext/richtextformatdlg.cpp +++ b/src/richtext/richtextformatdlg.cpp @@ -248,7 +248,7 @@ bool wxRichTextFormattingDialogFactory::CreatePages(long pages, wxRichTextFormat int imageIndex = GetPageImage(pageId); dialog->GetBookCtrl()->AddPage(panel, title, !selected, imageIndex); selected = true; - + dialog->AddPageId(pageId); } } diff --git a/src/richtext/richtextindentspage.cpp b/src/richtext/richtextindentspage.cpp index 600d5f4d63..3d9a15f986 100644 --- a/src/richtext/richtextindentspage.cpp +++ b/src/richtext/richtextindentspage.cpp @@ -205,7 +205,7 @@ void wxRichTextIndentsSpacingPage::CreateControls() wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxHORIZONTAL); itemFlexGridSizer22->Add(itemBoxSizer24, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); - m_indentLeft = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT, _T(""), wxDefaultPosition, wxSize(50, -1), 0 ); + m_indentLeft = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 ); m_indentLeft->SetHelpText(_("The left indent.")); if (ShowToolTips()) m_indentLeft->SetToolTip(_("The left indent.")); @@ -217,7 +217,7 @@ void wxRichTextIndentsSpacingPage::CreateControls() wxBoxSizer* itemBoxSizer27 = new wxBoxSizer(wxHORIZONTAL); itemFlexGridSizer22->Add(itemBoxSizer27, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); - m_indentLeftFirst = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST, _T(""), wxDefaultPosition, wxSize(50, -1), 0 ); + m_indentLeftFirst = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_LEFT_FIRST, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 ); m_indentLeftFirst->SetHelpText(_("The first line indent.")); if (ShowToolTips()) m_indentLeftFirst->SetToolTip(_("The first line indent.")); @@ -229,7 +229,7 @@ void wxRichTextIndentsSpacingPage::CreateControls() 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, _T(""), wxDefaultPosition, wxSize(50, -1), 0 ); + m_indentRight = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_INDENT_RIGHT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 ); m_indentRight->SetHelpText(_("The right indent.")); if (ShowToolTips()) m_indentRight->SetToolTip(_("The right indent.")); @@ -262,7 +262,7 @@ void wxRichTextIndentsSpacingPage::CreateControls() wxBoxSizer* itemBoxSizer41 = new wxBoxSizer(wxHORIZONTAL); itemFlexGridSizer39->Add(itemBoxSizer41, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); - m_spacingBefore = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE, _T(""), wxDefaultPosition, wxSize(50, -1), 0 ); + m_spacingBefore = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_BEFORE, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 ); m_spacingBefore->SetHelpText(_("The spacing before the paragraph.")); if (ShowToolTips()) m_spacingBefore->SetToolTip(_("The spacing before the paragraph.")); @@ -274,7 +274,7 @@ void wxRichTextIndentsSpacingPage::CreateControls() wxBoxSizer* itemBoxSizer44 = new wxBoxSizer(wxHORIZONTAL); itemFlexGridSizer39->Add(itemBoxSizer44, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); - m_spacingAfter = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER, _T(""), wxDefaultPosition, wxSize(50, -1), 0 ); + m_spacingAfter = new wxTextCtrl( itemPanel1, ID_RICHTEXTINDENTSSPACINGPAGE_SPACING_AFTER, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 ); if (ShowToolTips()) m_spacingAfter->SetToolTip(_("The spacing after the paragraph.")); itemBoxSizer44->Add(m_spacingAfter, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); diff --git a/src/richtext/richtextliststylepage.cpp b/src/richtext/richtextliststylepage.cpp index 8497d52a05..b50a379f77 100644 --- a/src/richtext/richtextliststylepage.cpp +++ b/src/richtext/richtextliststylepage.cpp @@ -1,15 +1,15 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: richtextliststylepage.cpp -// Purpose: +// Name: src/richtext/richtextliststylepage.cpp +// Purpose: // Author: Julian Smart -// Modified by: +// Modified by: // Created: 10/18/2006 11:36:37 AM -// RCS-ID: +// RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#include "../../include/wx/richtext/richtextliststylepage.h" +#include "wx/richtext/richtextliststylepage.h" ////@begin XPM images ////@end XPM images @@ -117,7 +117,7 @@ bool wxRichTextListStylePage::Create( wxWindow* parent, wxWindowID id, const wxP } /*! - * Member initialisation + * Member initialisation */ void wxRichTextListStylePage::Init() @@ -151,7 +151,7 @@ void wxRichTextListStylePage::Init() */ void wxRichTextListStylePage::CreateControls() -{ +{ ////@begin wxRichTextListStylePage content construction wxRichTextListStylePage* itemPanel1 = this; @@ -216,7 +216,7 @@ void wxRichTextListStylePage::CreateControls() wxBoxSizer* itemBoxSizer21 = new wxBoxSizer(wxHORIZONTAL); itemBoxSizer19->Add(itemBoxSizer21, 0, wxGROW, 5); wxString* m_symbolCtrlStrings = NULL; - m_symbolCtrl = new wxComboBox( itemPanel10, ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, _T(""), wxDefaultPosition, wxSize(60, -1), 0, m_symbolCtrlStrings, wxCB_DROPDOWN ); + m_symbolCtrl = new wxComboBox( itemPanel10, ID_RICHTEXTBULLETSPAGE_SYMBOLCTRL, wxEmptyString, wxDefaultPosition, wxSize(60, -1), 0, m_symbolCtrlStrings, wxCB_DROPDOWN ); m_symbolCtrl->SetHelpText(_("The bullet character.")); if (ShowToolTips()) m_symbolCtrl->SetToolTip(_("The bullet character.")); @@ -234,7 +234,7 @@ void wxRichTextListStylePage::CreateControls() itemBoxSizer19->Add(itemStaticText25, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); wxString* m_symbolFontCtrlStrings = NULL; - m_symbolFontCtrl = new wxComboBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_symbolFontCtrlStrings, wxCB_DROPDOWN ); + m_symbolFontCtrl = new wxComboBox( itemPanel10, ID_RICHTEXTLISTSTYLEPAGE_SYMBOLFONTCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, m_symbolFontCtrlStrings, wxCB_DROPDOWN ); if (ShowToolTips()) m_symbolFontCtrl->SetToolTip(_("Available fonts.")); itemBoxSizer19->Add(m_symbolFontCtrl, 0, wxGROW|wxALL, 5); @@ -339,7 +339,7 @@ void wxRichTextListStylePage::CreateControls() wxBoxSizer* itemBoxSizer55 = new wxBoxSizer(wxHORIZONTAL); itemFlexGridSizer53->Add(itemBoxSizer55, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); - m_indentLeft = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT, _T(""), wxDefaultPosition, wxSize(50, -1), 0 ); + m_indentLeft = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_INDENTLEFT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 ); m_indentLeft->SetHelpText(_("The left indent.")); if (ShowToolTips()) m_indentLeft->SetToolTip(_("The left indent.")); @@ -350,7 +350,7 @@ void wxRichTextListStylePage::CreateControls() wxBoxSizer* itemBoxSizer58 = new wxBoxSizer(wxHORIZONTAL); itemFlexGridSizer53->Add(itemBoxSizer58, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); - m_indentLeftFirst = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE, _T(""), wxDefaultPosition, wxSize(50, -1), 0 ); + m_indentLeftFirst = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_INDENTFIRSTLINE, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 ); m_indentLeftFirst->SetHelpText(_("The first line indent.")); if (ShowToolTips()) m_indentLeftFirst->SetToolTip(_("The first line indent.")); @@ -361,7 +361,7 @@ void wxRichTextListStylePage::CreateControls() wxBoxSizer* itemBoxSizer61 = new wxBoxSizer(wxHORIZONTAL); itemFlexGridSizer53->Add(itemBoxSizer61, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); - m_indentRight = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT, _T(""), wxDefaultPosition, wxSize(50, -1), 0 ); + m_indentRight = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_INDENTRIGHT, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 ); m_indentRight->SetHelpText(_("The right indent.")); if (ShowToolTips()) m_indentRight->SetToolTip(_("The right indent.")); @@ -390,7 +390,7 @@ void wxRichTextListStylePage::CreateControls() wxBoxSizer* itemBoxSizer72 = new wxBoxSizer(wxHORIZONTAL); itemFlexGridSizer70->Add(itemBoxSizer72, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); - m_spacingBefore = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE, _T(""), wxDefaultPosition, wxSize(50, -1), 0 ); + m_spacingBefore = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_SPACINGBEFORE, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 ); m_spacingBefore->SetHelpText(_("The spacing before the paragraph.")); if (ShowToolTips()) m_spacingBefore->SetToolTip(_("The spacing before the paragraph.")); @@ -401,7 +401,7 @@ void wxRichTextListStylePage::CreateControls() wxBoxSizer* itemBoxSizer75 = new wxBoxSizer(wxHORIZONTAL); itemFlexGridSizer70->Add(itemBoxSizer75, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); - m_spacingAfter = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER, _T(""), wxDefaultPosition, wxSize(50, -1), 0 ); + m_spacingAfter = new wxTextCtrl( itemPanel33, ID_RICHTEXTLISTSTYLEPAGE_SPACINGAFTER, wxEmptyString, wxDefaultPosition, wxSize(50, -1), 0 ); m_spacingAfter->SetHelpText(_("The spacing after the paragraph.")); if (ShowToolTips()) m_spacingAfter->SetToolTip(_("The spacing after the paragraph.")); @@ -470,7 +470,7 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n"); wxRichTextListStyleDefinition* def = wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this), wxRichTextListStyleDefinition); - + wxTextAttrEx attr(def->GetStyle()); 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| @@ -491,9 +491,9 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n"); m_previewCtrl->BeginStyle(normalParaAttr); m_previewCtrl->WriteText(s_para1); m_previewCtrl->EndStyle(); - + m_previewCtrl->BeginStyle(attr); - + int i; for (i = 0; i < 10; i++) { @@ -618,7 +618,7 @@ bool wxRichTextListStylePage::TransferDataFromWindow() attr->SetBulletSymbol(c); attr->SetBulletFont(m_symbolFontCtrl->GetValue()); } - + return true; } @@ -626,7 +626,7 @@ bool wxRichTextListStylePage::TransferDataToWindow() { DoTransferDataToWindow(); UpdatePreview(); - + return true; } @@ -636,7 +636,7 @@ void wxRichTextListStylePage::DoTransferDataToWindow() m_dontUpdate = true; wxPanel::TransferDataToWindow(); - + m_levelCtrl->SetValue(m_currentLevel); wxTextAttrEx* attr = GetAttributesForSelection(); @@ -769,9 +769,9 @@ wxTextAttrEx* wxRichTextListStylePage::GetAttributesForSelection() { wxRichTextListStyleDefinition* def = wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this), wxRichTextListStyleDefinition); - + int value = m_levelCtrl->GetValue(); - + if (def) return def->GetLevelAttributes(value-1); else @@ -853,7 +853,7 @@ void wxRichTextListStylePage::OnLevelUIUpdate( wxUpdateUIEvent& event ) ////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage. // Before editing this code, remove the block markers. event.Skip(); -////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage. +////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_LEVEL in wxRichTextListStylePage. } /*! @@ -982,7 +982,7 @@ void wxRichTextListStylePage::OnParenthesesctrlUpdate( wxUpdateUIEvent& event ) ////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL in wxRichTextListStylePage. // Before editing this code, remove the block markers. event.Skip(); -////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL in wxRichTextListStylePage. +////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE__PARENTHESESCTRL in wxRichTextListStylePage. } /*! @@ -1003,7 +1003,7 @@ void wxRichTextListStylePage::OnPeriodctrlUpdate( wxUpdateUIEvent& event ) ////@begin wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL in wxRichTextListStylePage. // Before editing this code, remove the block markers. event.Skip(); -////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL in wxRichTextListStylePage. +////@end wxEVT_UPDATE_UI event handler for ID_RICHTEXTLISTSTYLEPAGE_PERIODCTRL in wxRichTextListStylePage. } /*! @@ -1173,5 +1173,3 @@ void wxRichTextListStylePage::OnChooseFontClick( wxCommandEvent& WXUNUSED(event) TransferAndPreview(); } } - - diff --git a/src/richtext/richtextstyledlg.cpp b/src/richtext/richtextstyledlg.cpp index d8ed49fd09..0f6d2ebcc2 100644 --- a/src/richtext/richtextstyledlg.cpp +++ b/src/richtext/richtextstyledlg.cpp @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: richtextstyledlg.cpp -// Purpose: +// Name: src/richtext/richtextstyledlg.cpp +// Purpose: // Author: Julian Smart -// Modified by: +// Modified by: // Created: 10/5/2006 12:05:31 PM -// RCS-ID: +// RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx/wx.h". @@ -97,7 +97,7 @@ void wxRichTextStyleOrganiserDialog::Init() m_dontUpdate = false; m_flags = 0; m_restartNumbering = true; - + ////@begin wxRichTextStyleOrganiserDialog member initialisation m_innerSizer = NULL; m_buttonSizerParent = NULL; @@ -113,6 +113,7 @@ void wxRichTextStyleOrganiserDialog::Init() m_deleteStyle = NULL; m_closeButton = NULL; m_bottomButtonSizer = NULL; + m_restartNumberingCtrl = NULL; m_okButton = NULL; m_cancelButton = NULL; @@ -128,7 +129,7 @@ bool wxRichTextStyleOrganiserDialog::Create( int flags, wxRichTextStyleSheet* sh m_richTextStyleSheet = sheet; m_richTextCtrl = ctrl; m_flags = flags; - + ////@begin wxRichTextStyleOrganiserDialog creation SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS|wxDIALOG_EX_CONTEXTHELP); wxDialog::Create( parent, id, caption, pos, size, style ); @@ -148,10 +149,10 @@ bool wxRichTextStyleOrganiserDialog::Create( int flags, wxRichTextStyleSheet* sh */ void wxRichTextStyleOrganiserDialog::CreateControls() -{ +{ bool hideTypeSelector = false; wxRichTextStyleListBox::wxRichTextStyleType typesToShow = wxRichTextStyleListBox::wxRICHTEXT_STYLE_ALL; - + if ((m_flags & wxRICHTEXT_ORGANISER_SHOW_CHARACTER) != 0) { typesToShow = wxRichTextStyleListBox::wxRICHTEXT_STYLE_CHARACTER; @@ -171,11 +172,11 @@ void wxRichTextStyleOrganiserDialog::CreateControls() { // wxRICHTEXT_ORGANISER_SHOW_ALL is implied if the other styles aren't included } - + long listCtrlStyle = 0; if (hideTypeSelector) listCtrlStyle = wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR; - + ////@begin wxRichTextStyleOrganiserDialog content construction wxRichTextStyleOrganiserDialog* itemDialog1 = this; @@ -340,18 +341,18 @@ void wxRichTextStyleOrganiserDialog::CreateControls() { m_buttonSizerParent->Show(m_buttonSizer, false); } - + // No buttons in the horizontal group are shown, so hide the whole sizer if ((m_flags & (wxRICHTEXT_ORGANISER_OK_CANCEL|wxRICHTEXT_ORGANISER_RENUMBER)) == 0) { m_innerSizer->Show(m_bottomButtonSizer, false); } - + if (hideTypeSelector) { m_stylesListBox->GetStyleListBox()->SetStyleType(typesToShow); } - + m_stylesListBox->SetStyleSheet(m_richTextStyleSheet); m_stylesListBox->SetRichTextCtrl(m_richTextCtrl); m_stylesListBox->UpdateStyles(); @@ -389,9 +390,9 @@ bool wxRichTextStyleOrganiserDialog::TransferDataFromWindow() { if (!wxDialog::TransferDataFromWindow()) return false; - + m_restartNumbering = m_restartNumberingCtrl->GetValue(); - + return true; } @@ -399,9 +400,9 @@ bool wxRichTextStyleOrganiserDialog::TransferDataToWindow() { if (!wxDialog::TransferDataToWindow()) return false; - + m_restartNumberingCtrl->SetValue(m_restartNumbering); - + return true; } @@ -423,15 +424,15 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n"); { sel = m_stylesListBox->GetStyleListBox()->GetSelection(); if (sel == -1) - return; + return; } wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel); - + wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition); //wxRichTextParagraphStyleDefinition* paraDef = wxDynamicCast(def, wxRichTextParagraphStyleDefinition); - //wxRichTextCharacterStyleDefinition* charDef = wxDynamicCast(def, wxRichTextCharacterStyleDefinition); - + //wxRichTextCharacterStyleDefinition* charDef = wxDynamicCast(def, wxRichTextCharacterStyleDefinition); + wxTextAttrEx attr(def->GetStyle()); #if 0 attr.SetFlags(attr.GetFlags() & @@ -449,14 +450,14 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n"); normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY"))); m_previewCtrl->Freeze(); - m_previewCtrl->Clear(); + m_previewCtrl->Clear(); m_previewCtrl->BeginStyle(normalParaAttr); m_previewCtrl->WriteText(s_para1); m_previewCtrl->EndStyle(); - + m_previewCtrl->BeginStyle(attr); - + if (listDef) { int i; @@ -473,7 +474,7 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n"); { m_previewCtrl->WriteText(wxString(wxT("\n")) + s_para2); } - + m_previewCtrl->EndStyle(); m_previewCtrl->BeginStyle(normalParaAttr); @@ -482,7 +483,7 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n"); m_previewCtrl->Thaw(); } - + /// Clears the preview void wxRichTextStyleOrganiserDialog::ClearPreview() { @@ -500,9 +501,9 @@ bool wxRichTextStyleOrganiserDialog::ApplyStyle(wxRichTextCtrl* ctrl) return false; if (!ctrl->HasSelection()) return false; - - wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel); + + wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel); wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition); if (listDef && m_restartNumberingCtrl->GetValue()) @@ -575,9 +576,9 @@ void wxRichTextStyleOrganiserDialog::OnNewCharClick( wxCommandEvent& WXUNUSED(ev wxMessageBox(_("Sorry, that name is taken. Please choose another."), _("New Style"), wxICON_EXCLAMATION|wxOK, this); return; } - + wxRichTextCharacterStyleDefinition* style = new wxRichTextCharacterStyleDefinition(styleName); - + int pages = wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_STYLE_EDITOR; wxRichTextFormattingDialog formatDlg; formatDlg.SetStyleDefinition(*style, GetStyleSheet()); @@ -586,9 +587,9 @@ void wxRichTextStyleOrganiserDialog::OnNewCharClick( wxCommandEvent& WXUNUSED(ev if (formatDlg.ShowModal() == wxID_OK) { wxRichTextCharacterStyleDefinition* charDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextCharacterStyleDefinition); - + (*((wxRichTextCharacterStyleDefinition* ) style)) = (*charDef); - + GetStyleSheet()->AddCharacterStyle(style); m_stylesListBox->UpdateStyles(); @@ -596,7 +597,7 @@ void wxRichTextStyleOrganiserDialog::OnNewCharClick( wxCommandEvent& WXUNUSED(ev } else delete style; - } + } } /*! @@ -623,9 +624,9 @@ void wxRichTextStyleOrganiserDialog::OnNewParaClick( wxCommandEvent& WXUNUSED(ev wxMessageBox(_("Sorry, that name is taken. Please choose another."), _("New Style"), wxICON_EXCLAMATION|wxOK, this); return; } - + wxRichTextParagraphStyleDefinition* style = new wxRichTextParagraphStyleDefinition(styleName); - + int pages = wxRICHTEXT_FORMAT_STYLE_EDITOR|wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING|wxRICHTEXT_FORMAT_TABS|wxRICHTEXT_FORMAT_BULLETS; wxRichTextFormattingDialog formatDlg; formatDlg.SetStyleDefinition(*style, GetStyleSheet()); @@ -634,9 +635,9 @@ void wxRichTextStyleOrganiserDialog::OnNewParaClick( wxCommandEvent& WXUNUSED(ev if (formatDlg.ShowModal() == wxID_OK) { wxRichTextParagraphStyleDefinition* paraDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextParagraphStyleDefinition); - + (*((wxRichTextParagraphStyleDefinition* ) style)) = (*paraDef); - + GetStyleSheet()->AddParagraphStyle(style); m_stylesListBox->UpdateStyles(); @@ -644,7 +645,7 @@ void wxRichTextStyleOrganiserDialog::OnNewParaClick( wxCommandEvent& WXUNUSED(ev } else delete style; - } + } } /*! @@ -667,9 +668,9 @@ void wxRichTextStyleOrganiserDialog::OnEditClick( wxCommandEvent& WXUNUSED(event if (sel != wxNOT_FOUND) { wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel); - + int pages = wxRICHTEXT_FORMAT_STYLE_EDITOR; - + if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition))) { pages |= wxRICHTEXT_FORMAT_FONT; @@ -682,7 +683,7 @@ void wxRichTextStyleOrganiserDialog::OnEditClick( wxCommandEvent& WXUNUSED(event { pages |= wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING|wxRICHTEXT_FORMAT_TABS|wxRICHTEXT_FORMAT_BULLETS; } - + wxRichTextFormattingDialog formatDlg; formatDlg.SetStyleDefinition(*def, GetStyleSheet()); formatDlg.Create(pages, this); @@ -692,7 +693,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); - + if (listDef) { (*((wxRichTextListStyleDefinition* ) def)) = (*listDef); @@ -736,14 +737,14 @@ void wxRichTextStyleOrganiserDialog::OnDeleteClick( wxCommandEvent& WXUNUSED(eve if (wxYES == wxMessageBox(wxString::Format(_("Delete style %s?"), (const wxChar*) name), _("Delete Style"), wxYES_NO|wxICON_QUESTION, this)) { m_stylesListBox->GetStyleListBox()->SetItemCount(0); - + if (def->IsKindOf(CLASSINFO(wxRichTextListStyleDefinition))) GetStyleSheet()->RemoveListStyle((wxRichTextListStyleDefinition*) def, true); else if (def->IsKindOf(CLASSINFO(wxRichTextParagraphStyleDefinition))) GetStyleSheet()->RemoveParagraphStyle((wxRichTextParagraphStyleDefinition*) def, true); else if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition))) GetStyleSheet()->RemoveCharacterStyle((wxRichTextCharacterStyleDefinition*) def, true); - + m_stylesListBox->UpdateStyles(); if (m_stylesListBox->GetStyleListBox()->GetSelection() != -1) @@ -777,9 +778,9 @@ void wxRichTextStyleOrganiserDialog::OnNewListClick( wxCommandEvent& WXUNUSED(ev wxMessageBox(_("Sorry, that name is taken. Please choose another."), _("New Style"), wxICON_EXCLAMATION|wxOK, this); return; } - + wxRichTextListStyleDefinition* style = new wxRichTextListStyleDefinition(styleName); - + // Initialize the style to make it easier to edit int i; for (i = 0; i < 10; i++) @@ -798,7 +799,7 @@ void wxRichTextStyleOrganiserDialog::OnNewListClick( wxCommandEvent& WXUNUSED(ev style->SetAttributes(i, (i+1)*60, 60, wxTEXT_ATTR_BULLET_STYLE_SYMBOL, bulletSymbol); } - + int pages = wxRICHTEXT_FORMAT_LIST_STYLE|wxRICHTEXT_FORMAT_STYLE_EDITOR|wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING; wxRichTextFormattingDialog formatDlg; formatDlg.SetStyleDefinition(*style, GetStyleSheet()); @@ -807,9 +808,9 @@ void wxRichTextStyleOrganiserDialog::OnNewListClick( wxCommandEvent& WXUNUSED(ev if (formatDlg.ShowModal() == wxID_OK) { wxRichTextListStyleDefinition* listDef = wxDynamicCast(formatDlg.GetStyleDefinition(), wxRichTextListStyleDefinition); - + (*((wxRichTextListStyleDefinition* ) style)) = (*listDef); - + GetStyleSheet()->AddListStyle(style); m_stylesListBox->UpdateStyles(); @@ -817,7 +818,7 @@ void wxRichTextStyleOrganiserDialog::OnNewListClick( wxCommandEvent& WXUNUSED(ev } else delete style; - } + } } /*! @@ -854,4 +855,3 @@ void wxRichTextStyleOrganiserDialog::OnListSelection(wxCommandEvent& event) else event.Skip(); } - diff --git a/src/richtext/richtextstylepage.cpp b/src/richtext/richtextstylepage.cpp index 7951dc02af..92e54f8489 100644 --- a/src/richtext/richtextstylepage.cpp +++ b/src/richtext/richtextstylepage.cpp @@ -103,7 +103,7 @@ void wxRichTextStylePage::CreateControls() wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Style:"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - m_styleName = new wxTextCtrl( itemPanel1, ID_RICHTEXTSTYLEPAGE_STYLE_NAME, _T(""), wxDefaultPosition, wxSize(300, -1), wxTE_READONLY ); + m_styleName = new wxTextCtrl( itemPanel1, ID_RICHTEXTSTYLEPAGE_STYLE_NAME, wxEmptyString, wxDefaultPosition, wxSize(300, -1), wxTE_READONLY ); m_styleName->SetHelpText(_("The style name.")); if (ShowToolTips()) m_styleName->SetToolTip(_("The style name.")); @@ -113,7 +113,7 @@ void wxRichTextStylePage::CreateControls() itemBoxSizer5->Add(itemStaticText8, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); wxString* m_basedOnStrings = NULL; - m_basedOn = new wxComboBox( itemPanel1, ID_RICHTEXTSTYLEPAGE_BASED_ON, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_basedOnStrings, wxCB_DROPDOWN ); + m_basedOn = new wxComboBox( itemPanel1, ID_RICHTEXTSTYLEPAGE_BASED_ON, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, m_basedOnStrings, wxCB_DROPDOWN ); m_basedOn->SetHelpText(_("The style on which this style is based.")); if (ShowToolTips()) m_basedOn->SetToolTip(_("The style on which this style is based.")); @@ -123,7 +123,7 @@ void wxRichTextStylePage::CreateControls() itemBoxSizer5->Add(itemStaticText10, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); wxString* m_nextStyleStrings = NULL; - m_nextStyle = new wxComboBox( itemPanel1, ID_RICHTEXTSTYLEPAGE_NEXT_STYLE, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_nextStyleStrings, wxCB_DROPDOWN ); + m_nextStyle = new wxComboBox( itemPanel1, ID_RICHTEXTSTYLEPAGE_NEXT_STYLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, m_nextStyleStrings, wxCB_DROPDOWN ); m_nextStyle->SetHelpText(_("The default style for the next paragraph.")); if (ShowToolTips()) m_nextStyle->SetToolTip(_("The default style for the next paragraph.")); @@ -145,7 +145,7 @@ bool wxRichTextStylePage::TransferDataFromWindow() wxRichTextParagraphStyleDefinition* paraDef = wxDynamicCast(def, wxRichTextParagraphStyleDefinition); if (paraDef) paraDef->SetNextStyle(m_nextStyle->GetValue()); - + def->SetName(m_styleName->GetValue()); def->SetBaseStyle(m_basedOn->GetValue()); } @@ -164,9 +164,9 @@ bool wxRichTextStylePage::TransferDataToWindow() wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition); // wxRichTextCharacterStyleDefinition* charDef = wxDynamicCast(def, wxRichTextCharacterStyleDefinition); wxRichTextStyleSheet* sheet = wxRichTextFormattingDialog::GetDialog(this)->GetStyleSheet(); - + m_styleName->SetValue(def->GetName()); - + if (listDef) { if (m_nextStyle->GetCount() == 0) @@ -201,7 +201,7 @@ bool wxRichTextStylePage::TransferDataToWindow() } m_nextStyle->SetValue(paraDef->GetNextStyle()); } - + if (m_basedOn->GetCount() == 0) { if (sheet) @@ -238,7 +238,7 @@ bool wxRichTextStylePage::TransferDataToWindow() } } } - + m_basedOn->SetValue(def->GetBaseStyle()); } diff --git a/src/richtext/richtextstyles.cpp b/src/richtext/richtextstyles.cpp index 556e555f20..e40229b843 100644 --- a/src/richtext/richtextstyles.cpp +++ b/src/richtext/richtextstyles.cpp @@ -75,7 +75,7 @@ bool wxRichTextParagraphStyleDefinition::operator ==(const wxRichTextParagraphSt void wxRichTextListStyleDefinition::Copy(const wxRichTextListStyleDefinition& def) { wxRichTextParagraphStyleDefinition::Copy(def); - + int i; for (i = 0; i < 10; i++) m_levelStyles[i] = def.m_levelStyles[i]; @@ -89,7 +89,7 @@ bool wxRichTextListStyleDefinition::operator ==(const wxRichTextListStyleDefinit for (i = 0; i < 10; i++) if (!(m_levelStyles[i] == def.m_levelStyles[i])) return false; - + return true; } @@ -126,15 +126,15 @@ void wxRichTextListStyleDefinition::SetAttributes(int i, int leftIndent, int lef if (i >= 0 && i < 10) { wxTextAttrEx attr; - + attr.SetBulletStyle(bulletStyle); attr.SetLeftIndent(leftIndent, leftSubIndent); if (!bulletSymbol.IsEmpty()) attr.SetBulletSymbol(bulletSymbol[0]); - - m_levelStyles[i] = attr; - } + + m_levelStyles[i] = attr; + } } /// Finds the level corresponding to the given indentation @@ -159,20 +159,20 @@ int wxRichTextListStyleDefinition::FindLevelForIndent(int indent) const wxTextAttrEx wxRichTextListStyleDefinition::CombineWithParagraphStyle(int indent, const wxTextAttrEx& paraStyle) { int listLevel = FindLevelForIndent(indent); - + wxTextAttrEx attr(*GetLevelAttributes(listLevel)); int oldLeftIndent = attr.GetLeftIndent(); int oldLeftSubIndent = attr.GetLeftSubIndent(); - // First apply the overall paragraph style, if any + // First apply the overall paragraph style, if any wxRichTextApplyStyle(attr, GetStyle()); // Then apply paragraph style, e.g. from paragraph style definition wxRichTextApplyStyle(attr, paraStyle); - + // We override the indents according to the list definition attr.SetLeftIndent(oldLeftIndent, oldLeftSubIndent); - + return attr; } @@ -192,12 +192,12 @@ wxTextAttrEx wxRichTextListStyleDefinition::GetCombinedStyleForLevel(int listLev int oldLeftIndent = attr.GetLeftIndent(); int oldLeftSubIndent = attr.GetLeftSubIndent(); - // Apply the overall paragraph style, if any + // Apply the overall paragraph style, if any wxRichTextApplyStyle(attr, GetStyle()); // We override the indents according to the list definition attr.SetLeftIndent(oldLeftIndent, oldLeftSubIndent); - + return attr; } @@ -221,10 +221,10 @@ wxRichTextStyleSheet::~wxRichTextStyleSheet() if (m_nextSheet) m_nextSheet->m_previousSheet = m_previousSheet; - + if (m_previousSheet) m_previousSheet->m_nextSheet = m_nextSheet; - + m_previousSheet = NULL; m_nextSheet = NULL; } @@ -269,7 +269,7 @@ wxRichTextStyleDefinition* wxRichTextStyleSheet::FindStyle(const wxList& list, c if (def->GetName().Lower() == name.Lower()) return def; } - + if (m_nextSheet && recurse) return m_nextSheet->FindStyle(list, name, recurse); @@ -289,7 +289,7 @@ bool wxRichTextStyleSheet::InsertSheet(wxRichTextStyleSheet* before) { m_previousSheet = before->m_previousSheet; m_nextSheet = before; - + before->m_previousSheet = this; return true; } @@ -302,12 +302,12 @@ bool wxRichTextStyleSheet::AppendSheet(wxRichTextStyleSheet* after) { last = last->m_nextSheet; } - + if (last) { m_previousSheet = last; last->m_nextSheet = this; - + return true; } else @@ -321,7 +321,7 @@ void wxRichTextStyleSheet::Unlink() m_previousSheet->m_nextSheet = m_nextSheet; if (m_nextSheet) m_nextSheet->m_previousSheet = m_previousSheet; - + m_previousSheet = NULL; m_nextSheet = NULL; } @@ -416,7 +416,7 @@ wxString wxRichTextStyleListBox::OnGetItem(size_t n) const { if (!GetStyleSheet()) return wxEmptyString; - + wxRichTextStyleDefinition* def = GetStyle(n); if (def) return CreateHTML(def); @@ -453,7 +453,7 @@ wxRichTextStyleDefinition* wxRichTextStyleListBox::GetStyle(size_t i) const else if ((GetStyleType() == wxRICHTEXT_STYLE_LIST) && (i < GetStyleSheet()->GetListStyleCount())) { return GetStyleSheet()->GetListStyle(i); - } + } return NULL; } @@ -464,7 +464,7 @@ void wxRichTextStyleListBox::UpdateStyles() if (GetStyleSheet()) { SetSelection(wxNOT_FOUND); - + if (GetStyleType() == wxRICHTEXT_STYLE_ALL) SetItemCount(GetStyleSheet()->GetParagraphStyleCount()+GetStyleSheet()->GetCharacterStyleCount()+GetStyleSheet()->GetListStyleCount()); else if (GetStyleType() == wxRICHTEXT_STYLE_PARAGRAPH) @@ -473,14 +473,14 @@ void wxRichTextStyleListBox::UpdateStyles() SetItemCount(GetStyleSheet()->GetCharacterStyleCount()); else if (GetStyleType() == wxRICHTEXT_STYLE_LIST) SetItemCount(GetStyleSheet()->GetListStyleCount()); - + Refresh(); if (GetItemCount() > 0) { SetSelection(0); SendSelectedEvent(); - } + } } } @@ -666,7 +666,7 @@ wxString wxRichTextStyleListBox::GetStyleToShowInIdleTime(wxRichTextCtrl* ctrl, { styleName = para->GetAttributes().GetListStyleName(); } - + return styleName; } @@ -729,27 +729,27 @@ bool wxRichTextStyleListCtrl::Create(wxWindow* parent, wxWindowID id, const wxPo const wxSize& size, long style) { wxControl::Create(parent, id, pos, size, style); - + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); if (size != wxDefaultSize) SetBestFittingSize(size); - + bool showSelector = ((style & wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR) == 0); - + m_styleListBox = new wxRichTextStyleListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, showSelector ? wxSIMPLE_BORDER : wxNO_BORDER); wxBoxSizer* boxSizer = new wxBoxSizer(wxVERTICAL); - + if (showSelector) - { + { wxArrayString choices; choices.Add(_("All styles")); choices.Add(_("Paragraph styles")); choices.Add(_("Character styles")); choices.Add(_("List styles")); - + m_styleChoice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices); - + boxSizer->Add(m_styleListBox, 1, wxALL|wxEXPAND, 5); boxSizer->Add(m_styleChoice, 0, wxALL|wxEXPAND, 5); } @@ -757,26 +757,26 @@ bool wxRichTextStyleListCtrl::Create(wxWindow* parent, wxWindowID id, const wxPo { boxSizer->Add(m_styleListBox, 1, wxALL|wxEXPAND, 0); } - + SetSizer(boxSizer); Layout(); m_dontUpdate = true; if (m_styleChoice) - { + { int i = StyleTypeToIndex(m_styleListBox->GetStyleType()); m_styleChoice->SetSelection(i); } - + m_dontUpdate = false; - + return true; } wxRichTextStyleListCtrl::~wxRichTextStyleListCtrl() { - + } /// React to style type choice @@ -788,7 +788,7 @@ void wxRichTextStyleListCtrl::OnChooseType(wxCommandEvent& event) { if (m_dontUpdate) return; - + wxRichTextStyleListBox::wxRichTextStyleType styleType = StyleIndexToType(event.GetSelection()); m_styleListBox->SetStyleType(styleType); } @@ -875,11 +875,11 @@ void wxRichTextStyleListCtrl::SetStyleType(wxRichTextStyleListBox::wxRichTextSty m_dontUpdate = true; if (m_styleChoice) - { + { int i = StyleTypeToIndex(m_styleListBox->GetStyleType()); m_styleChoice->SetSelection(i); } - + m_dontUpdate = false; } @@ -895,7 +895,7 @@ wxRichTextStyleListBox::wxRichTextStyleType wxRichTextStyleListCtrl::GetStyleTyp void wxRichTextStyleListCtrl::UpdateStyles() { if (m_styleListBox) - m_styleListBox->UpdateStyles(); + m_styleListBox->UpdateStyles(); } #if wxUSE_COMBOCTRL @@ -1003,7 +1003,7 @@ void wxRichTextStyleComboCtrl::OnIdle(wxIdleEvent& event) if (GetRichTextCtrl() && !IsPopupShown() && m_stylePopup && wxWindow::FindFocus() != this) { wxString styleName = wxRichTextStyleListBox::GetStyleToShowInIdleTime(GetRichTextCtrl(), m_stylePopup->GetStyleType()); - + wxString currentValue = GetValue(); if (!styleName.IsEmpty()) { @@ -1027,4 +1027,3 @@ void wxRichTextStyleComboCtrl::OnIdle(wxIdleEvent& event) #endif // wxUSE_RICHTEXT - diff --git a/src/richtext/richtextsymboldlg.cpp b/src/richtext/richtextsymboldlg.cpp index 5671759bba..aa9f9fc5ff 100644 --- a/src/richtext/richtextsymboldlg.cpp +++ b/src/richtext/richtextsymboldlg.cpp @@ -400,7 +400,7 @@ void wxSymbolPickerDialog::CreateControls() itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); wxString* m_fontCtrlStrings = NULL; - m_fontCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_FONT, _T(""), wxDefaultPosition, wxSize(240, -1), 0, m_fontCtrlStrings, wxCB_READONLY ); + m_fontCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_FONT, wxEmptyString, wxDefaultPosition, wxSize(240, -1), 0, m_fontCtrlStrings, wxCB_READONLY ); m_fontCtrl->SetHelpText(_("The font from which to take the symbol.")); if (ShowToolTips()) m_fontCtrl->SetToolTip(_("The font from which to take the symbol.")); @@ -416,7 +416,7 @@ void wxSymbolPickerDialog::CreateControls() #if defined(__UNICODE__) wxString* m_subsetCtrlStrings = NULL; - m_subsetCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_SUBSET, _T(""), wxDefaultPosition, wxDefaultSize, 0, m_subsetCtrlStrings, wxCB_READONLY ); + m_subsetCtrl = new wxComboBox( itemDialog1, ID_SYMBOLPICKERDIALOG_SUBSET, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, m_subsetCtrlStrings, wxCB_READONLY ); m_subsetCtrl->SetHelpText(_("Shows a Unicode subset.")); if (ShowToolTips()) m_subsetCtrl->SetToolTip(_("Shows a Unicode subset.")); @@ -438,7 +438,7 @@ void wxSymbolPickerDialog::CreateControls() wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("&Character code:"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer12->Add(itemStaticText15, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); - m_characterCodeCtrl = new wxTextCtrl( itemDialog1, ID_SYMBOLPICKERDIALOG_CHARACTERCODE, _T(""), wxDefaultPosition, wxSize(140, -1), wxTE_READONLY|wxTE_CENTRE ); + m_characterCodeCtrl = new wxTextCtrl( itemDialog1, ID_SYMBOLPICKERDIALOG_CHARACTERCODE, wxEmptyString, wxDefaultPosition, wxSize(140, -1), wxTE_READONLY|wxTE_CENTRE ); m_characterCodeCtrl->SetHelpText(_("The character code.")); if (ShowToolTips()) m_characterCodeCtrl->SetToolTip(_("The character code.")); diff --git a/src/richtext/richtexttabspage.cpp b/src/richtext/richtexttabspage.cpp index 3948ba6f96..9d2a764d43 100644 --- a/src/richtext/richtexttabspage.cpp +++ b/src/richtext/richtexttabspage.cpp @@ -113,7 +113,7 @@ void wxRichTextTabsPage::CreateControls() wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Position (tenths of a mm):"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - m_tabEditCtrl = new wxTextCtrl( itemPanel1, ID_RICHTEXTTABSPAGE_TABEDIT, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); + m_tabEditCtrl = new wxTextCtrl( itemPanel1, ID_RICHTEXTTABSPAGE_TABEDIT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_tabEditCtrl->SetHelpText(_("The tab position.")); if (ShowToolTips()) m_tabEditCtrl->SetToolTip(_("The tab position.")); @@ -130,7 +130,7 @@ void wxRichTextTabsPage::CreateControls() wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL); itemBoxSizer4->Add(itemBoxSizer10, 0, wxGROW, 5); - wxStaticText* itemStaticText11 = new wxStaticText( itemPanel1, wxID_STATIC, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); + wxStaticText* itemStaticText11 = new wxStaticText( itemPanel1, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer10->Add(itemStaticText11, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxADJUST_MINSIZE, 5); wxButton* itemButton12 = new wxButton( itemPanel1, ID_RICHTEXTTABSPAGE_NEW_TAB, _("&New"), wxDefaultPosition, wxDefaultSize, 0 ); -- 2.45.2