compile and cursor positioning fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2718 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
c455ab932f
commit
96eb3b1a82
@ -2085,47 +2085,24 @@ wxLayoutList::Recalculate(wxDC &dc, CoordType bottom)
|
||||
}
|
||||
|
||||
void
|
||||
wxLayoutList::UpdateCursorScreenPos(wxDC &dc,
|
||||
bool resetCursorMovedFlag,
|
||||
const wxPoint& translate)
|
||||
wxLayoutList::UpdateCursorScreenPos(wxDC &dc)
|
||||
{
|
||||
wxCHECK_RET( m_CursorLine, "no cursor line" );
|
||||
|
||||
if ( m_movedCursor )
|
||||
{
|
||||
// we need to save the current style, in case the layout() of
|
||||
// the line changes it
|
||||
wxLayoutStyleInfo SiBackup = m_CurrentStyleInfo;
|
||||
m_CursorLine->Layout(dc, this,
|
||||
&m_CursorScreenPos, &m_CursorSize,
|
||||
m_CursorPos.x,
|
||||
/* suppress update */ true);
|
||||
ApplyStyle(SiBackup, dc); // restore it
|
||||
|
||||
if ( resetCursorMovedFlag )
|
||||
{
|
||||
#ifdef WXLAYOUT_USE_CARET
|
||||
// adjust the caret position
|
||||
wxPoint coords(m_CursorScreenPos);
|
||||
coords += translate;
|
||||
|
||||
// and set it
|
||||
m_caret->Move(coords);
|
||||
#endif // WXLAYOUT_USE_CARET
|
||||
|
||||
m_movedCursor = false;
|
||||
}
|
||||
}
|
||||
// we need to save the current style, in case the layout() of the line
|
||||
// changes it
|
||||
wxLayoutStyleInfo SiBackup = m_CurrentStyleInfo;
|
||||
m_CursorLine->Layout(dc, this,
|
||||
&m_CursorScreenPos, &m_CursorSize,
|
||||
m_CursorPos.x,
|
||||
true /* suppress update */);
|
||||
ApplyStyle(SiBackup, dc); // restore it
|
||||
}
|
||||
|
||||
wxPoint
|
||||
wxLayoutList::GetCursorScreenPos(wxDC &dc)
|
||||
{
|
||||
// this function is called with wxMemoryDC argument from ScrollToCursor(),
|
||||
// for example, so it shouldn't clear "cursor moved" flag - or else the
|
||||
// cursor won't be moved when UpdateCursorScreenPos() is called with the
|
||||
// "real" (i.e. the one used for drawing) wxDC.
|
||||
UpdateCursorScreenPos(dc, false /* don't reset the flag */);
|
||||
UpdateCursorScreenPos(dc);
|
||||
|
||||
return m_CursorScreenPos;
|
||||
}
|
||||
@ -2136,8 +2113,7 @@ wxLayoutList::GetCursorScreenPos(wxDC &dc)
|
||||
*/
|
||||
void
|
||||
wxLayoutList::Layout(wxDC &dc, CoordType bottom, bool forceAll,
|
||||
wxPoint *cpos = NULL,
|
||||
wxPoint *csize = NULL)
|
||||
wxPoint *cpos, wxPoint *csize)
|
||||
{
|
||||
// first, make sure everything is calculated - this might not be
|
||||
// needed, optimise it later
|
||||
@ -2184,7 +2160,7 @@ wxLayoutList::Layout(wxDC &dc, CoordType bottom, bool forceAll,
|
||||
}
|
||||
|
||||
wxPoint
|
||||
wxLayoutList::GetScreenPos(wxDC &dc, const wxPoint &cpos, wxPoint *csize = NULL)
|
||||
wxLayoutList::GetScreenPos(wxDC &dc, const wxPoint &cpos, wxPoint *csize)
|
||||
{
|
||||
wxPoint pos = cpos;
|
||||
Layout(dc, -1, false, &pos, csize);
|
||||
@ -2320,6 +2296,13 @@ wxLayoutList::GetSize(void) const
|
||||
void
|
||||
wxLayoutList::DrawCursor(wxDC &dc, bool active, wxPoint const &translate)
|
||||
{
|
||||
if ( m_movedCursor )
|
||||
{
|
||||
UpdateCursorScreenPos(dc);
|
||||
|
||||
m_movedCursor = false;
|
||||
}
|
||||
|
||||
wxPoint coords(m_CursorScreenPos);
|
||||
coords += translate;
|
||||
|
||||
@ -2334,7 +2317,9 @@ wxLayoutList::DrawCursor(wxDC &dc, bool active, wxPoint const &translate)
|
||||
wxLogStatus("Cursor is at (%d, %d)", m_CursorPos.x, m_CursorPos.y);
|
||||
#endif
|
||||
|
||||
#ifndef WXLAYOUT_USE_CARET
|
||||
#ifdef WXLAYOUT_USE_CARET
|
||||
m_caret->Move(coords);
|
||||
#else // !WXLAYOUT_USE_CARET
|
||||
dc.SetBrush(*wxBLACK_BRUSH);
|
||||
dc.SetLogicalFunction(wxXOR);
|
||||
dc.SetPen(wxPen(*wxBLACK,1,wxSOLID));
|
||||
|
@ -948,7 +948,7 @@ public:
|
||||
@return The cursor position on the DC.
|
||||
*/
|
||||
wxPoint GetScreenPos(wxDC &dc, const wxPoint &cpos, wxPoint *csize = NULL);
|
||||
|
||||
|
||||
/** Calculates new sizes for everything in the list, like Layout()
|
||||
but this is needed after the list got changed.
|
||||
@param dc the wxDC to draw on
|
||||
@ -968,16 +968,11 @@ public:
|
||||
@return cursor position in pixels
|
||||
*/
|
||||
wxPoint GetCursorScreenPos(wxDC &dc);
|
||||
|
||||
/** Calculates the cursor position on the screen.
|
||||
@param dc the dc to use for cursor position calculations
|
||||
@param resetCursorMovedFlag: if true, reset "cursor moved" flag
|
||||
@param translate optional translation of cursor coords on screen
|
||||
|
||||
*/
|
||||
void UpdateCursorScreenPos(wxDC &dc,
|
||||
bool resetCursorMovedFlag = true,
|
||||
const wxPoint& translate = wxPoint(0,
|
||||
0));
|
||||
void UpdateCursorScreenPos(wxDC &dc);
|
||||
|
||||
/** Draws the cursor.
|
||||
@param active If true, draw a bold cursor to mark window as
|
||||
|
@ -288,11 +288,16 @@ wxLayoutWindow::OnMouse(int eventId, wxMouseEvent& event)
|
||||
x0 *= dx; y0 *= dy;
|
||||
|
||||
wxPoint offset(-x0+WXLO_XOFFSET, -y0+WXLO_YOFFSET);
|
||||
m_llist->UpdateCursorScreenPos(dc, true, offset);
|
||||
|
||||
if(m_CursorVisibility == -1)
|
||||
m_CursorVisibility = 1;
|
||||
|
||||
if(m_CursorVisibility != 0)
|
||||
{
|
||||
// draw a thick cursor for editable windows with focus
|
||||
m_llist->DrawCursor(dc, m_HaveFocus && IsEditable(), offset);
|
||||
}
|
||||
|
||||
// VZ: this should be unnecessary because mouse can only click on a
|
||||
// visible part of the canvas
|
||||
#if 0
|
||||
@ -620,10 +625,11 @@ wxLayoutWindow::OnPaint( wxPaintEvent &WXUNUSED(event))
|
||||
void
|
||||
wxLayoutWindow::DoPaint(const wxRect *updateRect)
|
||||
{
|
||||
#ifndef __WXMSW__
|
||||
// Causes bad flicker under wxGTK!!!
|
||||
#ifdef __WXGTK__
|
||||
InternalPaint(updateRect);
|
||||
#else
|
||||
Refresh(FALSE, updateRect); // Causes bad flicker under wxGTK!!!
|
||||
Refresh(FALSE); //, updateRect);
|
||||
|
||||
if ( !::UpdateWindow(GetHwnd()) )
|
||||
wxLogLastError("UpdateWindow");
|
||||
@ -722,10 +728,9 @@ wxLayoutWindow::InternalPaint(const wxRect *updateRect)
|
||||
m_llist->InvalidateUpdateRect();
|
||||
if(m_CursorVisibility != 0)
|
||||
{
|
||||
m_llist->UpdateCursorScreenPos(dc, true, offset);
|
||||
// draw a thick cursor for editable windows with focus
|
||||
m_llist->DrawCursor(*m_memDC,
|
||||
m_HaveFocus && IsEditable(), // draw a thick
|
||||
// cursor for editable windows with focus
|
||||
m_HaveFocus && IsEditable(),
|
||||
offset);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user