diff --git a/src/widgets/EditPane.cpp b/src/widgets/EditPane.cpp index 9ff26ed..59f9c04 100644 --- a/src/widgets/EditPane.cpp +++ b/src/widgets/EditPane.cpp @@ -1,9 +1,8 @@ #include "EditPane.h" EditPane::EditPane( - wxWindow *parent, wxWindowID id, const wxPoint &pos, - const wxSize &size, long style -) : wxStyledTextCtrl (parent, id, pos, size, style) + wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size +) : wxStyledTextCtrl (parent, id, pos, size, wxBORDER_NONE) { #include lang_config = new TyroConfig(); diff --git a/src/widgets/EditPane.h b/src/widgets/EditPane.h index d5102f2..1111a71 100644 --- a/src/widgets/EditPane.h +++ b/src/widgets/EditPane.h @@ -13,12 +13,7 @@ public: wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint &post = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = -#ifndef __WXMAC__ - wxSUNKEN_BORDER | -#endif - wxVSCROLL + const wxSize &size = wxDefaultSize ); ~EditPane(); wxFileName fileName; @@ -37,6 +32,7 @@ private: enum { MARGIN_FOLD, + MARGIN_SYMBOL, MARGIN_LINE_NUMBERS }; bool FileReadable(); diff --git a/src/widgets/MainFrame.cpp b/src/widgets/MainFrame.cpp index 4535b11..8e4e2cf 100644 --- a/src/widgets/MainFrame.cpp +++ b/src/widgets/MainFrame.cpp @@ -4,7 +4,7 @@ #include "MainFrame.h" // Top level menus -enum { +enum myMenuIds { myFILE_MENU, myEDIT_MENU, myVIEW_MENU, @@ -13,7 +13,7 @@ enum { }; // Menu ids -enum { +enum myMenuItemIds { myID_VIEW_WHITESPACE = wxID_HIGHEST }; @@ -188,6 +188,7 @@ void MainFrame::BindEvents() Bind(wxEVT_COMMAND_MENU_SELECTED, &MainFrame::OnEditUndo, this, wxID_UNDO); 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); } void MainFrame::OnNew(wxCommandEvent &WXUNUSED(event)) @@ -417,3 +418,12 @@ void MainFrame::EnableEditControls(bool enable) this->toolBar->EnableTool(wxID_CUT, enable); this->toolBar->EnableTool(wxID_PASTE, enable); } + +void MainFrame::OnTabContextMenu(wxAuiNotebookEvent &WXUNUSED(event)) +{ + // Create Menu + wxMenu *contextMenu = new wxMenu(); + contextMenu->Append(wxID_CLOSE, "&Close\tCtrl+W", "Close the current tab"); + + this->PopupMenu(contextMenu); +} diff --git a/src/widgets/MainFrame.h b/src/widgets/MainFrame.h index a44aca4..aea6db1 100644 --- a/src/widgets/MainFrame.h +++ b/src/widgets/MainFrame.h @@ -34,7 +34,7 @@ class MainFrame: public wxFrame void BindEvents(); void EnableEditControls(bool enable=true); - // Event handlers + // Main Menu Event handlers void OnNew(wxCommandEvent &event); void OnOpen(wxCommandEvent &event); void OnClose(wxAuiNotebookEvent &event); @@ -52,6 +52,9 @@ class MainFrame: public wxFrame void OnToggleWhitespace(wxCommandEvent &event); void OnQuit(wxCommandEvent &event); void OnAbout(wxCommandEvent &event); + + // Tab Context Menu Event handlers + void OnTabContextMenu(wxAuiNotebookEvent &event); }; diff --git a/src/widgets/TabContainer.cpp b/src/widgets/TabContainer.cpp index 40f2a13..22c37b4 100644 --- a/src/widgets/TabContainer.cpp +++ b/src/widgets/TabContainer.cpp @@ -13,7 +13,7 @@ TabContainer::TabContainer( const wxSize& size, long style ) : wxAuiNotebook(parent, id, pos, size, style) -{ +{ } TabContainer::~TabContainer() {} @@ -53,6 +53,8 @@ void TabContainer::AddTab(wxString filePath) { this->AddPage(editor, caption, true); + this->SetPageToolTip(this->GetPageIndex(this->GetCurrentPage()), fileName.GetFullPath()); + return; } diff --git a/src/widgets/TabContainer.h b/src/widgets/TabContainer.h index 55e042b..640bc39 100644 --- a/src/widgets/TabContainer.h +++ b/src/widgets/TabContainer.h @@ -12,9 +12,9 @@ #include "EditPane.h" -static long tab_style = wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS - | wxAUI_NB_WINDOWLIST_BUTTON | wxAUI_NB_CLOSE_ON_ALL_TABS - | wxAUI_NB_MIDDLE_CLICK_CLOSE | wxAUI_NB_TOP; +static long tab_style = wxBORDER_NONE | wxAUI_NB_TAB_SPLIT |wxAUI_NB_TAB_MOVE + | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_WINDOWLIST_BUTTON + | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | wxAUI_NB_MIDDLE_CLICK_CLOSE | wxAUI_NB_TOP; class TabContainer: public wxAuiNotebook {