// moved to the end/beginning of text
return false;
}
+
+ offset = -1;
}
wxLayoutObject *obj = *i;
{
// only draw if between top and bottom:
if((top == -1 ||
- line->GetPosition().y + line->GetHeight() >= top))
+ line->GetPosition().y + line->GetHeight() > top))
{
// if(! style_set)
{
ApplyStyle(line->GetStyleInfo(), dc);
style_set = true;
}
+ // little condition to speed up redrawing:
+ if(bottom != -1
+ && line->GetPosition().y+line->GetHeight() >= bottom)
+ break;
line->Draw(dc, this, offset);
}
- // little condition to speed up redrawing:
- if(bottom != -1 && line->GetPosition().y > bottom) break;
line = line->GetNextLine();
}
InvalidateUpdateRect();
bool *found)
{
// First, find the right line:
- wxLayoutLine *line = m_FirstLine;
+ wxLayoutLine
+ *line = m_FirstLine,
+ *lastline = m_FirstLine;
wxPoint p;
ApplyStyle(m_DefaultStyleInfo, dc);
p = line->GetPosition();
if(p.y <= pos.y && p.y+line->GetHeight() >= pos.y)
break;
-#if 0
- // we need to run a layout here to get font sizes right :-(
-
- // VZ: we can't call Layout() from here because it marks the line as
- // clean and it is not refreshed when it's called from wxLayoutList::
- // Layout() - if we really need to do this, we should introduce an
- // extra argument to Layout() to prevent the line from MarkClean()ing
- // itself here
- line->Layout(dc, this);
-#endif
+ lastline = line;
line = line->GetNextLine();
}
+ bool didFind = line != NULL;
+
if ( !line )
{
- if ( found )
- *found = false;
-
- return NULL; // not found
+ // use the last line:
+ line = lastline;
}
if ( cursorPos )
cursorPos->y = line->GetLineNumber();
+ bool foundinline = true;
// Now, find the object in the line:
wxLOiterator i = line->FindObjectScreen(dc, this,
pos.x,
cursorPos ? &cursorPos->x : NULL,
- found);
+ &foundinline);
+ if ( found )
+ *found = didFind && foundinline;
+
return (i == NULLIT) ? NULL : *i;
}
#else // !WXLAYOUT_USE_CARET
dc.SetBrush(*wxWHITE_BRUSH);
//FIXME: wxGTK XOR is borken at the moment!!!dc.SetLogicalFunction(wxXOR);
- dc.SetLogicalFunction(wxXOR);
dc.SetPen(wxPen(*wxBLACK,1,wxSOLID));
if(active)
{
+ dc.SetLogicalFunction(wxXOR);
dc.DrawRectangle(coords.x, coords.y,
m_CursorSize.x, m_CursorSize.y);
SetUpdateRect(coords.x, coords.y);
}
else
{
+ dc.SetLogicalFunction(wxCOPY);
dc.DrawLine(coords.x, coords.y+m_CursorSize.y-1,
coords.x, coords.y);
SetUpdateRect(coords.x, coords.y+m_CursorSize.y-1);
int top, bottom;
top = (page - 1)*m_PrintoutHeight;
bottom = top + m_PrintoutHeight;
+
+ WXLO_DEBUG(("OnPrintPage(%d) printing from %d to %d", page, top,
+ bottom));
// SetDeviceOrigin() doesn't work here, so we need to manually
// translate all coordinates.
wxPoint translate(m_Offset.x,m_Offset.y-top);
float scale = ScaleDC(&psdc);
psdc.GetSize(&m_PageWidth, &m_PageHeight);
- // This sets a left/top origin of 15% and 20%:
- m_Offset = wxPoint((15*m_PageWidth)/100, m_PageHeight/20);
+
+ // This sets a left/top origin of 15% and 5%:
+ m_Offset = wxPoint((15*m_PageWidth)/100, (5*m_PageHeight)/100);
// This is the length of the printable area.
- m_PrintoutHeight = m_PageHeight - (int) (m_PageHeight * 0.15);
+ m_PrintoutHeight = m_PageHeight - 2*m_Offset.y;
m_PrintoutHeight = (int)( m_PrintoutHeight / scale); // we want to use the real paper height
-
+#if 0
+ // We should really use the margin settings of wxWindows somehow.
+ m_Offset = wxPoint(0,0);
+ // This is the length of the printable area.
+ m_PrintoutHeight = m_PageHeight;
+ m_PrintoutHeight = (int)( m_PrintoutHeight / scale); // we want to use the real paper height
+#endif
+
m_NumOfPages = 1 +
(int)( m_llist->GetSize().y / (float)(m_PrintoutHeight));