Add line wrapping option

This commit is contained in:
Tim Warren 2015-04-29 14:36:34 -04:00
parent 5950f7d95d
commit f4f47b081a
3 changed files with 29 additions and 11 deletions

View File

@ -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);

View File

@ -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);
}
/**

View File

@ -55,9 +55,10 @@ class MainFrame: public wxFrame
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);