Expect to see more patch submissions from me in the future (:
PS, I'm not terribly familiar with git (I'm a svn guy) so I'm not sure how to get the current "revision number" if such a thing exists. my copy of CL from git is up to date as of this post.
Code: Select all
diff --git a/LiteEditor/frame.cpp b/LiteEditor/frame.cpp
index 502d1fd..9f23008 100644
--- a/LiteEditor/frame.cpp
+++ b/LiteEditor/frame.cpp
@@ -340,6 +340,8 @@ BEGIN_EVENT_TABLE(clMainFrame, wxFrame)
EVT_UPDATE_UI(wxID_FIND, clMainFrame::OnIncrementalSearchUI )
EVT_UPDATE_UI(wxID_REPLACE, clMainFrame::OnFileExistUpdateUI )
+ EVT_UPDATE_UI(XRCID("select_previous"), clMainFrame::OnFileExistUpdateUI )
+ EVT_UPDATE_UI(XRCID("select_next"), clMainFrame::OnFileExistUpdateUI )
EVT_UPDATE_UI(XRCID("find_next"), clMainFrame::OnFileExistUpdateUI )
EVT_UPDATE_UI(XRCID("find_previous"), clMainFrame::OnFileExistUpdateUI )
EVT_UPDATE_UI(XRCID("find_next_at_caret"), clMainFrame::OnFileExistUpdateUI )
diff --git a/LiteEditor/quickfindbar.cpp b/LiteEditor/quickfindbar.cpp
index fd7309a..f32534e 100644
--- a/LiteEditor/quickfindbar.cpp
+++ b/LiteEditor/quickfindbar.cpp
@@ -79,6 +79,8 @@ QuickFindBar::QuickFindBar(wxWindow* parent, wxWindowID id)
wxTheApp->Connect(wxID_COPY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(QuickFindBar::OnEditUI), NULL, this);
wxTheApp->Connect(wxID_PASTE, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(QuickFindBar::OnEditUI), NULL, this);
wxTheApp->Connect(wxID_SELECTALL, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(QuickFindBar::OnEditUI), NULL, this);
+ wxTheApp->Connect(XRCID("select_previous"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(QuickFindBar::OnSelectPrevious), NULL, this);
+ wxTheApp->Connect(XRCID("select_next"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(QuickFindBar::OnSelectNext), NULL, this);
wxTheApp->Connect(XRCID("find_next"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(QuickFindBar::OnFindNext), NULL, this);
wxTheApp->Connect(XRCID("find_previous"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(QuickFindBar::OnFindPrevious), NULL, this);
wxTheApp->Connect(XRCID("find_next_at_caret"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(QuickFindBar::OnFindNextCaret), NULL, this);
@@ -536,6 +538,34 @@ void QuickFindBar::OnFindPrevious(wxCommandEvent& e)
DoSearch(false, false);
}
+void QuickFindBar::OnSelectPrevious(wxCommandEvent& e)
+{
+ CHECK_FOCUS_WIN();
+
+ // Highlighted text takes precedence over the current search string
+ wxString selectedText = DoGetSelectedText();
+ if (selectedText.IsEmpty() == false) {
+ m_findWhat->ChangeValue(selectedText);
+ m_findWhat->SelectAll();
+ }
+
+ DoSearch(false, false, true);
+}
+
+void QuickFindBar::OnSelectNext(wxCommandEvent& e)
+{
+ CHECK_FOCUS_WIN();
+
+ // Highlighted text takes precedence over the current search string
+ wxString selectedText = DoGetSelectedText();
+ if (selectedText.IsEmpty() == false) {
+ m_findWhat->ChangeValue( selectedText );
+ m_findWhat->SelectAll();
+ }
+
+ DoSearch(true, false, true);
+}
+
void QuickFindBar::OnFindNextCaret(wxCommandEvent& e)
{
CHECK_FOCUS_WIN();
@@ -718,6 +748,8 @@ QuickFindBar::~QuickFindBar()
wxTheApp->Disconnect(wxID_COPY, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(QuickFindBar::OnEditUI), NULL, this);
wxTheApp->Disconnect(wxID_PASTE, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(QuickFindBar::OnEditUI), NULL, this);
wxTheApp->Disconnect(wxID_SELECTALL, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(QuickFindBar::OnEditUI), NULL, this);
+ wxTheApp->Disconnect(XRCID("select_previous"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(QuickFindBar::OnSelectPrevious), NULL, this);
+ wxTheApp->Disconnect(XRCID("select_next"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(QuickFindBar::OnSelectNext), NULL, this);
wxTheApp->Disconnect(XRCID("find_next"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(QuickFindBar::OnFindNext), NULL, this);
wxTheApp->Disconnect(XRCID("find_previous"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(QuickFindBar::OnFindPrevious), NULL, this);
wxTheApp->Disconnect(XRCID("find_next_at_caret"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(QuickFindBar::OnFindNextCaret), NULL, this);
diff --git a/LiteEditor/quickfindbar.h b/LiteEditor/quickfindbar.h
index a8da969..e8bc48e 100644
--- a/LiteEditor/quickfindbar.h
+++ b/LiteEditor/quickfindbar.h
@@ -76,6 +76,8 @@ protected:
void OnReceivingFocus(wxFocusEvent& event);
void OnReleaseEditor(wxCommandEvent &e);
+ void OnSelectPrevious (wxCommandEvent &e);
+ void OnSelectNext (wxCommandEvent &e);
void OnFindNext (wxCommandEvent &e);
void OnFindPrevious (wxCommandEvent &e);
void OnFindNextCaret (wxCommandEvent &e);
diff --git a/Runtime/rc/menu.xrc b/Runtime/rc/menu.xrc
index a672b63..b125ac4 100644
--- a/Runtime/rc/menu.xrc
+++ b/Runtime/rc/menu.xrc
@@ -292,6 +292,12 @@
<object class="wxMenuItem" name="wxID_REPLACE">
<label>&Replace...</label>
</object>
+ <object class="wxMenuItem" name="select_previous">
+ <label>Select Previous Occu&rrence</label>
+ </object>
+ <object class="wxMenuItem" name="select_next">
+ <label>Select Next &Occurrence</label>
+ </object>
<object class="wxMenuItem" name="find_next">
<label>Find &Next</label>
</object>
Code: Select all
select_previous|Search|Select Next|Ctrl+Shift+UP
select_next|Search|Select Next|Ctrl+Shift+DOWN