git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2852
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
TODO
=====================================================================
TODO
=====================================================================
+- use printsetup margins
- merge RecalulateXXX and Layout() into one
- merge RecalulateXXX and Layout() into one
{
wxColour colBg(0, 255, 255);
{
wxColour colBg(0, 255, 255);
- m_lwin->Clear(wxROMAN,16,wxNORMAL,wxNORMAL, false, wxGREEN, &colBg);
+ m_lwin->Clear(wxROMAN,16,wxNORMAL,wxNORMAL, false, wxRED, &colBg);
{
wxString line;
wxLayoutList *llist = m_lwin->GetLayoutList();
{
wxString line;
wxLayoutList *llist = m_lwin->GetLayoutList();
- for(int i = 1; i < 5000; i++)
+ for(int i = 1; i < 300; i++)
{
line.Printf("This is line number %d.", i);
llist->Insert(line);
{
line.Printf("This is line number %d.", i);
llist->Insert(line);
{
// only draw if between top and bottom:
if((top == -1 ||
{
// 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;
}
{
// 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);
}
line->Draw(dc, this, offset);
}
- // little condition to speed up redrawing:
- if(bottom != -1 && line->GetPosition().y > bottom) break;
line = line->GetNextLine();
}
InvalidateUpdateRect();
line = line->GetNextLine();
}
InvalidateUpdateRect();
bool *found)
{
// First, find the right line:
bool *found)
{
// First, find the right line:
- wxLayoutLine *line = m_FirstLine;
+ wxLayoutLine
+ *line = m_FirstLine,
+ *lastline = m_FirstLine;
wxPoint p;
ApplyStyle(m_DefaultStyleInfo, dc);
wxPoint p;
ApplyStyle(m_DefaultStyleInfo, dc);
p = line->GetPosition();
if(p.y <= pos.y && p.y+line->GetHeight() >= pos.y)
break;
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
line = line->GetNextLine();
}
line = line->GetNextLine();
}
{
if ( found )
*found = false;
{
if ( found )
*found = false;
-
- return NULL; // not found
+ // use the last line:
+ line = lastline;
}
if ( cursorPos )
cursorPos->y = line->GetLineNumber();
}
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,
// Now, find the object in the line:
wxLOiterator i = line->FindObjectScreen(dc, this,
pos.x,
cursorPos ? &cursorPos->x : NULL,
+ &foundinline);
+ if(found)
+ *found = *found && foundinline;
return (i == NULLIT) ? NULL : *i;
}
return (i == NULLIT) ? NULL : *i;
}
int top, bottom;
top = (page - 1)*m_PrintoutHeight;
bottom = top + m_PrintoutHeight;
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);
// 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);
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 10% and 7%:
+ m_Offset = wxPoint((10*m_PageWidth)/100, (7*m_PageHeight)/100);
// 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 - 2*m_Offset.y;
m_PrintoutHeight = (int)( m_PrintoutHeight / scale); // we want to use the real paper height
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));
m_NumOfPages = 1 +
(int)( m_llist->GetSize().y / (float)(m_PrintoutHeight));
case WXLOWIN_MENU_LDOWN:
{
// always move cursor to mouse click:
case WXLOWIN_MENU_LDOWN:
{
// always move cursor to mouse click:
{
// we have found the real position
m_llist->MoveCursorTo(cursorPos);
}
{
// we have found the real position
m_llist->MoveCursorTo(cursorPos);
}
- else
- {
- // click beyond the end of the text
- m_llist->MoveCursorToEnd();
- }
+// else
+// {
+// // click beyond the end of the text
+// m_llist->MoveCursorToEnd();
+// }
// clicking a mouse removes the selection
if ( m_llist->HasSelection() )
// clicking a mouse removes the selection
if ( m_llist->HasSelection() )
m_llist->StartSelection();
m_llist->MoveCursorWord(1, false);
m_llist->EndSelection();
m_llist->StartSelection();
m_llist->MoveCursorWord(1, false);
m_llist->EndSelection();
DoPaint(); // TODO: we don't have to redraw everything!
break;
}
DoPaint(); // TODO: we don't have to redraw everything!
break;
}