From 1c6c52fdefbee79857043cabd7e7e2f768bb09ad Mon Sep 17 00:00:00 2001
From: Chris Elliott <biol75@york.ac.uk>
Date: Thu, 26 Apr 2007 10:50:54 +0000
Subject: [PATCH] tested and applied
 http://article.gmane.org/gmane.comp.lib.wxwidgets.devel/85790/

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/varhvscrollhelper.tex   | 12 +++++-----
 docs/latex/wx/varscrollhelperbase.tex |  9 ++++----
 docs/latex/wx/vscrolledwindow.tex     |  5 +++++
 include/wx/vscroll.h                  | 32 ++++++++-------------------
 src/common/config.cpp                 |  2 +-
 src/generic/vscroll.cpp               |  8 +++----
 6 files changed, 30 insertions(+), 38 deletions(-)

diff --git a/docs/latex/wx/varhvscrollhelper.tex b/docs/latex/wx/varhvscrollhelper.tex
index c50f0f8bbd..21b0f1eb4d 100644
--- a/docs/latex/wx/varhvscrollhelper.tex
+++ b/docs/latex/wx/varhvscrollhelper.tex
@@ -102,15 +102,15 @@ Returns the index of the last visible column and row based on the scroll
 position. This includes any partially visible columns or rows.
 
 
-\membersection{wxVarHVScrollHelper::HitTest}\label{wxvarhvscrollhelperhittest}
+\membersection{wxVarHVScrollHelper::VirtualHitTest}\label{wxvarhvscrollhelpervirtualhittest}
 
-\constfunc{virtual wxPosition}{HitTest}{\param{wxCoord }{x}, \param{wxCoord }{y}}
+\constfunc{wxPosition}{VirtualHitTest}{\param{wxCoord }{x}, \param{wxCoord }{y}}
 
-\constfunc{virtual wxPosition}{HitTest}{\param{const wxPoint\& }{pos}}
+\constfunc{wxPosition}{VirtualHitTest}{\param{const wxPoint\& }{pos}}
 
-Returns the scroll unit under the device unit given accounting for scroll
-position or {\tt wxNOT\_FOUND} (for the row, column, or possibly both values)
-if none.
+Returns the virtual scroll unit under the device unit given accounting for
+scroll position or {\tt wxNOT\_FOUND} (for the row, column, or possibly both
+values) if none.
 
 
 \membersection{wxVarHVScrollHelper::IsVisible}\label{wxvarhvscrollhelperisvisible}
diff --git a/docs/latex/wx/varscrollhelperbase.tex b/docs/latex/wx/varscrollhelperbase.tex
index 223cd84eba..ad8e3f7d4f 100644
--- a/docs/latex/wx/varscrollhelperbase.tex
+++ b/docs/latex/wx/varscrollhelperbase.tex
@@ -172,12 +172,13 @@ Returns the index of the last visible unit based on the scroll position. This
 includes the last unit even if it is only partially visible.
 
 
-\membersection{wxVarScrollHelperBase::HitTest}\label{wxvarscrollhelperbasehittest}
+\membersection{wxVarScrollHelperBase::VirtualHitTest}\label{wxvarscrollhelperbasevirtualhittest}
 
-\constfunc{virtual int}{HitTest}{\param{wxCoord }{coord}}
+\constfunc{int}{VirtualHitTest}{\param{wxCoord }{coord}}
 
-Returns the scroll unit under the device unit given accounting for scroll
-position or {\tt wxNOT\_FOUND} if none (i.e. if it is below the last item).
+Returns the virtual scroll unit under the device unit given accounting for
+scroll position or {\tt wxNOT\_FOUND} if none (i.e. if it is below the last
+item).
 
 
 \membersection{wxVarScrollHelperBase::IsVisible}\label{wxvarscrollhelperbaseisvisible}
diff --git a/docs/latex/wx/vscrolledwindow.tex b/docs/latex/wx/vscrolledwindow.tex
index b66c55bca5..1d05234c5f 100644
--- a/docs/latex/wx/vscrolledwindow.tex
+++ b/docs/latex/wx/vscrolledwindow.tex
@@ -94,6 +94,11 @@ position was 0 and the first line wasn't completely visible.
 
 Deprecated for \helpref{GetRowCount()}{wxvarvscrollhelpergetrowcount}.
 
+\constfunc{int}{HitTest}{\param{wxCoord }{x}, \param{wxCoord }{y}}
+\constfunc{int}{HitTest}{\param{const wxPoint\& }{pt}}
+
+Deprecated for \helpref{VirtualHitTest()}{wxvarscrollhelperbasevirtualhittest}.
+
 \constfunc{virtual wxCoord}{OnGetLineHeight}{\param{size\_t }{line}}
 
 Deprecated for \helpref{OnGetRowHeight()}{wxvarvscrollhelperongetrowheight}.
diff --git a/include/wx/vscroll.h b/include/wx/vscroll.h
index 4b18ca6333..4da294ce60 100644
--- a/include/wx/vscroll.h
+++ b/include/wx/vscroll.h
@@ -78,7 +78,7 @@ public:
         { m_physicalScrolling = scrolling; }
 
     // wxNOT_FOUND if none, i.e. if it is below the last item
-    virtual int HitTest(wxCoord coord) const;
+    int VirtualHitTest(wxCoord coord) const;
 
     // recalculate all our parameters and redisplay all units
     virtual void RefreshAll();
@@ -324,9 +324,6 @@ public:
     virtual void RefreshRows(size_t from, size_t to)
         { RefreshUnits(from, to); }
 
-    virtual int HitTest(wxCoord y) const
-        { return wxVarScrollHelperBase::HitTest(y); }
-
     // accessors
 
     size_t GetRowCount() const                  { return GetUnitCount(); }
@@ -401,8 +398,6 @@ public:
         { RefreshUnit(column); }
     virtual void RefreshColumns(size_t from, size_t to)
         { RefreshUnits(from, to); }
-    virtual int HitTest(wxCoord x) const
-        { return wxVarScrollHelperBase::HitTest(x); }
 
     // accessors
 
@@ -514,10 +509,10 @@ public:
                           from.GetColumn(), to.GetColumn());
     }
 
-    // Override wxPanel::HitTest to use our version
-    virtual wxPosition HitTest(wxCoord x, wxCoord y) const;
-    virtual wxPosition HitTest(const wxPoint &pos) const
-        { return HitTest(pos.x, pos.y); }
+    // locate the virtual position from the given device coordinates
+    wxPosition VirtualHitTest(wxCoord x, wxCoord y) const;
+    wxPosition VirtualHitTest(const wxPoint &pos) const
+        { return VirtualHitTest(pos.x, pos.y); }
 
     // change the DC origin according to the scroll position. To properly
     // forward calls to wxWindow::Layout use WX_FORWARD_TO_SCROLL_HELPER()
@@ -736,11 +731,14 @@ public:
         return wxPanel::Create(parent, id, pos, size, style | wxVSCROLL, name);
     }
 
+#if WXWIN_COMPATIBILITY_2_8
     // Make sure we prefer our version of HitTest rather than wxWindow's
+    // These functions should no longer be masked in favor of VirtualHitTest()
     int HitTest(wxCoord WXUNUSED(x), wxCoord y) const
-        { return wxVarVScrollHelper::HitTest(y); }
+        { return wxVarVScrollHelper::VirtualHitTest(y); }
     int HitTest(const wxPoint& pt) const
         { return HitTest(pt.x, pt.y); }
+#endif // WXWIN_COMPATIBILITY_2_8
 
     WX_FORWARD_TO_VAR_SCROLL_HELPER()
 
@@ -809,12 +807,6 @@ public:
         return wxPanel::Create(parent, id, pos, size, style | wxHSCROLL, name);
     }
 
-    // Make sure we prefer our version of HitTest rather than wxWindow's
-    int HitTest(wxCoord x, wxCoord WXUNUSED(y)) const
-        { return wxVarHScrollHelper::HitTest(x); }
-    int HitTest(const wxPoint& pt) const
-        { return HitTest(pt.x, pt.y); }
-
     WX_FORWARD_TO_VAR_SCROLL_HELPER()
 
 #ifdef __WXMAC__
@@ -880,12 +872,6 @@ public:
                                style | wxVSCROLL | wxHSCROLL, name);
     }
 
-    // Make sure we prefer our version of HitTest rather than wxWindow's
-    wxPosition HitTest(wxCoord x, wxCoord y) const
-        { return wxVarHVScrollHelper::HitTest(x, y); }
-    wxPosition HitTest(const wxPoint &pt) const
-        { return HitTest(pt.x, pt.y); }
-
     WX_FORWARD_TO_VAR_SCROLL_HELPER()
 
 #ifdef __WXMAC__
diff --git a/src/common/config.cpp b/src/common/config.cpp
index 660932e469..17db0fca5a 100644
--- a/src/common/config.cpp
+++ b/src/common/config.cpp
@@ -382,7 +382,7 @@ wxString wxExpandEnvVars(const wxString& str)
 
           while ( m < str.length() && (wxIsalnum(str[m]) || str[m] == wxT('_')) )
             m++;
-
+ 
           wxString strVarName(str.c_str() + n + 1, m - n - 1);
 
 #ifdef __WXWINCE__
diff --git a/src/generic/vscroll.cpp b/src/generic/vscroll.cpp
index 492b3ead2c..e6cf0713d8 100644
--- a/src/generic/vscroll.cpp
+++ b/src/generic/vscroll.cpp
@@ -539,7 +539,7 @@ bool wxVarScrollHelperBase::ScrollLayout()
     return m_targetWindow->wxWindow::Layout();
 }
 
-int wxVarScrollHelperBase::HitTest(wxCoord coord) const
+int wxVarScrollHelperBase::VirtualHitTest(wxCoord coord) const
 {
     const size_t unitMax = GetVisibleEnd();
     for ( size_t unit = GetVisibleBegin(); unit < unitMax; ++unit )
@@ -874,10 +874,10 @@ void wxVarHVScrollHelper::RefreshRowsColumns(size_t fromRow, size_t toRow,
     }
 }
 
-wxPosition wxVarHVScrollHelper::HitTest(wxCoord x, wxCoord y) const
+wxPosition wxVarHVScrollHelper::VirtualHitTest(wxCoord x, wxCoord y) const
 {
-    return wxPosition(wxVarVScrollHelper::HitTest(y),
-                        wxVarHScrollHelper::HitTest(x));
+    return wxPosition(wxVarVScrollHelper::VirtualHitTest(y),
+                      wxVarHScrollHelper::VirtualHitTest(x));
 }
 
 void wxVarHVScrollHelper::DoPrepareDC(wxDC& dc)
-- 
2.45.2

