X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/addcf76c65f61c5955652615b4acbf06a0aec621..9a6d14383a57771a334f6d0b6376dd47bf24049d:/src/richtext/richtextctrl.cpp diff --git a/src/richtext/richtextctrl.cpp b/src/richtext/richtextctrl.cpp index b3395fe20b..ff48ec1d7d 100644 --- a/src/richtext/richtextctrl.cpp +++ b/src/richtext/richtextctrl.cpp @@ -216,8 +216,6 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va attributes.SetLineSpacing(10); attributes.SetParagraphSpacingAfter(10); attributes.SetParagraphSpacingBefore(0); - attributes.SetTextEffects(0); - attributes.SetTextEffectFlags(wxTEXT_ATTR_EFFECT_STRIKETHROUGH|wxTEXT_ATTR_EFFECT_CAPITALS); SetBasicStyle(attributes); @@ -458,6 +456,7 @@ void wxRichTextCtrl::OnLeftClick(wxMouseEvent& event) long oldCaretPos = m_caretPosition; MoveCaret(position, caretAtLineStart); + SetDefaultStyleToCursorStyle(); if (event.ShiftDown()) { @@ -596,6 +595,7 @@ void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event) ExtendSelection(m_caretPosition, position, wxRICHTEXT_SHIFT_DOWN); MoveCaret(position, caretAtLineStart); + SetDefaultStyleToCursorStyle(); } } } @@ -686,7 +686,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) if (event.GetKeyCode() == WXK_RETURN) { - SetDefaultStyleToCursorStyle(); BeginBatchUndo(_("Insert Text")); long newPos = m_caretPosition; @@ -698,11 +697,14 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) wxString text; text = wxRichTextLineBreakChar; GetBuffer().InsertTextWithUndo(newPos+1, text, this); + m_caretAtLineStart = true; + PositionCaret(); } else GetBuffer().InsertNewlineWithUndo(newPos+1, this, wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE|wxRICHTEXT_INSERT_INTERACTIVE); EndBatchUndo(); + SetDefaultStyleToCursorStyle(); ScrollIntoView(m_caretPosition, WXK_RIGHT); @@ -756,6 +758,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) m_caretPosition = -1; PositionCaret(); + SetDefaultStyleToCursorStyle(); } ScrollIntoView(m_caretPosition, WXK_LEFT); @@ -790,6 +793,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) m_caretPosition = -1; PositionCaret(); + SetDefaultStyleToCursorStyle(); } wxRichTextEvent cmdEvent( @@ -951,7 +955,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) } } - SetDefaultStyleToCursorStyle(); BeginBatchUndo(_("Insert Text")); long newPos = m_caretPosition; @@ -966,6 +969,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event) EndBatchUndo(); + SetDefaultStyleToCursorStyle(); ScrollIntoView(m_caretPosition, WXK_RIGHT); GetEventHandler()->ProcessEvent(cmdEvent); @@ -1082,6 +1086,7 @@ bool wxRichTextCtrl::KeyboardNavigate(int keyCode, int flags) if (success) { ScrollIntoView(m_caretPosition, keyCode); + SetDefaultStyleToCursorStyle(); } return success; @@ -1303,11 +1308,13 @@ void wxRichTextCtrl::MoveCaretForward(long oldPosition) m_caretPosition = oldPosition; m_caretAtLineStart = true; } + SetDefaultStyleToCursorStyle(); return; } } } m_caretPosition ++; + SetDefaultStyleToCursorStyle(); } /// Move caret one visual step backward: this may mean setting a flag @@ -1351,11 +1358,13 @@ void wxRichTextCtrl::MoveCaretBack(long oldPosition) // to the previous character position. m_caretPosition = oldPosition - 1; } + SetDefaultStyleToCursorStyle(); return; } } } m_caretPosition --; + SetDefaultStyleToCursorStyle(); } /// Move right @@ -1383,6 +1392,7 @@ bool wxRichTextCtrl::MoveRight(int noPositions, int flags) SetCaretPosition(newPos); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1409,6 +1419,7 @@ bool wxRichTextCtrl::MoveLeft(int noPositions, int flags) SetCaretPosition(newPos); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1497,6 +1508,7 @@ bool wxRichTextCtrl::MoveDown(int noLines, int flags) SetCaretPosition(newPos, caretLineStart); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1517,6 +1529,7 @@ bool wxRichTextCtrl::MoveToParagraphEnd(int flags) SetCaretPosition(newPos); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1537,6 +1550,7 @@ bool wxRichTextCtrl::MoveToParagraphStart(int flags) SetCaretPosition(newPos); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1559,6 +1573,7 @@ bool wxRichTextCtrl::MoveToLineEnd(int flags) SetCaretPosition(newPos); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1583,6 +1598,7 @@ bool wxRichTextCtrl::MoveToLineStart(int flags) SetCaretPosition(newPos, para->GetRange().GetStart() != lineRange.GetStart()); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1601,6 +1617,7 @@ bool wxRichTextCtrl::MoveHome(int flags) SetCaretPosition(-1); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1621,6 +1638,7 @@ bool wxRichTextCtrl::MoveEnd(int flags) SetCaretPosition(endPos); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1659,6 +1677,7 @@ bool wxRichTextCtrl::PageDown(int noPages, int flags) SetCaretPosition(pos, para->GetRange().GetStart() != lineRange.GetStart()); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1775,6 +1794,7 @@ bool wxRichTextCtrl::WordLeft(int WXUNUSED(n), int flags) SetCaretPosition(pos, para->GetRange().GetStart() != pos); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1796,6 +1816,7 @@ bool wxRichTextCtrl::WordRight(int WXUNUSED(n), int flags) SetCaretPosition(pos, para->GetRange().GetStart() != pos); PositionCaret(); + SetDefaultStyleToCursorStyle(); return true; } @@ -1969,7 +1990,7 @@ bool wxRichTextCtrl::RecreateBuffer(const wxSize& size) bool wxRichTextCtrl::DoLoadFile(const wxString& filename, int fileType) { - bool success = GetBuffer().LoadFile(filename, fileType); + bool success = GetBuffer().LoadFile(filename, (wxRichTextFileType)fileType); if (success) m_filename = filename; @@ -1993,7 +2014,7 @@ bool wxRichTextCtrl::DoLoadFile(const wxString& filename, int fileType) bool wxRichTextCtrl::DoSaveFile(const wxString& filename, int fileType) { - if (GetBuffer().SaveFile(filename, fileType)) + if (GetBuffer().SaveFile(filename, (wxRichTextFileType)fileType)) { m_filename = filename; @@ -2104,6 +2125,7 @@ bool wxRichTextCtrl::SelectWord(long position) if (positionStart >= 0) { MoveCaret(positionStart-1, true); + SetDefaultStyleToCursorStyle(); } return true; @@ -2221,7 +2243,6 @@ void wxRichTextCtrl::DoWriteText(const wxString& value, int flags) { wxString valueUnix = wxTextFile::Translate(value, wxTextFileType_Unix); - SetDefaultStyleToCursorStyle(); GetBuffer().InsertTextWithUndo(m_caretPosition+1, valueUnix, this, wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE); if ( flags & SetValue_SendEvent ) @@ -2236,7 +2257,7 @@ void wxRichTextCtrl::AppendText(const wxString& text) } /// Write an image at the current insertion point -bool wxRichTextCtrl::WriteImage(const wxImage& image, int bitmapType) +bool wxRichTextCtrl::WriteImage(const wxImage& image, wxBitmapType bitmapType) { wxRichTextImageBlock imageBlock; @@ -2247,7 +2268,7 @@ bool wxRichTextCtrl::WriteImage(const wxImage& image, int bitmapType) return false; } -bool wxRichTextCtrl::WriteImage(const wxString& filename, int bitmapType) +bool wxRichTextCtrl::WriteImage(const wxString& filename, wxBitmapType bitmapType) { wxRichTextImageBlock imageBlock; @@ -2263,7 +2284,7 @@ bool wxRichTextCtrl::WriteImage(const wxRichTextImageBlock& imageBlock) return GetBuffer().InsertImageWithUndo(m_caretPosition+1, imageBlock, this); } -bool wxRichTextCtrl::WriteImage(const wxBitmap& bitmap, int bitmapType) +bool wxRichTextCtrl::WriteImage(const wxBitmap& bitmap, wxBitmapType bitmapType) { if (bitmap.Ok()) { @@ -2321,7 +2342,6 @@ void wxRichTextCtrl::Paste() { if (CanPaste()) { - SetDefaultStyleToCursorStyle(); BeginBatchUndo(_("Paste")); long newPos = m_caretPosition;