corrected line counts and implemented ShowPosition
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25607 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -24,6 +24,8 @@
|
|||||||
#include <stat.h>
|
#include <stat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "wx/msgdlg.h"
|
||||||
|
|
||||||
#if wxUSE_STD_IOSTREAM
|
#if wxUSE_STD_IOSTREAM
|
||||||
#if wxUSE_IOSTREAMH
|
#if wxUSE_IOSTREAMH
|
||||||
#include <fstream.h>
|
#include <fstream.h>
|
||||||
@@ -878,7 +880,7 @@ void wxTextCtrl::GetSelection(long* from, long* to) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TXNGetSelection( ((TXNObject) m_macTXN) , (TXNOffset*) from , (TXNOffset*) to ) ;
|
TXNGetSelection( (TXNObject) m_macTXN , (TXNOffset*) from , (TXNOffset*) to ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1442,16 +1444,23 @@ void wxTextCtrl::DiscardEdits()
|
|||||||
|
|
||||||
int wxTextCtrl::GetNumberOfLines() const
|
int wxTextCtrl::GetNumberOfLines() const
|
||||||
{
|
{
|
||||||
// TODO change this if possible to reflect real lines
|
if ( m_macUsesTXN )
|
||||||
wxString content = GetValue() ;
|
|
||||||
|
|
||||||
int count = 1;
|
|
||||||
for (size_t i = 0; i < content.Length() ; i++)
|
|
||||||
{
|
{
|
||||||
if (content[i] == '\r') count++;
|
ItemCount lines ;
|
||||||
|
TXNGetLineCount((TXNObject)m_macTXN, &lines ) ;
|
||||||
|
return lines ;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxString content = GetValue() ;
|
||||||
|
|
||||||
return count;
|
int count = 1;
|
||||||
|
for (size_t i = 0; i < content.Length() ; i++)
|
||||||
|
{
|
||||||
|
if (content[i] == '\r') count++;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxTextCtrl::XYToPosition(long x, long y) const
|
long wxTextCtrl::XYToPosition(long x, long y) const
|
||||||
@@ -1467,7 +1476,27 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
|
|||||||
|
|
||||||
void wxTextCtrl::ShowPosition(long pos)
|
void wxTextCtrl::ShowPosition(long pos)
|
||||||
{
|
{
|
||||||
// TODO
|
#if TARGET_RT_MAC_MACHO && defined(AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
|
||||||
|
if ( m_macUsesTXN )
|
||||||
|
{
|
||||||
|
Point current ;
|
||||||
|
Point desired ;
|
||||||
|
TXNOffset selstart , selend ;
|
||||||
|
TXNGetSelection( (TXNObject) m_macTXN , &selstart , &selend) ;
|
||||||
|
TXNOffsetToPoint( (TXNObject) m_macTXN, selstart , ¤t);
|
||||||
|
TXNOffsetToPoint( (TXNObject) m_macTXN, pos , &desired);
|
||||||
|
//TODO use HIPoints for 10.3 and above
|
||||||
|
if ( (UInt32) TXNScroll != (UInt32) kUnresolvedCFragSymbolAddress )
|
||||||
|
{
|
||||||
|
OSErr theErr = noErr;
|
||||||
|
SInt32 dv = desired.v - current.v ;
|
||||||
|
SInt32 dh = desired.h - current.h ;
|
||||||
|
TXNShowSelection( (TXNObject) m_macTXN , true ) ;
|
||||||
|
theErr = TXNScroll( (TXNObject) m_macTXN, kTXNScrollUnitsInPixels , kTXNScrollUnitsInPixels , &dv , &dh );
|
||||||
|
wxASSERT_MSG( theErr == noErr, _T("TXNScroll returned an error!") );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxTextCtrl::GetLineLength(long lineNo) const
|
int wxTextCtrl::GetLineLength(long lineNo) const
|
||||||
|
@@ -24,6 +24,8 @@
|
|||||||
#include <stat.h>
|
#include <stat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "wx/msgdlg.h"
|
||||||
|
|
||||||
#if wxUSE_STD_IOSTREAM
|
#if wxUSE_STD_IOSTREAM
|
||||||
#if wxUSE_IOSTREAMH
|
#if wxUSE_IOSTREAMH
|
||||||
#include <fstream.h>
|
#include <fstream.h>
|
||||||
@@ -878,7 +880,7 @@ void wxTextCtrl::GetSelection(long* from, long* to) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TXNGetSelection( ((TXNObject) m_macTXN) , (TXNOffset*) from , (TXNOffset*) to ) ;
|
TXNGetSelection( (TXNObject) m_macTXN , (TXNOffset*) from , (TXNOffset*) to ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1442,16 +1444,23 @@ void wxTextCtrl::DiscardEdits()
|
|||||||
|
|
||||||
int wxTextCtrl::GetNumberOfLines() const
|
int wxTextCtrl::GetNumberOfLines() const
|
||||||
{
|
{
|
||||||
// TODO change this if possible to reflect real lines
|
if ( m_macUsesTXN )
|
||||||
wxString content = GetValue() ;
|
|
||||||
|
|
||||||
int count = 1;
|
|
||||||
for (size_t i = 0; i < content.Length() ; i++)
|
|
||||||
{
|
{
|
||||||
if (content[i] == '\r') count++;
|
ItemCount lines ;
|
||||||
|
TXNGetLineCount((TXNObject)m_macTXN, &lines ) ;
|
||||||
|
return lines ;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxString content = GetValue() ;
|
||||||
|
|
||||||
return count;
|
int count = 1;
|
||||||
|
for (size_t i = 0; i < content.Length() ; i++)
|
||||||
|
{
|
||||||
|
if (content[i] == '\r') count++;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxTextCtrl::XYToPosition(long x, long y) const
|
long wxTextCtrl::XYToPosition(long x, long y) const
|
||||||
@@ -1467,7 +1476,27 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
|
|||||||
|
|
||||||
void wxTextCtrl::ShowPosition(long pos)
|
void wxTextCtrl::ShowPosition(long pos)
|
||||||
{
|
{
|
||||||
// TODO
|
#if TARGET_RT_MAC_MACHO && defined(AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
|
||||||
|
if ( m_macUsesTXN )
|
||||||
|
{
|
||||||
|
Point current ;
|
||||||
|
Point desired ;
|
||||||
|
TXNOffset selstart , selend ;
|
||||||
|
TXNGetSelection( (TXNObject) m_macTXN , &selstart , &selend) ;
|
||||||
|
TXNOffsetToPoint( (TXNObject) m_macTXN, selstart , ¤t);
|
||||||
|
TXNOffsetToPoint( (TXNObject) m_macTXN, pos , &desired);
|
||||||
|
//TODO use HIPoints for 10.3 and above
|
||||||
|
if ( (UInt32) TXNScroll != (UInt32) kUnresolvedCFragSymbolAddress )
|
||||||
|
{
|
||||||
|
OSErr theErr = noErr;
|
||||||
|
SInt32 dv = desired.v - current.v ;
|
||||||
|
SInt32 dh = desired.h - current.h ;
|
||||||
|
TXNShowSelection( (TXNObject) m_macTXN , true ) ;
|
||||||
|
theErr = TXNScroll( (TXNObject) m_macTXN, kTXNScrollUnitsInPixels , kTXNScrollUnitsInPixels , &dv , &dh );
|
||||||
|
wxASSERT_MSG( theErr == noErr, _T("TXNScroll returned an error!") );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxTextCtrl::GetLineLength(long lineNo) const
|
int wxTextCtrl::GetLineLength(long lineNo) const
|
||||||
|
Reference in New Issue
Block a user