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
This commit is contained in:
Vadim Zeitlin 2014-05-08 14:43:38 +00:00
parent 9db8162da5
commit 0acb665006
7 changed files with 34 additions and 24 deletions

View File

@ -5044,7 +5044,8 @@ public:
void SetKey(int k) { m_key = k; } void SetKey(int k) { m_key = k; }
void SetModifiers(int m) { m_modifiers = m; } void SetModifiers(int m) { m_modifiers = m; }
void SetModificationType(int t) { m_modificationType = t; } 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 SetLength(int len) { m_length = len; }
void SetLinesAdded(int num) { m_linesAdded = num; } void SetLinesAdded(int num) { m_linesAdded = num; }
void SetLine(int val) { m_line = val; } void SetLine(int val) { m_line = val; }
@ -5061,7 +5062,8 @@ public:
void SetAnnotationLinesAdded(int val) { m_annotationLinesAdded = val; } void SetAnnotationLinesAdded(int val) { m_annotationLinesAdded = val; }
void SetUpdated(int val) { m_updated = val; } void SetUpdated(int val) { m_updated = val; }
#ifdef STC_USE_DND #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 SetDragFlags(int flags) { m_dragFlags = flags; }
void SetDragResult(wxDragResult val) { m_dragResult = val; } void SetDragResult(wxDragResult val) { m_dragResult = val; }
@ -5080,7 +5082,8 @@ public:
int GetKey() const { return m_key; } int GetKey() const { return m_key; }
int GetModifiers() const { return m_modifiers; } int GetModifiers() const { return m_modifiers; }
int GetModificationType() const { return m_modificationType; } 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 GetLength() const { return m_length; }
int GetLinesAdded() const { return m_linesAdded; } int GetLinesAdded() const { return m_linesAdded; }
int GetLine() const { return m_line; } int GetLine() const { return m_line; }
@ -5098,7 +5101,8 @@ public:
int GetUpdated() const { return m_updated; } int GetUpdated() const { return m_updated; }
#ifdef STC_USE_DND #ifdef STC_USE_DND
wxString GetDragText() { return m_dragText; } // Kept for backwards compatibility, use GetString().
wxString GetDragText() { return GetString(); }
int GetDragFlags() { return m_dragFlags; } int GetDragFlags() { return m_dragFlags; }
wxDragResult GetDragResult() { return m_dragResult; } wxDragResult GetDragResult() { return m_dragResult; }
@ -5120,7 +5124,6 @@ private:
int m_modifiers; int m_modifiers;
int m_modificationType; // wxEVT_STC_MODIFIED int m_modificationType; // wxEVT_STC_MODIFIED
wxString m_text;
int m_length; int m_length;
int m_linesAdded; int m_linesAdded;
int m_line; int m_line;
@ -5141,9 +5144,7 @@ private:
int m_annotationLinesAdded; // wxEVT_STC_MODIFIED with SC_MOD_CHANGEANNOTATION int m_annotationLinesAdded; // wxEVT_STC_MODIFIED with SC_MOD_CHANGEANNOTATION
int m_updated; // wxEVT_STC_UPDATEUI int m_updated; // wxEVT_STC_UPDATEUI
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
wxString m_dragText; // wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP
int m_dragFlags; // wxEVT_STC_START_DRAG int m_dragFlags; // wxEVT_STC_START_DRAG
wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP
#endif #endif

View File

@ -6172,6 +6172,9 @@ public:
int GetKey() const; int GetKey() const;
int GetModifiers() const; int GetModifiers() const;
int GetModificationType() const; int GetModificationType() const;
/**
@deprecated Use GetString() instead.
*/
wxString GetText() const; wxString GetText() const;
int GetLength() const; int GetLength() const;
int GetLinesAdded() const; int GetLinesAdded() const;
@ -6189,6 +6192,9 @@ public:
int GetAnnotationsLinesAdded() const; int GetAnnotationsLinesAdded() const;
int GetUpdated() const; int GetUpdated() const;
/**
@deprecated Use GetString() instead.
*/
wxString GetDragText(); wxString GetDragText();
int GetDragFlags(); int GetDragFlags();
wxDragResult GetDragResult(); wxDragResult GetDragResult();

View File

@ -299,12 +299,12 @@ void ScintillaWX::StartDrag() {
// Send an event to allow the drag text to be changed // Send an event to allow the drag text to be changed
wxStyledTextEvent evt(wxEVT_STC_START_DRAG, stc->GetId()); wxStyledTextEvent evt(wxEVT_STC_START_DRAG, stc->GetId());
evt.SetEventObject(stc); evt.SetEventObject(stc);
evt.SetDragText(dragText); evt.SetString(dragText);
evt.SetDragFlags(wxDrag_DefaultMove); evt.SetDragFlags(wxDrag_DefaultMove);
evt.SetPosition(wxMin(stc->GetSelectionStart(), evt.SetPosition(wxMin(stc->GetSelectionStart(),
stc->GetSelectionEnd())); stc->GetSelectionEnd()));
stc->GetEventHandler()->ProcessEvent(evt); stc->GetEventHandler()->ProcessEvent(evt);
dragText = evt.GetDragText(); dragText = evt.GetString();
if ( !dragText.empty() ) { if ( !dragText.empty() ) {
wxDropSource source(stc); wxDropSource source(stc);
@ -1124,13 +1124,13 @@ bool ScintillaWX::DoDropText(long x, long y, const wxString& data) {
evt.SetX(x); evt.SetX(x);
evt.SetY(y); evt.SetY(y);
evt.SetPosition(PositionFromLocation(Point(x,y))); evt.SetPosition(PositionFromLocation(Point(x,y)));
evt.SetDragText(text); evt.SetString(text);
stc->GetEventHandler()->ProcessEvent(evt); stc->GetEventHandler()->ProcessEvent(evt);
dragResult = evt.GetDragResult(); dragResult = evt.GetDragResult();
if (dragResult == wxDragMove || dragResult == wxDragCopy) { if (dragResult == wxDragMove || dragResult == wxDragCopy) {
DropAt(SelectionPosition(evt.GetPosition()), DropAt(SelectionPosition(evt.GetPosition()),
wx2stc(evt.GetDragText()), wx2stc(evt.GetString()),
dragResult == wxDragMove, dragResult == wxDragMove,
false); // TODO: rectangular? false); // TODO: rectangular?
return true; return true;

View File

@ -5082,7 +5082,7 @@ static void SetEventText(wxStyledTextEvent& evt, const char* text,
size_t length) { size_t length) {
if(!text) return; 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_key = event.m_key;
m_modifiers = event.m_modifiers; m_modifiers = event.m_modifiers;
m_modificationType = event.m_modificationType; m_modificationType = event.m_modificationType;
m_text = event.m_text;
m_length = event.m_length; m_length = event.m_length;
m_linesAdded = event.m_linesAdded; m_linesAdded = event.m_linesAdded;
m_line = event.m_line; m_line = event.m_line;
@ -5306,7 +5305,6 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event):
m_updated = event.m_updated; m_updated = event.m_updated;
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
m_dragText = event.m_dragText;
m_dragFlags = event.m_dragFlags; m_dragFlags = event.m_dragFlags;
m_dragResult = event.m_dragResult; m_dragResult = event.m_dragResult;
#endif #endif

View File

@ -970,7 +970,7 @@ static void SetEventText(wxStyledTextEvent& evt, const char* text,
size_t length) { size_t length) {
if(!text) return; 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_key = event.m_key;
m_modifiers = event.m_modifiers; m_modifiers = event.m_modifiers;
m_modificationType = event.m_modificationType; m_modificationType = event.m_modificationType;
m_text = event.m_text;
m_length = event.m_length; m_length = event.m_length;
m_linesAdded = event.m_linesAdded; m_linesAdded = event.m_linesAdded;
m_line = event.m_line; m_line = event.m_line;
@ -1194,7 +1193,6 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event):
m_updated = event.m_updated; m_updated = event.m_updated;
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
m_dragText = event.m_dragText;
m_dragFlags = event.m_dragFlags; m_dragFlags = event.m_dragFlags;
m_dragResult = event.m_dragResult; m_dragResult = event.m_dragResult;
#endif #endif

View File

@ -538,7 +538,8 @@ public:
void SetKey(int k) { m_key = k; } void SetKey(int k) { m_key = k; }
void SetModifiers(int m) { m_modifiers = m; } void SetModifiers(int m) { m_modifiers = m; }
void SetModificationType(int t) { m_modificationType = t; } 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 SetLength(int len) { m_length = len; }
void SetLinesAdded(int num) { m_linesAdded = num; } void SetLinesAdded(int num) { m_linesAdded = num; }
void SetLine(int val) { m_line = val; } void SetLine(int val) { m_line = val; }
@ -555,7 +556,8 @@ public:
void SetAnnotationLinesAdded(int val) { m_annotationLinesAdded = val; } void SetAnnotationLinesAdded(int val) { m_annotationLinesAdded = val; }
void SetUpdated(int val) { m_updated = val; } void SetUpdated(int val) { m_updated = val; }
#ifdef STC_USE_DND #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 SetDragFlags(int flags) { m_dragFlags = flags; }
void SetDragResult(wxDragResult val) { m_dragResult = val; } void SetDragResult(wxDragResult val) { m_dragResult = val; }
@ -574,7 +576,8 @@ public:
int GetKey() const { return m_key; } int GetKey() const { return m_key; }
int GetModifiers() const { return m_modifiers; } int GetModifiers() const { return m_modifiers; }
int GetModificationType() const { return m_modificationType; } 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 GetLength() const { return m_length; }
int GetLinesAdded() const { return m_linesAdded; } int GetLinesAdded() const { return m_linesAdded; }
int GetLine() const { return m_line; } int GetLine() const { return m_line; }
@ -592,7 +595,8 @@ public:
int GetUpdated() const { return m_updated; } int GetUpdated() const { return m_updated; }
#ifdef STC_USE_DND #ifdef STC_USE_DND
wxString GetDragText() { return m_dragText; } // Kept for backwards compatibility, use GetString().
wxString GetDragText() { return GetString(); }
int GetDragFlags() { return m_dragFlags; } int GetDragFlags() { return m_dragFlags; }
wxDragResult GetDragResult() { return m_dragResult; } wxDragResult GetDragResult() { return m_dragResult; }
@ -614,7 +618,6 @@ private:
int m_modifiers; int m_modifiers;
int m_modificationType; // wxEVT_STC_MODIFIED int m_modificationType; // wxEVT_STC_MODIFIED
wxString m_text;
int m_length; int m_length;
int m_linesAdded; int m_linesAdded;
int m_line; int m_line;
@ -635,9 +638,7 @@ private:
int m_annotationLinesAdded; // wxEVT_STC_MODIFIED with SC_MOD_CHANGEANNOTATION int m_annotationLinesAdded; // wxEVT_STC_MODIFIED with SC_MOD_CHANGEANNOTATION
int m_updated; // wxEVT_STC_UPDATEUI int m_updated; // wxEVT_STC_UPDATEUI
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
wxString m_dragText; // wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP
int m_dragFlags; // wxEVT_STC_START_DRAG int m_dragFlags; // wxEVT_STC_START_DRAG
wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP
#endif #endif

View File

@ -450,6 +450,9 @@ public:
int GetKey() const; int GetKey() const;
int GetModifiers() const; int GetModifiers() const;
int GetModificationType() const; int GetModificationType() const;
/**
@deprecated Use GetString() instead.
*/
wxString GetText() const; wxString GetText() const;
int GetLength() const; int GetLength() const;
int GetLinesAdded() const; int GetLinesAdded() const;
@ -467,6 +470,9 @@ public:
int GetAnnotationsLinesAdded() const; int GetAnnotationsLinesAdded() const;
int GetUpdated() const; int GetUpdated() const;
/**
@deprecated Use GetString() instead.
*/
wxString GetDragText(); wxString GetDragText();
int GetDragFlags(); int GetDragFlags();
wxDragResult GetDragResult(); wxDragResult GetDragResult();