Fixed the keyboard selection handling (Please remember to maintain m_Selecting

when Starting/Ending/Discarding selection!!!).
Fixed a LineBreak() related bug.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2792 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Karsten Ballüder
1999-06-14 20:02:01 +00:00
parent ef609210f1
commit daa69da89e
3 changed files with 30 additions and 20 deletions

View File

@@ -12,14 +12,11 @@ TODO
===================================================================== =====================================================================
- typedef wxCoords CoordType ??
- merge RecalulateXXX and Layout() into one - merge RecalulateXXX and Layout() into one
- remove UpdateCursorScreenCoords() which is no longer needed
- UNDO!! - UNDO!!
- replacement of llist in window - replacement of llist in window
- selection highlighting is a bit broken
Improve speed! (See layout problem below!) Improve speed! (See layout problem below!)
- wxlwindow needs to shrink scrollbar range when window contents get removed - wxlwindow needs to shrink scrollbar range when window contents get removed
@@ -29,9 +26,6 @@ Improve speed! (See layout problem below!)
- The import of a private data object does not work yet, we need to get - The import of a private data object does not work yet, we need to get
the objects back from the string. the objects back from the string.
- Changing default settings in Clear() or changing/inserting/deleting
a wxLayoutObject needs to update the m_StyleInfo in all lines, only
then can we start using that one.
- update rectangle (needs support in wxllist and wxWindows) - update rectangle (needs support in wxllist and wxWindows)
--> needs a bit of fixing still --> needs a bit of fixing still
@@ -39,6 +33,5 @@ Improve speed! (See layout problem below!)
offset handling seems a bit dodgy, white shadow to top/left of cursor offset handling seems a bit dodgy, white shadow to top/left of cursor
- DragNDrop - DragNDrop
- Update docs, do full rtf/html editing. - Update docs, do full rtf/html editing.
- Verify html export. - Verify/fix html export.

View File

@@ -2048,7 +2048,10 @@ wxLayoutList::LineBreak(void)
height = m_CursorLine->GetHeight(); height = m_CursorLine->GetHeight();
m_CursorLine = m_CursorLine->Break(m_CursorPos.x, this); m_CursorLine = m_CursorLine->Break(m_CursorPos.x, this);
m_CursorPos.y++; if(m_CursorLine->GetPreviousLine() == NULL)
m_FirstLine = m_CursorLine;
if(m_CursorPos.x > 0)
m_CursorPos.y++;
m_CursorPos.x = 0; m_CursorPos.x = 0;
// The following code will produce a height which is guaranteed to // The following code will produce a height which is guaranteed to

View File

@@ -225,7 +225,9 @@ wxLayoutWindow::OnMouse(int eventId, wxMouseEvent& event)
PrepareDC( dc ); PrepareDC( dc );
if ( eventId != WXLOWIN_MENU_MOUSEMOVE ) if ( eventId != WXLOWIN_MENU_MOUSEMOVE )
{ {
// moving the mouse in a window shouldn't give it the focus! // moving the mouse in a window shouldn't give it the focus!
// Oh yes! wxGTK's focus handling is so broken, that this is the
// only sensible way to go.
SetFocus(); SetFocus();
} }
@@ -311,6 +313,7 @@ wxLayoutWindow::OnMouse(int eventId, wxMouseEvent& event)
if ( m_llist->HasSelection() ) if ( m_llist->HasSelection() )
{ {
m_llist->DiscardSelection(); m_llist->DiscardSelection();
m_Selecting = false;
DoPaint(); // TODO: we don't have to redraw everything! DoPaint(); // TODO: we don't have to redraw everything!
} }
@@ -413,11 +416,16 @@ wxLayoutWindow::OnChar(wxKeyEvent& event)
} }
#endif #endif
#if 0
// Force m_Selecting to be false if shift is no longer // Force m_Selecting to be false if shift is no longer
// pressed. OnKeyUp() cannot catch all Shift-Up events. // pressed. OnKeyUp() cannot catch all Shift-Up events.
if(!event.ShiftDown()) if(m_Selecting && !event.ShiftDown())
{
m_Selecting = false; m_Selecting = false;
m_llist->EndSelection();
}
#endif
// If we deleted the selection here, we must not execute the // If we deleted the selection here, we must not execute the
// deletion in Delete/Backspace handling. // deletion in Delete/Backspace handling.
bool deletedSelection = false; bool deletedSelection = false;
@@ -436,17 +444,23 @@ wxLayoutWindow::OnChar(wxKeyEvent& event)
// <Shift>+<arrow> starts selection // <Shift>+<arrow> starts selection
if ( IsDirectionKey(keyCode) ) if ( IsDirectionKey(keyCode) )
{ {
if ( !m_Selecting ) if ( m_Selecting )
{
// just continue the old selection
if( event.ShiftDown() )
m_llist->ContinueSelection();
else
{
m_llist->DiscardSelection();
m_Selecting = false;
}
}
else if( event.ShiftDown() )
{ {
m_Selecting = true; m_Selecting = true;
m_llist->StartSelection(); m_llist->StartSelection();
} }
else
{
// just continue the old selection
if(! event.ShiftDown() )
m_llist->DiscardSelection();
}
} }
// If needed, make cursor visible: // If needed, make cursor visible: