diff --git a/src/widgets/EditPane.cpp b/src/widgets/EditPane.cpp index 584402e..01a9dc5 100644 --- a/src/widgets/EditPane.cpp +++ b/src/widgets/EditPane.cpp @@ -101,7 +101,7 @@ void EditPane::Highlight(wxString filePath) this->MarkerDefine (wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNER, "BLACK", "BLACK"); this->MarkerDefine (wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_LCORNER, "BLACK", "BLACK"); - this->SetLayoutCache (wxSTC_CACHE_CARET); + this->SetLayoutCache (wxSTC_CACHE_DOCUMENT); // set spaces and indention this->SetTabWidth(4); diff --git a/src/widgets/MainFrame.cpp b/src/widgets/MainFrame.cpp index 096ba59..83b6033 100644 --- a/src/widgets/MainFrame.cpp +++ b/src/widgets/MainFrame.cpp @@ -17,7 +17,8 @@ enum myMenuItemIds { myID_VIEW_WHITESPACE = wxID_HIGHEST, myID_VIEW_LINE_ENDINGS, myID_CLOSE_ALL, - myID_CLOSE_ALL_BUT_THIS + myID_CLOSE_ALL_BUT_THIS, + myID_LINE_WRAP }; MainFrame::MainFrame(wxFrame *frame, const wxString &title) @@ -155,6 +156,7 @@ void MainFrame::SetupMenu() editMenu->Append(wxID_SELECTALL, "Select All\tCtrl+A", "Select all the text in the current document"); viewMenu->AppendCheckItem(myID_VIEW_WHITESPACE, "Show Invisible Characters\tCtrl+Shift+I", "Toggle visibility of white space characters"); + viewMenu->AppendCheckItem(myID_LINE_WRAP, "Wrap Lines", "Toggle line wrapping"); helpMenu->Append(wxID_ABOUT, "&About...\tF1", "Show info about this application"); @@ -196,6 +198,7 @@ void MainFrame::BindEvents() Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnEditRedo, this, wxID_REDO); Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnToggleWhitespace, this, myID_VIEW_WHITESPACE); Bind(wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, &MainFrame::OnTabContextMenu, this, wxID_ANY); + Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnToggleLineWrap, this, myID_LINE_WRAP); } void MainFrame::OnNew(wxCommandEvent &WXUNUSED(event)) @@ -411,16 +414,30 @@ void MainFrame::OnToggleWhitespace(wxCommandEvent& event) editor->SetViewEOL(event.IsChecked()); } -void MainFrame::OnFind (wxCommandEvent &WXUNUSED(event)) { +void MainFrame::OnFind(wxCommandEvent &WXUNUSED(event)) +{ } -void MainFrame::OnFindNext (wxCommandEvent &WXUNUSED(event)) { +void MainFrame::OnFindNext(wxCommandEvent &WXUNUSED(event)) +{ } -void MainFrame::OnReplace (wxCommandEvent &WXUNUSED(event)) { +void MainFrame::OnReplace(wxCommandEvent &WXUNUSED(event)) +{ } -void MainFrame::OnReplaceNext (wxCommandEvent &WXUNUSED(event)) { +void MainFrame::OnReplaceNext(wxCommandEvent &WXUNUSED(event)) +{ +} + +void MainFrame::OnToggleLineWrap(wxCommandEvent &event) +{ + EditPane *editor = notebook->GetCurrentEditor(); + int flag = (event.IsChecked()) + ? wxSTC_WRAP_WORD + : wxSTC_WRAP_NONE; + + editor->SetWrapMode(flag); } /** diff --git a/src/widgets/MainFrame.h b/src/widgets/MainFrame.h index 8930a41..6594b7f 100644 --- a/src/widgets/MainFrame.h +++ b/src/widgets/MainFrame.h @@ -51,13 +51,14 @@ class MainFrame: public wxFrame void OnEditUndo(wxCommandEvent &event); void OnEditRedo(wxCommandEvent &event); - void OnFind (wxCommandEvent &event); - void OnFindNext (wxCommandEvent &event); - void OnReplace (wxCommandEvent &event); - void OnReplaceNext (wxCommandEvent &event); + void OnFind(wxCommandEvent &event); + void OnFindNext(wxCommandEvent &event); + void OnReplace(wxCommandEvent &event); + void OnReplaceNext(wxCommandEvent &event); + void OnToggleWhitespace(wxCommandEvent &event); + void OnToggleLineWrap(wxCommandEvent &event); void OnCloseTab(wxCommandEvent &event); - void OnToggleWhitespace(wxCommandEvent &event); void OnQuit(wxCommandEvent &event); void OnAbout(wxCommandEvent &event);