&width, &height, &descent);
offs++;
}
- /* We have to substract 1 to compensate for the offs++, and another
+ /* We have to subtract 1 to compensate for the offs++, and another
one because we don't want to position the cursor behind the
object what we clicked on, but before - otherwise it looks
funny. */
llist->IncNumLines();
}
-wxLayoutLine::~wxLayoutLine()
-{
- // kbList cleans itself
-}
-
wxPoint
wxLayoutLine::RecalculatePosition(wxLayoutList *llist)
{
wxASSERT(offset);
wxLayoutObjectList::iterator
i,
- found = NULLIT;
+ found(NULL),
+ nulled(NULL);
CoordType x = 0, len;
/* We search through the objects. As we don't like returning the
object that the cursor is behind, we just remember such an
object in "found" so we can return it if there is really no
further object following it. */
- for(i = m_ObjectList.begin(); i != NULLIT; i++)
+ for(i = m_ObjectList.begin(); i != nulled; i++)
{
len = (**i).GetLength();
if( x <= xpos && xpos <= x + len )
llist->ApplyStyle(GetStyleInfo(), dc);
- wxLayoutObjectList::iterator i;
+ wxLayoutObjectList::iterator i, nulled(NULL);
CoordType x = 0, cx = 0, width;
- for(i = m_ObjectList.begin(); i != NULLIT; i++)
+ for(i = m_ObjectList.begin(); i != nulled; i++)
{
wxLayoutObject *obj = *i;
if ( obj->GetType() == WXLO_TYPE_CMD )
CoordType offset;
wxLOiterator i = FindObject(xpos, &offset);
- if(i == NULLIT)
+ wxLayoutObjectList::iterator nulled(NULL);
+ if(i == nulled)
{
if(xpos == 0 ) // aha, empty line!
{
CoordType offset;
wxLOiterator i = FindObject(xpos, &offset);
- if(i != NULLIT && (**i).GetType() == WXLO_TYPE_TEXT)
+ wxLayoutObjectList::iterator nulled(NULL);
+ if(i != nulled && (**i).GetType() == WXLO_TYPE_TEXT)
{
wxLayoutObjectText *tobj = (wxLayoutObjectText *) *i;
tobj->GetText().insert(offset, text);
wxASSERT(npos >= 0);
MarkDirty(xpos);
wxLOiterator i = FindObject(xpos, &offset);
+ wxLayoutObjectList::iterator nulled(NULL);
while(npos > 0)
{
- if(i == NULLIT) return npos;
+ if(i == nulled) return npos;
// now delete from that object:
if((**i).GetType() != WXLO_TYPE_TEXT)
{
MarkDirty(xpos);
wxLOiterator i = FindObject(xpos, &offset);
-
+ wxLayoutObjectList::iterator nulled(NULL);
for(;;)
{
- if(i == NULLIT) return false;
+ if(i == nulled) return false;
if((**i).GetType() != WXLO_TYPE_TEXT)
{
// This should only happen when at end of line, behind a non-text
wxLayoutList *llist,
const wxPoint & offset) const
{
- wxLayoutObjectList::iterator i;
+ wxLayoutObjectList::iterator i, nulled(NULL);
wxPoint pos = offset;
pos = pos + GetPosition();
else
llist->EndHighlighting(dc);
- for(i = m_ObjectList.begin(); i != NULLIT; i++)
+ for(i = m_ObjectList.begin(); i != nulled; i++)
{
if(highlight == -1) // partially highlight line
{
int cx,
bool WXUNUSED(suppressSIupdate))
{
- wxLayoutObjectList::iterator i;
+ wxLayoutObjectList::iterator i, nulled(NULL);
// when a line becomes dirty, we redraw it from the place where it was
// changed till the end of line (because the following wxLayoutObjects are
}
m_StyleInfo = llist->GetStyleInfo(); // save current style
- for(i = m_ObjectList.begin(); i != NULLIT; i++)
+ for(i = m_ObjectList.begin(); i != nulled; i++)
{
wxLayoutObject *obj = *i;
obj->Layout(dc, llist);
CoordType offset;
wxLOiterator i = FindObject(xpos, &offset);
- if(i == NULLIT)
+ wxLayoutObjectList::iterator nulled(NULL);
+ if(i == nulled)
// must be at the end of the line then
return new wxLayoutLine(this, llist);
// split this line:
bool
wxLayoutLine::Wrap(CoordType wrapmargin, wxLayoutList *llist)
{
+ wxLayoutObjectList::iterator nulled(NULL);
if(GetLength() < wrapmargin)
return false; // nothing to do
// find the object which covers the wrapmargin:
CoordType offset;
wxLOiterator i = FindObject(wrapmargin, &offset);
- wxCHECK_MSG( i != NULLIT, false,
+ wxCHECK_MSG( i != nulled, false,
wxT("Cannot find object covering wrapmargin."));
// from this object on, the rest of the line must be copied to the
// next one:
- wxLOiterator copyObject = NULLIT;
+ wxLOiterator copyObject = nulled;
// if we split a text-object, we must pre-pend some text to the
// next line later on, remember it here:
wxString prependText = _T("");
bool foundSpace = false;
do
{
-// while(i != NULLIT && (**i).GetType() != WXLO_TYPE_TEXT)
+// while(i != nulled && (**i).GetType() != WXLO_TYPE_TEXT)
// i--;
// try to find a suitable place to split the object:
wxLayoutObjectText *tobj = (wxLayoutObjectText *)*i;
if( this == llist->GetCursorLine() && xpos >= breakpos )
{
for(wxLOiterator j = m_ObjectList.begin();
- j != NULLIT && j != i; j++)
+ j != nulled && j != i; j++)
objectCursorPos += (**j).GetLength();
}
// now we know where to break it:
wxASSERT(m_Next);
// We need to move this and all following objects to the next
// line. Starting from the end of line, to keep the order right.
- if(copyObject != NULLIT)
+ if(copyObject != nulled)
{
wxLOiterator j;
for(j = m_ObjectList.tail(); j != copyObject; j--)
{
CoordType offset;
wxLOiterator i = FindObject(column, &offset);
- if(i == NULLIT) return -1; // cannot wrap
+ wxLayoutObjectList::iterator nulled(NULL);
+ if(i == nulled) return -1; // cannot wrap
// go backwards through the list and look for space in text objects
do
column -= (**i).GetLength();
i--;
}
- if( i != NULLIT)
+ if( i != nulled)
offset = (**i).GetLength();
- }while(i != NULLIT);
+ }while(i != nulled);
/* If we reached the begin of the list and have more than one
object, that one is longer than the margin, so break behind
it. */
CoordType pos = 0;
i = m_ObjectList.begin();
- while(i != NULLIT && (**i).GetType() != WXLO_TYPE_TEXT)
+ while(i != nulled && (**i).GetType() != WXLO_TYPE_TEXT)
{
pos += (**i).GetLength();
i++;
}
- if(i == NULLIT) return -1; //why should this happen?
+ if(i == nulled) return -1; //why should this happen?
// now we are behind the one long text object and need to find the
// first space in it
void
wxLayoutLine::Debug() const
{
+ wxLayoutObjectList::iterator nulled(NULL);
wxPoint pos = GetPosition();
WXLO_DEBUG((wxT("Line %ld, Pos (%ld,%ld), Height %ld, BL %ld, Font: %d"),
(long int) GetLineNumber(),
(long int) GetHeight(),
(long int) m_BaseLine,
(int) m_StyleInfo.family));
- if(m_ObjectList.begin() != NULLIT)
+ if(m_ObjectList.begin() != nulled)
{
WXLO_DEBUG(((**m_ObjectList.begin()).DebugDump().c_str()));
}
CoordType from,
CoordType to)
{
+ wxLayoutObjectList::iterator nulled(NULL);
CoordType firstOffset, lastOffset;
if(to == -1) to = GetLength();
wxLOiterator last = FindObject(to, &lastOffset);
// Common special case: only one object
- if( first != NULLIT && last != NULLIT && *first == *last )
+ if( first != nulled && last != nulled && *first == *last )
{
if( (**first).GetType() == WXLO_TYPE_TEXT )
{
bool
wxLayoutList::MoveCursorWord(int n, bool untilNext)
{
+ wxLayoutObjectList::iterator nulled(NULL);
wxCHECK_MSG( m_CursorLine, false, wxT("no current line") );
wxCHECK_MSG( n == -1 || n == +1, false, wxT("not implemented yet") );
n != 0;
n > 0 ? i++ : i-- )
{
- if ( i == NULLIT )
+ if ( i == nulled )
{
if ( n > 0 )
{
i = lineCur->GetLastObject();
}
- if ( i == NULLIT )
+ if ( i == nulled )
{
// moved to the end/beginning of text
return false;
CoordType moveDelta = p - start - offset;
if ( (n < 0) && (offset == tobj->GetLength() - 1) )
{
- // because we substracted 1 from offset in this case above, now
+ // because we subtracted 1 from offset in this case above, now
// compensate for it
moveDelta--;
}
bool
wxLayoutList::Insert(wxLayoutList *llist)
{
+ wxLayoutObjectList::iterator nulled(NULL);
wxASSERT(llist);
bool rc = true;
)
{
for(wxLOiterator i = line->GetFirstObject();
- i != NULLIT;
+ i != nulled;
i++)
rc |= Insert(*i);
LineBreak();
wxLayoutList::FindObjectScreen(wxDC &dc, wxPoint const pos,
wxPoint *cursorPos, bool *found)
{
+ wxLayoutObjectList::iterator nulled(NULL);
// First, find the right line:
wxLayoutLine
*line = m_FirstLine,
if ( found )
*found = didFind && foundinline;
- return (i == NULLIT) ? NULL : *i;
+ return (i == nulled) ? NULL : *i;
}
// layout is called in ScaleDC() when we have a DC
}
-wxLayoutPrintout::~wxLayoutPrintout()
-{
-}
-
float
wxLayoutPrintout::ScaleDC(wxDC *dc)
{
/* We allocate a temporary wxDC for printing, so that we can
determine the correct paper size and scaling. We don't actually
print anything on it. */
-#if defined(__WXMSW__)
+#if defined(__WXMSW__) || defined(__WXMAC__)
wxPrinterDC *psdc = new wxPrinterDC(wxEmptyString,wxEmptyString,_T(WXLLIST_TEMPFILE),false);
#else
- wxPostScriptDC *psdc = new wxPostScriptDC(WXLLIST_TEMPFILE,false);
+ wxPrintData data;
+ data.SetFilename(WXLLIST_TEMPFILE);
+ wxPostScriptDC *psdc = new wxPostScriptDC(data);
#endif
psdc->StartDoc(m_title);