Update of /cvsroot/mahogany/M/src/modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22032/src/modules
Modified Files:
TextViewer.cpp
Log Message:
use HitTest() instead of home-brewn GetTextPositionFromCoords() (so now deetcting the
click position works under GTK2 as well)
Index: TextViewer.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/TextViewer.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -b -u -2 -r1.59 -r1.60
--- TextViewer.cpp 23 Jul 2004 11:17:25 -0000 1.59
+++ TextViewer.cpp 23 Jul 2004 21:00:15 -0000 1.60
@@ -218,9 +218,4 @@
#endif // USE_AUTO_URL_DETECTION
-#ifdef __WXMSW__
- // get the text position from the coords
- long GetTextPositionFromCoords(const wxPoint& pt) const;
-#endif // __WXMSW__
-
// the generic mouse event handler for right/left/double clicks
void OnMouseEvent(wxMouseEvent& event);
@@ -432,38 +427,10 @@
#endif // USE_AUTO_URL_DETECTION
-#ifdef __WXMSW__
-
-long TextViewerWindow::GetTextPositionFromCoords(const wxPoint& pt) const
-{
- POINTL ptl = { pt.x, pt.y };
-
- // can't use SendMessage because it's a class name for us and so we had to
- // #undef it before...
- long pos = ::SendMessageA(GetHwnd(), EM_CHARFROMPOS, 0, (LPARAM)&ptl);
-
- // EM_CHARFROMPOS lies when the point is below the last line: it simply
- // ignroes the y coord then, so double check that we really clicked where it
- // pretends we did
- ::SendMessageA(GetHwnd(), EM_POSFROMCHAR, (LPARAM)&ptl, pos);
- if ( pt.y > ptl.y + GetCharHeight() )
- {
- // the click was really below the last line, there is nothing there
- pos = -1;
- }
-
- return pos;
-}
-
-#endif // __WXMSW__
-
void TextViewerWindow::OnMouseEvent(wxMouseEvent& event)
{
-#ifdef __WXMSW__
- long pos = GetTextPositionFromCoords(event.GetPosition());
-#else
- long pos = GetInsertionPoint();
-#endif // __WXMSW__/!__WXMSW__
+ long pos;
+ wxTextCtrlHitTestResult rc = HitTest(event.GetPosition(), &pos);
- if ( pos == -1 || !ProcessMouseEvent(event, pos) )
+ if ( rc != wxTE_HT_ON_TEXT || !ProcessMouseEvent(event, pos) )
{
event.Skip();
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates