workaround for counterintuitive wxString::operator[] behaviour

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2066 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Karsten Ballüder
1999-04-07 17:02:25 +00:00
parent d2c7e39b9b
commit 614ed50d20

View File

@@ -6,6 +6,10 @@
* $Id$ * $Id$
*******************************************************************/ *******************************************************************/
/*
*/
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "wxllist.h" #pragma implementation "wxllist.h"
#endif #endif
@@ -15,13 +19,13 @@
# pragma hdrstop # pragma hdrstop
#endif #endif
//#include "Mpch.h" //#include "Mpch.h"
#ifdef M_PREFIX #ifdef M_PREFIX
# include "gui/wxllist.h" # include "gui/wxllist.h"
#else #else
# include "wxllist.h" # include "wxllist.h"
#endif #endif
#ifndef USE_PCH #ifndef USE_PCH
# include "iostream.h" # include "iostream.h"
# include <wx/dc.h> # include <wx/dc.h>
@@ -302,7 +306,7 @@ wxLayoutObjectCmd::Layout(wxDC &dc)
wxLayoutLine::wxLayoutLine(wxLayoutLine *prev) wxLayoutLine::wxLayoutLine(wxLayoutLine *prev)
{ {
m_LineNumber = 0; m_LineNumber = 0;
m_Height = 0; m_Width = m_Height = 0;
m_Length = 0; m_Length = 0;
m_Dirty = true; m_Dirty = true;
m_Previous = prev; m_Previous = prev;
@@ -568,9 +572,9 @@ wxLayoutLine::DeleteWord(CoordType xpos)
str = str.substr(offset,str.Length()-offset); str = str.substr(offset,str.Length()-offset);
// Find out how many positions we need to delete: // Find out how many positions we need to delete:
// 1. eat leading space // 1. eat leading space
while(isspace(str[count])) count++; while(isspace(str.c_str()[count])) count++;
// 2. eat the word itself: // 2. eat the word itself:
while(isalnum(str[count])) count++; while(isalnum(str.c_str()[count])) count++;
// now delete it: // now delete it:
wxASSERT(count+offset <= (size_t) (**i).GetLength()); wxASSERT(count+offset <= (size_t) (**i).GetLength());
((wxLayoutObjectText *)*i)->GetText().erase(offset,count); ((wxLayoutObjectText *)*i)->GetText().erase(offset,count);
@@ -833,7 +837,7 @@ wxLayoutLine::GetWrapPosition(CoordType column)
{ {
do do
{ {
if( isspace(((wxLayoutObjectText*)*i)->GetText()[(size_t)offset])) if( isspace(((wxLayoutObjectText*)*i)->GetText().c_str()[(size_t)offset]))
return column; return column;
else else
{ {
@@ -893,6 +897,7 @@ wxLayoutList::wxLayoutList()
wxLayoutList::~wxLayoutList() wxLayoutList::~wxLayoutList()
{ {
InternalClear(); InternalClear();
m_FirstLine->DeleteLine(false);
} }
void void
@@ -1482,8 +1487,8 @@ void wxLayoutPrintout::GetPageInfo(int *minPage, int *maxPage, int *selPageFrom,
float scale = ScaleDC(&psdc); float scale = ScaleDC(&psdc);
psdc.GetSize(&m_PageWidth, &m_PageHeight); psdc.GetSize(&m_PageWidth, &m_PageHeight);
// This sets a left/top origin of 10% and 5%: // This sets a left/top origin of 15% and 20%:
m_Offset = wxPoint(m_PageWidth/10, m_PageHeight/20); m_Offset = wxPoint((15*m_PageWidth)/100, m_PageHeight/20);
// This is the length of the printable area. // This is the length of the printable area.
m_PrintoutHeight = m_PageHeight - (int) (m_PageHeight * 0.15); m_PrintoutHeight = m_PageHeight - (int) (m_PageHeight * 0.15);