dc.SetLogicalFunction(wxXOR);
dc.SetPen(wxPen(*wxBLACK,1,wxSOLID));
if(active)
- dc.DrawRectangle(coords.x, coords.y, m_CursorSize.x,
- m_CursorSize.y);
+ {
+ dc.DrawRectangle(coords.x, coords.y,
+ m_CursorSize.x, m_CursorSize.y);
+ SetUpdateRect(coords.x, coords.y);
+ SetUpdateRect(coords.x+m_CursorSize.x, coords.y+m_CursorSize.y);
+ }
else
+ {
dc.DrawLine(coords.x, coords.y+m_CursorSize.y-1,
coords.x+m_CursorSize.x, coords.y+m_CursorSize.y-1);
+ SetUpdateRect(coords.x, coords.y+m_CursorSize.y-1);
+ SetUpdateRect(coords.x+m_CursorSize.x, coords.y+m_CursorSize.y-1);
+ }
dc.SetLogicalFunction(wxCOPY);
//dc.SetBrush(wxNullBrush);
}
if(findPos.y < 0) findPos.y = 0;
m_ClickPosition = wxPoint(event.GetX(), event.GetY());
-#ifdef WXLAYOUT_DEBUG
-// wxLogDebug("wxLayoutWindow::OnMouse: (%d, %d) -> (%d, %d)",
-// event.GetX(), event.GetY(), findPos.x, findPos.y);
-#endif
wxPoint cursorPos;
bool found;
wxLayoutObject *obj = m_llist->FindObjectScreen(dc, findPos,
&cursorPos, &found);
-#ifdef WXLAYOUT_DEBUG
-// if(obj)
-// wxLogDebug("wxLayoutWindow::OnMouse: Found object of type %d.",
-// obj->GetType());
-// else
-// wxLogDebug("wxLayoutWindow::OnMouse: Found no object.");
-#endif
-
//has the mouse only been moved?
if(eventId == WXLOWIN_MENU_MOUSEMOVE)
{
ny = cc.y - y1/2; if(ny < 0) ny = 0;
Scroll(nx/dx,ny/dy); // new view start
x0 = nx; y0 = ny;
+ m_ScrollToCursor = false; // avoid recursion
+ Refresh(FALSE); /// Re-entering this function!
}
}
// Device origins on the memDC are suspect, we translate manually
// with the translate parameter of Draw().
m_memDC->SetDeviceOrigin(0,0);
- m_memDC->SetBrush(wxBrush(m_llist->GetDefaults()->GetBGColour(), wxSOLID));
- m_memDC->SetPen(wxPen(m_llist->GetDefaults()->GetBGColour(),0,wxTRANSPARENT));
+ m_memDC->SetBrush(wxBrush(m_llist->GetDefaults()->GetBGColour(),wxSOLID));
+ m_memDC->SetPen(wxPen(m_llist->GetDefaults()->GetBGColour(),
+ 0,wxTRANSPARENT));
m_memDC->SetLogicalFunction(wxCOPY);
+
+ /* Either fill the background with the background bitmap, or clear
+ it. */
if(m_BGbitmap)
{
CoordType
}
else
{
+ // clear the background: (must not be done if we use the update rectangle!)
m_memDC->SetBackgroundMode(wxSOLID);
m_memDC->DrawRectangle(0,0,x1, y1);
}
wxPoint offset(-x0+WXLO_XOFFSET,-y0+WXLO_YOFFSET);
m_llist->Draw(*m_memDC,offset, y0, y0+y1);
+ // We start calculating a new update rect before drawing the
+ // cursor, so that the cursor coordinates get included in the next
+ // update rectangle:
+ m_llist->InvalidateUpdateRect();
+ if(IsEditable()) //we draw the cursor
+ m_llist->DrawCursor(*m_memDC,m_HaveFocus,offset);
// Now copy everything to the screen:
#if 0
- //FIXME:
- // 1. the update region as calculated by the list is wrong
- // 2. we get wrong values here
- // 3. how about the offset?
+ // This somehow doesn't work, but even the following bit with the
+ // whole rect at once is still a bit broken I think.
wxRegionIterator ri ( GetUpdateRegion() );
if(ri)
while(ri)
// y1 += WXLO_YOFFSET; //FIXME might not be needed
dc.Blit(x0,y0,x1,y1,m_memDC,0,0,wxCOPY,FALSE);
}
- //FIXME: we need to make sure we blit draw the cursor!
- // How about drawing it directly to the screen?
- if(IsEditable())
- //m_llist->DrawCursor(*m_memDC,m_HaveFocus,offset);
- m_llist->DrawCursor(dc,m_HaveFocus, wxPoint(WXLO_XOFFSET,WXLO_YOFFSET)); //direct to screen
ResetDirty();
m_ScrollToCursor = false;
- m_llist->InvalidateUpdateRect();
}
-// change the range and position of scroll bars
+// change the range and position of scrollbars
void
wxLayoutWindow::ResizeScrollbars(bool exact)
{
wxTheClipboard->Close();
}
#if 0
- /* Unfortunately, this little hack doesn't work. So I'll go back to
- pure X11. */
+ /* My attempt to get the primary selection, but it does not
+ work. :-( */
if(text.Length() == 0)
{
wxTextCtrl tmp_tctrl(this,-1);