]> git.saurik.com Git - wxWidgets.git/commitdiff
Ignore Windows key
authorJulian Smart <julian@anthemion.co.uk>
Tue, 20 Feb 2007 07:57:54 +0000 (07:57 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 20 Feb 2007 07:57:54 +0000 (07:57 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44539 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/richtext/richtextctrl.cpp

index 55b8433ad68589721b68382347711a4be90e89ff..2f4ac745e7f7d3e1cbe807af79deb56befa56382 100644 (file)
@@ -141,7 +141,7 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va
 
     GetBuffer().Reset();
     GetBuffer().SetRichTextCtrl(this);
-    
+
     SetCaret(new wxCaret(this, wxRICHTEXT_DEFAULT_CARET_WIDTH, 16));
     GetCaret()->Show();
 
@@ -194,7 +194,7 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va
 wxRichTextCtrl::~wxRichTextCtrl()
 {
     GetBuffer().RemoveEventHandler(this);
-    
+
     delete m_contextMenu;
 }
 
@@ -328,7 +328,7 @@ void wxRichTextCtrl::OnKillFocus(wxFocusEvent& WXUNUSED(event))
 
 void wxRichTextCtrl::OnCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event))
 {
-    m_dragging = false;    
+    m_dragging = false;
 }
 
 /// Left-click
@@ -390,7 +390,7 @@ void wxRichTextCtrl::OnLeftUp(wxMouseEvent& event)
         long position = 0;
         wxPoint logicalPt = event.GetLogicalPosition(dc);
         int hit = GetBuffer().HitTest(dc, logicalPt, position);
-    
+
         if (hit != wxRICHTEXT_HITTEST_NONE)
         {
             wxTextAttrEx attr;
@@ -402,20 +402,20 @@ void wxRichTextCtrl::OnLeftUp(wxMouseEvent& event)
                     if (!urlTarget.IsEmpty())
                     {
                         wxMouseEvent mouseEvent(event);
-                        
+
                         long startPos = 0, endPos = 0;
                         wxRichTextObject* obj = GetBuffer().GetLeafObjectAtPosition(position);
                         if (obj)
                         {
                             startPos = obj->GetRange().GetStart();
                             endPos = obj->GetRange().GetEnd();
-                        }                        
-                        
+                        }
+
                         wxTextUrlEvent urlEvent(GetId(), mouseEvent, startPos, endPos);
                         InitCommandEvent(urlEvent);
 
                         urlEvent.SetString(urlTarget);
-                        
+
                         GetEventHandler()->ProcessEvent(urlEvent);
                     }
                 }
@@ -434,9 +434,9 @@ void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event)
     long position = 0;
     wxPoint logicalPt = event.GetLogicalPosition(dc);
     int hit = GetBuffer().HitTest(dc, logicalPt, position);
-    
+
     // See if we need to change the cursor
-    
+
     {
         if (hit != wxRICHTEXT_HITTEST_NONE && !(hit & wxRICHTEXT_HITTEST_OUTSIDE))
         {
@@ -590,7 +590,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
             // Generate conventional event
             wxCommandEvent textEvent(wxEVT_COMMAND_TEXT_ENTER, GetId());
             InitCommandEvent(textEvent);
-            
+
             GetEventHandler()->ProcessEvent(textEvent);
         }
         Update();
@@ -598,7 +598,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
     else if (event.GetKeyCode() == WXK_BACK)
     {
         BeginBatchUndo(_("Delete Text"));
-        
+
         // Submit range in character positions, which are greater than caret positions,
         // so subtract 1 for deleted character and add 1 for conversion to character position.
         if (m_caretPosition > -1 && !HasSelection())
@@ -670,7 +670,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
         switch ( keycode )
         {
             case WXK_ESCAPE:
-            // case WXK_SPACE:
             case WXK_DELETE:
             case WXK_START:
             case WXK_LBUTTON:
@@ -764,6 +763,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
             case WXK_NUMPAD_SEPARATOR:
             case WXK_NUMPAD_SUBTRACT:
             case WXK_NUMPAD_DECIMAL:
+            case WXK_WINDOWS_LEFT:
             {
                 event.Skip();
                 return;
@@ -784,7 +784,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
                 cmdEvent.SetFlags(flags);
                 cmdEvent.SetCharacter((wxChar) keycode);
                 cmdEvent.SetPosition(m_caretPosition+1);
-                
+
                 if (keycode == wxT('\t'))
                 {
                     // See if we need to promote or demote the selection or paragraph at the cursor
@@ -821,7 +821,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
 
                 SetDefaultStyleToCursorStyle();
                 ScrollIntoView(m_caretPosition, WXK_RIGHT);
-                
+
                 GetEventHandler()->ProcessEvent(cmdEvent);
 
                 Update();
@@ -2681,6 +2681,10 @@ bool wxRichTextCtrl::GetCaretPositionForIndex(long position, wxRect& rect)
 
     if (GetBuffer().FindPosition(dc, position, pt, & height, m_caretAtLineStart))
     {
+        // Caret height can't be zero
+        if (height == 0)
+            height = dc.GetCharHeight();
+
         rect = wxRect(pt, wxSize(wxRICHTEXT_DEFAULT_CARET_WIDTH, height));
         return true;
     }