Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move LiveCaret to separate source file.

  • Loading branch information...
commit ea4c3984cf61a226e48efa489096ef60ad65bccb 1 parent 4bc371a
@adamv adamv authored
View
6 src/EditorCtrl.cpp
@@ -39,7 +39,7 @@
#include "Fold.h"
#include "TextTip.h"
#include "RemoteThread.h"
-
+#include "LiveCaret.h"
#include "eSettings.h"
#include "IAppPaths.h"
@@ -6942,6 +6942,10 @@ void EditorCtrl::MakeSelectionVisible(unsigned int sel_id) {
// NOTE: Will first be visible on next redraw
}
+void EditorCtrl::KeepCaretAlive(bool keepAlive) {
+ caret->KeepAlive(keepAlive);
+}
+
wxString EditorCtrl::GetSelFirstLine() {
// returns the first line of the selection (if there is *one* selection)
if (!m_lines.IsSelected()) return wxT("");
View
28 src/EditorCtrl.h
@@ -20,7 +20,6 @@
#endif
#include <wx/dnd.h>
-#include <wx/caret.h>
#include "Catalyst.h"
#include "Lines.h"
@@ -52,6 +51,7 @@ class cxRemoteAction;
class MultilineDataObject;
class TextTip;
class eFrameSettings;
+class LiveCaret;
struct thTheme;
class tmAction;
@@ -251,7 +251,7 @@ class EditorCtrl : public KeyHookable<wxControl>,
bool MakeCaretVisible();
void MakeCaretVisibleCenter();
void MakeSelectionVisible(unsigned int sel_id = 0);
- void KeepCaretAlive(bool keepAlive=true) {caret->KeepAlive(keepAlive);};
+ void KeepCaretAlive(bool keepAlive=true);
// Syntax Highlighting
const wxString& GetSyntaxName() const {return m_syntaxstyler.GetName();};
@@ -378,8 +378,9 @@ class EditorCtrl : public KeyHookable<wxControl>,
// Classes
class RepParseState {
public:
- RepParseState(const wxString& reptext, const map<unsigned int,interval>& caps, const vector<char>* source=NULL)
- : replacetext(reptext), captures(caps), source(source), upcase(false), lowcase(false), caseChar(false), caseText(false) {
+ RepParseState(const wxString& reptext, const map<unsigned int,interval>& caps, const vector<char>* source=NULL):
+ replacetext(reptext), captures(caps), source(source), upcase(false), lowcase(false), caseChar(false), caseText(false)
+ {
newtext.reserve(replacetext.size());
};
// member variables
@@ -408,25 +409,6 @@ class EditorCtrl : public KeyHookable<wxControl>,
wxDataObjectComposite* m_dataObject;
};
- class LiveCaret : public wxCaret {
- public:
- LiveCaret(wxWindow *window, int width, int height)
- : wxCaret(window, width, height), m_keepAlive(false) {};
- void KeepAlive(bool keepAlive) {m_keepAlive = keepAlive;};
-
- virtual void OnKillFocus() {
-#ifdef __WXDEBUG__
- // WORKAROUND: avoid assert in wxCaret::DoMove()
- wxCaret::OnKillFocus();
-#else
- if (!m_keepAlive) wxCaret::OnKillFocus();
-#endif // __WXDEBUG__
- };
-
- private:
- bool m_keepAlive;
- };
-
// Event handlers
void OnPaint(wxPaintEvent& event);
void OnChar(wxKeyEvent& event);
View
26 src/LiveCaret.h
@@ -0,0 +1,26 @@
+#ifndef __LIVECARET_H__
+#define __LIVECARET_H__
+
+#include <wx/caret.h>
+
+class LiveCaret : public wxCaret {
+public:
+ LiveCaret(wxWindow *window, int width, int height):
+ wxCaret(window, width, height), m_keepAlive(false) {};
+
+ void KeepAlive(bool keepAlive) {m_keepAlive = keepAlive;};
+
+ virtual void OnKillFocus() {
+#ifdef __WXDEBUG__
+ // WORKAROUND: avoid assert in wxCaret::DoMove()
+ wxCaret::OnKillFocus();
+#else
+ if (!m_keepAlive) wxCaret::OnKillFocus();
+#endif // __WXDEBUG__
+ };
+
+private:
+ bool m_keepAlive;
+};
+
+#endif
View
4 src/e.vcproj
@@ -461,6 +461,10 @@
>
</File>
<File
+ RelativePath=".\LiveCaret.h"
+ >
+ </File>
+ <File
RelativePath="SearchListBox.cpp"
>
</File>

0 comments on commit ea4c398

Please sign in to comment.
Something went wrong with that request. Please try again.