diff --git a/src/widgets/MainFrame.cpp b/src/widgets/MainFrame.cpp index f9c8b53..027c464 100644 --- a/src/widgets/MainFrame.cpp +++ b/src/widgets/MainFrame.cpp @@ -25,7 +25,7 @@ MainFrame::MainFrame(wxFrame *frame, const wxString& title) base_sizer->Add(notebook, 1, wxEXPAND | wxALL, 5); base_sizer->SetContainingWindow(this); - base_sizer->SetMinSize(800,600); + base_sizer->SetMinSize(600,400); SetSizerAndFit(base_sizer); @@ -128,7 +128,10 @@ void MainFrame::BindEvents() Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnNew, this, wxID_NEW); Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnAbout, this, wxID_ABOUT); Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnQuit, this, wxID_EXIT); - Bind(wxEVT_COMMAND_MENU_SELECTED, &TabContainer::OnEditSelectAll, notebook, wxID_SELECTALL); + Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnEditCut, this, wxID_CUT); + Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnEditCopy, this, wxID_COPY); + Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnEditPaste, this, wxID_PASTE); + Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnEditSelectAll, this, wxID_SELECTALL); } void MainFrame::OnClose(wxCloseEvent &WXUNUSED(event)) @@ -146,6 +149,26 @@ void MainFrame::OnQuit(wxCommandEvent &WXUNUSED(event)) Destroy(); } +void MainFrame::OnEditCut(wxCommandEvent &WXUNUSED(event)) +{ + notebook->GetCurrentEditor()->Cut(); +} + +void MainFrame::OnEditCopy(wxCommandEvent &WXUNUSED(event)) +{ + notebook->GetCurrentEditor()->Copy(); +} + +void MainFrame::OnEditPaste(wxCommandEvent &WXUNUSED(event)) +{ + notebook->GetCurrentEditor()->Paste(); +} + +void MainFrame::OnEditSelectAll(wxCommandEvent &WXUNUSED(event)) +{ + notebook->GetCurrentEditor()->SelectAll(); +} + void MainFrame::OnAbout(wxCommandEvent &WXUNUSED(event)) { wxMessageBox(_T("Tyro, a text editor for all development\n Copyright 2015, Timothy J. Warren"), wxT("About Tyro"), wxOK| wxICON_INFORMATION, this); diff --git a/src/widgets/MainFrame.h b/src/widgets/MainFrame.h index df5ef60..0edacde 100644 --- a/src/widgets/MainFrame.h +++ b/src/widgets/MainFrame.h @@ -27,6 +27,10 @@ class MainFrame: public wxFrame void SetupStatusBar(); void BindEvents(); void OnNew(wxCommandEvent &event); + void OnEditCut(wxCommandEvent &event); + void OnEditCopy(wxCommandEvent &event); + void OnEditPaste(wxCommandEvent &event); + void OnEditSelectAll(wxCommandEvent &event); void OnClose(wxCloseEvent &event); void OnQuit(wxCommandEvent &event); void OnAbout(wxCommandEvent &event); diff --git a/src/widgets/TabContainer.cpp b/src/widgets/TabContainer.cpp index 2a523d9..e71dc9d 100644 --- a/src/widgets/TabContainer.cpp +++ b/src/widgets/TabContainer.cpp @@ -39,9 +39,7 @@ void TabContainer::AddTab(wxString filePath) this->AddPage(editor, caption); } -void TabContainer::OnEditSelectAll(wxCommandEvent &WXUNUSED(event)) +EditPane *TabContainer::GetCurrentEditor() { - cout << "Edit select all event called."; - //EditPane *editor = (EditPane *) this->GetCurrentPage(); - //editor->SelectAll(); + return (EditPane *) this->GetCurrentPage(); } diff --git a/src/widgets/TabContainer.h b/src/widgets/TabContainer.h index b1d1c7e..3e1c153 100644 --- a/src/widgets/TabContainer.h +++ b/src/widgets/TabContainer.h @@ -28,7 +28,7 @@ public: void AddTab(); void AddTab(wxString filePath); void OnEditSelectAll(wxCommandEvent &event); - + EditPane *GetCurrentEditor(); private: };