From 0acb6650062220b600126ef8e259ebf4fca50443 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 8 May 2014 14:43:38 +0000 Subject: [PATCH] Remove wxStyledTextEvent::m_text and m_dragText. These fields were unnecessary and duplicated m_cmdString inherited from the base class. Also use base class GetString() instead of the redundant GetText() and GetDragText() in the code, even though these methods are still kept for backwards compatibility. See #16191. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76486 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/stc/stc.h | 15 ++++++++------- interface/wx/stc/stc.h | 6 ++++++ src/stc/ScintillaWX.cpp | 8 ++++---- src/stc/stc.cpp | 4 +--- src/stc/stc.cpp.in | 4 +--- src/stc/stc.h.in | 15 ++++++++------- src/stc/stc.interface.h.in | 6 ++++++ 7 files changed, 34 insertions(+), 24 deletions(-) diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index 3209a6922c..9b7dc649ee 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -5044,7 +5044,8 @@ public: void SetKey(int k) { m_key = k; } void SetModifiers(int m) { m_modifiers = m; } void SetModificationType(int t) { m_modificationType = t; } - void SetText(const wxString& t) { m_text = t; } + // Kept for backwards compatibility, use SetString(). + void SetText(const wxString& t) { SetString(t); } void SetLength(int len) { m_length = len; } void SetLinesAdded(int num) { m_linesAdded = num; } void SetLine(int val) { m_line = val; } @@ -5061,7 +5062,8 @@ public: void SetAnnotationLinesAdded(int val) { m_annotationLinesAdded = val; } void SetUpdated(int val) { m_updated = val; } #ifdef STC_USE_DND - void SetDragText(const wxString& val) { m_dragText = val; } + // Kept for backwards compatibility, use SetString(). + void SetDragText(const wxString& val) { SetString(val); } void SetDragFlags(int flags) { m_dragFlags = flags; } void SetDragResult(wxDragResult val) { m_dragResult = val; } @@ -5080,7 +5082,8 @@ public: int GetKey() const { return m_key; } int GetModifiers() const { return m_modifiers; } int GetModificationType() const { return m_modificationType; } - wxString GetText() const { return m_text; } + // Kept for backwards compatibility, use GetString(). + wxString GetText() const { return GetString(); } int GetLength() const { return m_length; } int GetLinesAdded() const { return m_linesAdded; } int GetLine() const { return m_line; } @@ -5098,7 +5101,8 @@ public: int GetUpdated() const { return m_updated; } #ifdef STC_USE_DND - wxString GetDragText() { return m_dragText; } + // Kept for backwards compatibility, use GetString(). + wxString GetDragText() { return GetString(); } int GetDragFlags() { return m_dragFlags; } wxDragResult GetDragResult() { return m_dragResult; } @@ -5120,7 +5124,6 @@ private: int m_modifiers; int m_modificationType; // wxEVT_STC_MODIFIED - wxString m_text; int m_length; int m_linesAdded; int m_line; @@ -5141,9 +5144,7 @@ private: int m_annotationLinesAdded; // wxEVT_STC_MODIFIED with SC_MOD_CHANGEANNOTATION int m_updated; // wxEVT_STC_UPDATEUI - #if wxUSE_DRAG_AND_DROP - wxString m_dragText; // wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP int m_dragFlags; // wxEVT_STC_START_DRAG wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP #endif diff --git a/interface/wx/stc/stc.h b/interface/wx/stc/stc.h index 0a3fc95b03..8fe281ba5e 100644 --- a/interface/wx/stc/stc.h +++ b/interface/wx/stc/stc.h @@ -6172,6 +6172,9 @@ public: int GetKey() const; int GetModifiers() const; int GetModificationType() const; + /** + @deprecated Use GetString() instead. + */ wxString GetText() const; int GetLength() const; int GetLinesAdded() const; @@ -6189,6 +6192,9 @@ public: int GetAnnotationsLinesAdded() const; int GetUpdated() const; + /** + @deprecated Use GetString() instead. + */ wxString GetDragText(); int GetDragFlags(); wxDragResult GetDragResult(); diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index fd57208748..4ba7b9ee87 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -299,12 +299,12 @@ void ScintillaWX::StartDrag() { // Send an event to allow the drag text to be changed wxStyledTextEvent evt(wxEVT_STC_START_DRAG, stc->GetId()); evt.SetEventObject(stc); - evt.SetDragText(dragText); + evt.SetString(dragText); evt.SetDragFlags(wxDrag_DefaultMove); evt.SetPosition(wxMin(stc->GetSelectionStart(), stc->GetSelectionEnd())); stc->GetEventHandler()->ProcessEvent(evt); - dragText = evt.GetDragText(); + dragText = evt.GetString(); if ( !dragText.empty() ) { wxDropSource source(stc); @@ -1124,13 +1124,13 @@ bool ScintillaWX::DoDropText(long x, long y, const wxString& data) { evt.SetX(x); evt.SetY(y); evt.SetPosition(PositionFromLocation(Point(x,y))); - evt.SetDragText(text); + evt.SetString(text); stc->GetEventHandler()->ProcessEvent(evt); dragResult = evt.GetDragResult(); if (dragResult == wxDragMove || dragResult == wxDragCopy) { DropAt(SelectionPosition(evt.GetPosition()), - wx2stc(evt.GetDragText()), + wx2stc(evt.GetString()), dragResult == wxDragMove, false); // TODO: rectangular? return true; diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index 2d82a2c107..2396fe3b8a 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -5082,7 +5082,7 @@ static void SetEventText(wxStyledTextEvent& evt, const char* text, size_t length) { if(!text) return; - evt.SetText(stc2wx(text, length)); + evt.SetString(stc2wx(text, length)); } @@ -5284,7 +5284,6 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event): m_key = event.m_key; m_modifiers = event.m_modifiers; m_modificationType = event.m_modificationType; - m_text = event.m_text; m_length = event.m_length; m_linesAdded = event.m_linesAdded; m_line = event.m_line; @@ -5306,7 +5305,6 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event): m_updated = event.m_updated; #if wxUSE_DRAG_AND_DROP - m_dragText = event.m_dragText; m_dragFlags = event.m_dragFlags; m_dragResult = event.m_dragResult; #endif diff --git a/src/stc/stc.cpp.in b/src/stc/stc.cpp.in index 900a2bc5eb..f643b7f98a 100644 --- a/src/stc/stc.cpp.in +++ b/src/stc/stc.cpp.in @@ -970,7 +970,7 @@ static void SetEventText(wxStyledTextEvent& evt, const char* text, size_t length) { if(!text) return; - evt.SetText(stc2wx(text, length)); + evt.SetString(stc2wx(text, length)); } @@ -1172,7 +1172,6 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event): m_key = event.m_key; m_modifiers = event.m_modifiers; m_modificationType = event.m_modificationType; - m_text = event.m_text; m_length = event.m_length; m_linesAdded = event.m_linesAdded; m_line = event.m_line; @@ -1194,7 +1193,6 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event): m_updated = event.m_updated; #if wxUSE_DRAG_AND_DROP - m_dragText = event.m_dragText; m_dragFlags = event.m_dragFlags; m_dragResult = event.m_dragResult; #endif diff --git a/src/stc/stc.h.in b/src/stc/stc.h.in index b8279aadaa..365165a280 100644 --- a/src/stc/stc.h.in +++ b/src/stc/stc.h.in @@ -538,7 +538,8 @@ public: void SetKey(int k) { m_key = k; } void SetModifiers(int m) { m_modifiers = m; } void SetModificationType(int t) { m_modificationType = t; } - void SetText(const wxString& t) { m_text = t; } + // Kept for backwards compatibility, use SetString(). + void SetText(const wxString& t) { SetString(t); } void SetLength(int len) { m_length = len; } void SetLinesAdded(int num) { m_linesAdded = num; } void SetLine(int val) { m_line = val; } @@ -555,7 +556,8 @@ public: void SetAnnotationLinesAdded(int val) { m_annotationLinesAdded = val; } void SetUpdated(int val) { m_updated = val; } #ifdef STC_USE_DND - void SetDragText(const wxString& val) { m_dragText = val; } + // Kept for backwards compatibility, use SetString(). + void SetDragText(const wxString& val) { SetString(val); } void SetDragFlags(int flags) { m_dragFlags = flags; } void SetDragResult(wxDragResult val) { m_dragResult = val; } @@ -574,7 +576,8 @@ public: int GetKey() const { return m_key; } int GetModifiers() const { return m_modifiers; } int GetModificationType() const { return m_modificationType; } - wxString GetText() const { return m_text; } + // Kept for backwards compatibility, use GetString(). + wxString GetText() const { return GetString(); } int GetLength() const { return m_length; } int GetLinesAdded() const { return m_linesAdded; } int GetLine() const { return m_line; } @@ -592,7 +595,8 @@ public: int GetUpdated() const { return m_updated; } #ifdef STC_USE_DND - wxString GetDragText() { return m_dragText; } + // Kept for backwards compatibility, use GetString(). + wxString GetDragText() { return GetString(); } int GetDragFlags() { return m_dragFlags; } wxDragResult GetDragResult() { return m_dragResult; } @@ -614,7 +618,6 @@ private: int m_modifiers; int m_modificationType; // wxEVT_STC_MODIFIED - wxString m_text; int m_length; int m_linesAdded; int m_line; @@ -635,9 +638,7 @@ private: int m_annotationLinesAdded; // wxEVT_STC_MODIFIED with SC_MOD_CHANGEANNOTATION int m_updated; // wxEVT_STC_UPDATEUI - #if wxUSE_DRAG_AND_DROP - wxString m_dragText; // wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP int m_dragFlags; // wxEVT_STC_START_DRAG wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP #endif diff --git a/src/stc/stc.interface.h.in b/src/stc/stc.interface.h.in index acd3015e0e..fabe26ac6f 100644 --- a/src/stc/stc.interface.h.in +++ b/src/stc/stc.interface.h.in @@ -450,6 +450,9 @@ public: int GetKey() const; int GetModifiers() const; int GetModificationType() const; + /** + @deprecated Use GetString() instead. + */ wxString GetText() const; int GetLength() const; int GetLinesAdded() const; @@ -467,6 +470,9 @@ public: int GetAnnotationsLinesAdded() const; int GetUpdated() const; + /** + @deprecated Use GetString() instead. + */ wxString GetDragText(); int GetDragFlags(); wxDragResult GetDragResult();