From 8346ddd5a2a1f79aee77b597e488edc86b43a41d Mon Sep 17 00:00:00 2001 From: eranif Date: Mon, 20 Jun 2011 06:24:22 +0000 Subject: [PATCH] UI: changed the output bar pane to use notebook git-svn-id: https://codelite.svn.sourceforge.net/svnroot/codelite/trunk@4916 9da81c78-c036-0410-9e1f-a2b0375e4b5a --- Interfaces/imanager.h | 5 +- LiteEditor/app.cpp | 2 +- LiteEditor/frame.cpp | 24 +- LiteEditor/manager.cpp | 19 +- LiteEditor/output_pane.cpp | 3 +- LiteEditor/output_pane.h | 4 +- LiteEditor/outputtabwindow.cpp | 6 +- LiteEditor/pluginmanager.cpp | 2 +- LiteEditor/pluginmanager.h | 2 +- Plugin/cl_aui_notebook_art.cpp | 6 +- Plugin/dockablepanemenumanager.cpp | 31 ++- Plugin/dockablepanemenumanager.h | 4 + Plugin/output_pane_book.h | 52 ----- Plugin/outputviewcontrolbar.cpp | 349 ----------------------------- Plugin/outputviewcontrolbar.h | 73 ------ Plugin/plugin_sdk.project | 3 - Subversion2/subversion2.cpp | 30 +++ Subversion2/subversion2.h | 1 + Subversion2/svn_console.cpp | 2 +- cppchecker/cppchecker.cpp | 2 +- cscope/cscope.cpp | 2 +- 21 files changed, 98 insertions(+), 524 deletions(-) delete mode 100644 Plugin/output_pane_book.h delete mode 100644 Plugin/outputviewcontrolbar.cpp delete mode 100644 Plugin/outputviewcontrolbar.h diff --git a/Interfaces/imanager.h b/Interfaces/imanager.h index 3e2fdc36fc..8d7c3a1642 100644 --- a/Interfaces/imanager.h +++ b/Interfaces/imanager.h @@ -26,7 +26,6 @@ #ifndef IMANAGER_H #define IMANAGER_H -#include "output_pane_book.h" #include "ieditor.h" #include "iconfigtool.h" #include "ikeyboard.h" @@ -36,7 +35,7 @@ #include "queuecommand.h" #include #include "bitmap_loader.h" - +#include "notebook_ex.h" class TagsManager; class Workspace; @@ -141,7 +140,7 @@ class IManager * @return pointer to Notebook * @sa Notebook */ - virtual OutputPaneBook* GetOutputPaneNotebook() = 0; + virtual Notebook* GetOutputPaneNotebook() = 0; virtual wxPanel* GetEditorPaneNotebook() = 0; virtual void AddEditorPage(wxWindow *page, const wxString& name) = 0; diff --git a/LiteEditor/app.cpp b/LiteEditor/app.cpp index 4d7e4a9b99..046e4a5bab 100644 --- a/LiteEditor/app.cpp +++ b/LiteEditor/app.cpp @@ -66,7 +66,7 @@ // Define the version string for this codelite ////////////////////////////////////////////// extern wxChar *SvnRevision; -wxString CODELITE_VERSION_STR = wxString::Format(wxT("v2.10.0.%s"), SvnRevision); +wxString CODELITE_VERSION_STR = wxString::Format(wxT("v3.0.%s"), SvnRevision); #if defined(__WXMAC__)||defined(__WXGTK__) #include diff --git a/LiteEditor/frame.cpp b/LiteEditor/frame.cpp index 00ba1bf0e8..6f98b34eb9 100644 --- a/LiteEditor/frame.cpp +++ b/LiteEditor/frame.cpp @@ -32,7 +32,6 @@ #include "includepathlocator.h" #include "localstable.h" #include "console_frame.h" -#include "outputviewcontrolbar.h" #include "clauidockart.h" #include @@ -701,7 +700,7 @@ clMainFrame* clMainFrame::Get() void clMainFrame::CreateGUIControls(void) { - this->Freeze(); + //this->Freeze(); #ifdef __WXMSW__ SetIcon(wxICON(aaaaa)); @@ -752,12 +751,7 @@ void clMainFrame::CreateGUIControls(void) DebuggerConfigTool::Get()->Load(wxT("config/debuggers.xml"), wxT("2.9.0")); WorkspaceST::Get()->SetStartupDir(ManagerST::Get()->GetStarupDirectory()); -#if defined(__WXMAC__) m_mgr.GetArtProvider()->SetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE, 1); -#else - m_mgr.GetArtProvider()->SetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE, 1); -#endif - m_mgr.GetArtProvider()->SetMetric(wxAUI_DOCKART_SASH_SIZE, 4); // Load the menubar from XRC and set this frame's menubar to it. @@ -781,7 +775,7 @@ void clMainFrame::CreateGUIControls(void) m_outputPane = new OutputPane(m_mainPanel, wxT("Output View")); wxAuiPaneInfo paneInfo; m_mgr.AddPane(m_outputPane, - paneInfo.Name(wxT("Output View")).Caption(wxT("Output View")).Bottom().Layer(0).Position(0).CaptionVisible(false)); + paneInfo.Name(wxT("Output View")).Caption(wxT("Output View")).Bottom().Layer(0).Position(0).CaptionVisible(false).PaneBorder(false)); RegisterDockWindow(XRCID("output_pane"), wxT("Output View")); // Now it's created, hide it. Otherwise, if codelite.layout doesn't exist, it starts slightly open // That looks silly, and it's difficult for a novice user to know what's happening @@ -2046,9 +2040,9 @@ void clMainFrame::ViewPane(const wxString &paneName, wxCommandEvent &event) wxAuiPaneInfo &info = m_mgr.GetPane(paneName); if (info.IsOk()) { if ( event.IsChecked() ) { - OutputViewControlBar::HackShowPane(info,&m_mgr); + DockablePaneMenuManager::HackShowPane(info,&m_mgr); } else { - OutputViewControlBar::HackHidePane(true,info,&m_mgr); + DockablePaneMenuManager::HackHidePane(true,info,&m_mgr); } } } @@ -3047,14 +3041,14 @@ void clMainFrame::CompleteInitialization() GetSizer()->Add(line, 0, wxEXPAND); #endif - OutputViewControlBar* outputViewControlBar = new OutputViewControlBar(this, GetOutputPane()->GetNotebook(), &m_mgr, wxID_ANY); - outputViewControlBar->AddAllButtons(); + //OutputViewControlBar* outputViewControlBar = new OutputViewControlBar(this, GetOutputPane()->GetNotebook(), &m_mgr, wxID_ANY); + //outputViewControlBar->AddAllButtons(); - GetSizer()->Add(outputViewControlBar, 0, wxEXPAND); + //GetSizer()->Add(outputViewControlBar, 0, wxEXPAND); Layout(); SelectBestEnvSet(); - this->Thaw(); +// this->Thaw(); } void clMainFrame::OnAppActivated(wxActivateEvent &e) @@ -3447,7 +3441,7 @@ void clMainFrame::OnDockablePaneClosed(wxAuiManagerEvent &e) DockablePane *pane = dynamic_cast(e.GetPane()->window); wxAuiPaneInfo* pInfo = e.GetPane(); if (pInfo->IsOk()) { - OutputViewControlBar::HackHidePane(false,*pInfo,&m_mgr); + DockablePaneMenuManager::HackHidePane(false,*pInfo,&m_mgr); } if (pane) { wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, XRCID("close_pane")); diff --git a/LiteEditor/manager.cpp b/LiteEditor/manager.cpp index ed669f9149..b3f6290871 100644 --- a/LiteEditor/manager.cpp +++ b/LiteEditor/manager.cpp @@ -81,7 +81,6 @@ #include "clean_request.h" #include "buidltab.h" #include "tabgroupmanager.h" -#include "outputviewcontrolbar.h" #include "manager.h" const wxEventType wxEVT_CMD_RESTART_CODELITE = wxNewEventType(); @@ -1327,7 +1326,7 @@ void Manager::ToggleOutputPane(bool hide) clMainFrame::Get()->Freeze(); DoFindDockInfo(aui->SavePerspective(), dock_info, saved_dock_info); - OutputViewControlBar::HackHidePane(true,pane_info,aui); + DockablePaneMenuManager::HackHidePane(true,pane_info,aui); clMainFrame::Get()->Thaw(); } @@ -1340,7 +1339,7 @@ void Manager::ToggleOutputPane(bool hide) if ( saved_dock_info.IsEmpty() ) { - OutputViewControlBar::HackShowPane(pane_info,aui); + DockablePaneMenuManager::HackShowPane(pane_info,aui); } else { wxString auiPerspective = aui->SavePerspective(); @@ -1348,9 +1347,9 @@ void Manager::ToggleOutputPane(bool hide) // the dock_info does not exist auiPerspective << saved_dock_info << wxT("|"); aui->LoadPerspective(auiPerspective, false); - OutputViewControlBar::HackShowPane(pane_info,aui); + DockablePaneMenuManager::HackShowPane(pane_info,aui); } else { - OutputViewControlBar::HackShowPane(pane_info,aui); + DockablePaneMenuManager::HackShowPane(pane_info,aui); } } clMainFrame::Get()->Thaw(); @@ -1368,7 +1367,7 @@ bool Manager::ShowOutputPane ( wxString focusWin, bool commit ) // set the selection to focus win OutputPane *pane = clMainFrame::Get()->GetOutputPane(); - int index(wxNOT_FOUND); + size_t index(Notebook::npos); for(size_t i=0; iGetNotebook()->GetPageCount(); i++) { if(pane->GetNotebook()->GetPageText(i) == focusWin) { index = (int)i; @@ -1376,7 +1375,7 @@ bool Manager::ShowOutputPane ( wxString focusWin, bool commit ) } } - if ( index != wxNOT_FOUND && index != pane->GetNotebook()->GetSelection() ) { + if ( index != Notebook::npos && index != pane->GetNotebook()->GetSelection() ) { wxWindow *focus = wxWindow::FindFocus(); pane->GetNotebook()->SetSelection ( ( size_t ) index ); if (focus) { @@ -1413,7 +1412,7 @@ void Manager::ShowDebuggerPane ( bool show ) wxAuiPaneInfo &info = clMainFrame::Get()->GetDockingManager().GetPane ( dbgPanes.Item ( i ) ); // show all debugger related panes if ( info.IsOk() && !info.IsShown() ) { - OutputViewControlBar::OutputViewControlBar::HackShowPane(info,aui); + DockablePaneMenuManager::DockablePaneMenuManager::HackShowPane(info,aui); } } @@ -1424,7 +1423,7 @@ void Manager::ShowDebuggerPane ( bool show ) wxAuiPaneInfo &info = clMainFrame::Get()->GetDockingManager().GetPane ( dbgPanes.Item ( i ) ); // show all debugger related panes if ( info.IsOk() && info.IsShown() ) { - OutputViewControlBar::HackHidePane(true,info,aui); + DockablePaneMenuManager::HackHidePane(true,info,aui); } } } @@ -1455,7 +1454,7 @@ void Manager::HidePane ( const wxString &paneName, bool commit ) wxAuiPaneInfo &info = clMainFrame::Get()->GetDockingManager().GetPane ( paneName ); if ( info.IsOk() && info.IsShown() ) { wxAuiManager *aui = &clMainFrame::Get()->GetDockingManager(); - OutputViewControlBar::HackHidePane(commit,info,aui); + DockablePaneMenuManager::HackHidePane(commit,info,aui); } } diff --git a/LiteEditor/output_pane.cpp b/LiteEditor/output_pane.cpp index 367cf63cc4..5c568fd9fe 100644 --- a/LiteEditor/output_pane.cpp +++ b/LiteEditor/output_pane.cpp @@ -23,7 +23,6 @@ ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// #include -#include "output_pane_book.h" #include "frame.h" #include "editor_config.h" #include @@ -65,7 +64,7 @@ void OutputPane::CreateGUIControls() wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL); SetSizer(mainSizer); - m_book = new OutputPaneBook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_DEFAULT); + m_book = new Notebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_BOTTOM | wxNO_BORDER); BitmapLoader *bmpLoader = PluginManager::Get()->GetStdIcons(); diff --git a/LiteEditor/output_pane.h b/LiteEditor/output_pane.h index 0f8638a4c7..a3aed8ace8 100644 --- a/LiteEditor/output_pane.h +++ b/LiteEditor/output_pane.h @@ -72,7 +72,7 @@ class OutputPane : public wxPanel wxString m_caption; wxLog *m_logTargetOld; - OutputPaneBook *m_book; + Notebook *m_book; FindResultsTab *m_findResultsTab; ReplaceInFilesPanel *m_replaceResultsTab; BuildTab *m_buildWin; @@ -97,7 +97,7 @@ class OutputPane : public wxPanel */ virtual ~OutputPane(); - OutputPaneBook *GetNotebook() { return m_book; } + Notebook *GetNotebook() { return m_book; } const wxString & GetCaption () const { return m_caption; } FindResultsTab *GetFindResultsTab () { return m_findResultsTab; } diff --git a/LiteEditor/outputtabwindow.cpp b/LiteEditor/outputtabwindow.cpp index a757a9451b..13599a96b5 100644 --- a/LiteEditor/outputtabwindow.cpp +++ b/LiteEditor/outputtabwindow.cpp @@ -411,9 +411,9 @@ void OutputTabWindow::OnEdit(wxCommandEvent &e) void OutputTabWindow::OnToggleHoldOpen(wxCommandEvent &e) { - int sel; - wxChoicebook* book = clMainFrame::Get()->GetOutputPane()->GetNotebook(); - if (book && (sel=book->GetSelection()) != wxNOT_FOUND) { + size_t sel; + Notebook* book = clMainFrame::Get()->GetOutputPane()->GetNotebook(); + if (book && (sel=book->GetSelection()) != Notebook::npos) { EditorConfigST::Get()->SetPaneStickiness(book->GetPageText(sel), e.IsChecked()); } } diff --git a/LiteEditor/pluginmanager.cpp b/LiteEditor/pluginmanager.cpp index e0d79c173c..ed16c9d5c0 100644 --- a/LiteEditor/pluginmanager.cpp +++ b/LiteEditor/pluginmanager.cpp @@ -337,7 +337,7 @@ wxTreeCtrl *PluginManager::GetTree(TreeType type) } } -OutputPaneBook* PluginManager::GetOutputPaneNotebook() +Notebook* PluginManager::GetOutputPaneNotebook() { return clMainFrame::Get()->GetOutputPane()->GetNotebook(); } diff --git a/LiteEditor/pluginmanager.h b/LiteEditor/pluginmanager.h index 537877756e..a7fcc59123 100644 --- a/LiteEditor/pluginmanager.h +++ b/LiteEditor/pluginmanager.h @@ -81,7 +81,7 @@ class PluginManager : public IManager virtual IConfigTool * GetConfigTool(); virtual TreeItemInfo GetSelectedTreeItemInfo(TreeType type); virtual wxTreeCtrl * GetTree(TreeType type); - virtual OutputPaneBook* GetOutputPaneNotebook(); + virtual Notebook* GetOutputPaneNotebook(); virtual Notebook * GetWorkspacePaneNotebook(); virtual bool OpenFile(const wxString &fileName, const wxString &projectName = wxEmptyString, int lineno = wxNOT_FOUND); virtual bool OpenFile(const BrowseRecord &rec); diff --git a/Plugin/cl_aui_notebook_art.cpp b/Plugin/cl_aui_notebook_art.cpp index 082d8e26b0..c0fc455a85 100644 --- a/Plugin/cl_aui_notebook_art.cpp +++ b/Plugin/cl_aui_notebook_art.cpp @@ -222,7 +222,7 @@ void clAuiTabArt::DrawBackground(wxDC& dc, int w = rect.GetWidth(); if (m_flags &wxAUI_NB_BOTTOM) { - dc.SetBrush(wxBrush(bottom_color)); + dc.SetBrush(m_bottom_rect_colour); dc.DrawRectangle(-1, 0, w+2, 4); } // TODO: else if (m_flags &wxAUI_NB_LEFT) {} @@ -310,8 +310,8 @@ void clAuiTabArt::DrawTab(wxDC& dc, if (m_flags &wxAUI_NB_BOTTOM) { border_points[0] = wxPoint(tab_x, tab_y); border_points[1] = wxPoint(tab_x, tab_y+tab_height-6); - border_points[2] = wxPoint(tab_x+2, tab_y+tab_height-4); - border_points[3] = wxPoint(tab_x+tab_width-2, tab_y+tab_height-4); + border_points[2] = wxPoint(tab_x, tab_y+tab_height-4); + border_points[3] = wxPoint(tab_x+tab_width, tab_y+tab_height-4); border_points[4] = wxPoint(tab_x+tab_width, tab_y+tab_height-6); border_points[5] = wxPoint(tab_x+tab_width, tab_y); diff --git a/Plugin/dockablepanemenumanager.cpp b/Plugin/dockablepanemenumanager.cpp index 54d5cfdad4..c784b183c3 100644 --- a/Plugin/dockablepanemenumanager.cpp +++ b/Plugin/dockablepanemenumanager.cpp @@ -27,10 +27,35 @@ #include #include #include -#include "outputviewcontrolbar.h" #include "dockablepanemenumanager.h" #include +void DockablePaneMenuManager::HackShowPane(wxAuiPaneInfo &pane_info, wxAuiManager *pAui) +{ + if ( pane_info.IsOk() && pAui ) { + pane_info.MinSize(pane_info.best_size); // saved while hiding + pane_info.Show(); + pAui->Update(); + pane_info.MinSize(10,5); // so it can't disappear if undocked + pAui->Update(); + } +} + +void DockablePaneMenuManager::HackHidePane(bool commit, wxAuiPaneInfo &pane_info, wxAuiManager *pAui) +{ + if ( pane_info.IsOk() && pAui ) { + int width = 0; + int height = 0; + pane_info.window->GetClientSize(&width, &height); + pane_info.BestSize(width,height); // save for later subsequent show + pane_info.Hide(); + + if ( commit ) { + pAui->Update(); + } + } +} + DockablePaneMenuManager::DockablePaneMenuManager(wxMenuBar* mb, wxAuiManager *aui) : m_mb(mb) , m_aui(aui) @@ -81,9 +106,9 @@ void DockablePaneMenuManager::OnDockpaneMenuItem(wxCommandEvent& e) wxAuiPaneInfo &info = m_aui->GetPane(name); if ( info.IsOk() ) { if ( e.IsChecked() ) { - OutputViewControlBar::HackShowPane(info, m_aui); + HackShowPane(info, m_aui); } else { - OutputViewControlBar::HackHidePane(true, info, m_aui); + HackHidePane(true, info, m_aui); } } } diff --git a/Plugin/dockablepanemenumanager.h b/Plugin/dockablepanemenumanager.h index f116562f7f..075dff881b 100644 --- a/Plugin/dockablepanemenumanager.h +++ b/Plugin/dockablepanemenumanager.h @@ -53,5 +53,9 @@ class WXDLLIMPEXP_SDK DockablePaneMenuManager : public wxEvtHandler { wxString NameById(int id); wxArrayString GetDeatchedPanesList(); bool IsPaneDetached(const wxString &name); + + static void HackShowPane(wxAuiPaneInfo &pane_info, wxAuiManager *pAui); + static void HackHidePane(bool commit, wxAuiPaneInfo &pane_info, wxAuiManager *pAui); }; + #endif // __dockablepanemenumanager__ diff --git a/Plugin/output_pane_book.h b/Plugin/output_pane_book.h deleted file mode 100644 index 143cf19cfa..0000000000 --- a/Plugin/output_pane_book.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef OutputPaneBook_H -#define OutputPaneBook_H - -#include -#include -#include -#include -#include -#include "codelite_exports.h" - -class WXDLLIMPEXP_SDK OutputPaneBook : public wxChoicebook -{ - std::vector m_bmps; -protected: - wxImageList* GetImageList() const { return wxChoicebook::GetImageList(); } -public: - OutputPaneBook(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxEmptyString) - : wxChoicebook(parent, id, pos, size, style, name) - { - // Hide the tabs - GetControlSizer()->Hide((size_t)0); - SetInternalBorder(0); - GetControlSizer()->Layout(); - - AssignImageList( new wxImageList(16, 16, true) ); - Layout(); - } - - virtual ~OutputPaneBook() {} - - void AddPage(wxWindow *page, const wxString &text, bool select, const wxBitmap &bmp) { - // First add the page to the notebook - int imgId = GetImageList()->Add(bmp); - wxChoicebook::AddPage(page, text, select, imgId); - - // Keep a copy of the bitmap - m_bmps.push_back( bmp ); - } - - const wxBitmap& GetBitmap(size_t indx) const { - if (indx >= m_bmps.size()) - return wxNullBitmap; - return m_bmps.at(indx); - } -}; - -#endif // OutputPaneBook_H diff --git a/Plugin/outputviewcontrolbar.cpp b/Plugin/outputviewcontrolbar.cpp deleted file mode 100644 index 8b57e16d43..0000000000 --- a/Plugin/outputviewcontrolbar.cpp +++ /dev/null @@ -1,349 +0,0 @@ -#include "outputviewcontrolbar.h" -#include "cl_aui_tb_are.h" -#include "globals.h" -#include -#include -#include -#include -#include -#include "editor_config.h" -#include -#include "plugin.h" -#include -#include -#include -#include -#include -#include "drawingutils.h" -#include -#include -#include -#include -#include -#include - -OutputViewControlBar::OutputViewControlBar(wxWindow* win, OutputPaneBook *book, wxAuiManager *aui, wxWindowID id) - : wxPanel (win, id, wxDefaultPosition, wxSize(-1, -1)) - , m_aui (aui) - , m_book (book) - , m_buttons (NULL) - , m_buildInProgress(false) -{ - wxBoxSizer *mainSizer = new wxBoxSizer(wxHORIZONTAL); - SetSizer( mainSizer ); - -#if !OP_USE_AUI_TOOLBAR -#ifdef __WXMSW__ - m_buttons = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_FLAT); -#else - m_buttons = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_FLAT|wxTB_HORZ_LAYOUT|wxTB_TEXT); -#endif -#else - m_buttons = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_HORZ_TEXT); - m_buttons->SetArtProvider(new CLMainAuiTBArt()); -#endif - - if ( m_book ) { - m_book->Connect(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, wxChoicebookEventHandler(OutputViewControlBar::OnPageChanged), NULL, this); - } - m_buttons->Connect(wxID_ANY, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(OutputViewControlBar::OnButtonClicked), NULL, this); - if ( m_aui ) { - m_aui->Connect(wxEVT_AUI_RENDER, wxAuiManagerEventHandler(OutputViewControlBar::OnRender), NULL, this); - } - wxTheApp->Connect ( wxEVT_EDITOR_CLICKED , wxCommandEventHandler ( OutputViewControlBar::OnEditorFocus ), NULL, this ); - wxTheApp->Connect ( wxEVT_BUILD_STARTED , wxCommandEventHandler ( OutputViewControlBar::OnBuildStarted ), NULL, this ); - wxTheApp->Connect ( wxEVT_BUILD_ENDED , wxCommandEventHandler ( OutputViewControlBar::OnBuildEnded ), NULL, this ); - mainSizer->Add(m_buttons, 1, wxEXPAND|wxTOP, 2); - mainSizer->Layout(); -} - -OutputViewControlBar::~OutputViewControlBar() -{ - wxTheApp->Disconnect ( wxEVT_EDITOR_CLICKED , wxCommandEventHandler ( OutputViewControlBar::OnEditorFocus ), NULL, this ); - wxTheApp->Disconnect ( wxEVT_BUILD_STARTED , wxCommandEventHandler ( OutputViewControlBar::OnBuildStarted ), NULL, this ); - wxTheApp->Disconnect ( wxEVT_BUILD_ENDED , wxCommandEventHandler ( OutputViewControlBar::OnBuildEnded ), NULL, this ); -} - -void OutputViewControlBar::AddButton(const wxString& text, const wxBitmap& bmp, bool selected) -{ -#if !OP_USE_AUI_TOOLBAR - m_tools.push_back( m_buttons->AddTool(wxID_ANY, text, bmp, text, wxITEM_CHECK) ); -#else - m_buttons->AddTool(wxXmlResource::GetXRCID(text.c_str()), text, bmp, text, wxITEM_CHECK); -#endif -} - -void OutputViewControlBar::OnButtonClicked(wxCommandEvent& event) -{ - event.Skip(); - wxString label; -#if !OP_USE_AUI_TOOLBAR - wxToolBarToolBase *item = m_buttons->FindById(event.GetId()); - if(item) { - label = item->GetLabel(); - } - - if(label.IsEmpty()) - return; - - wxWindowUpdateLocker locker( wxTheApp->GetTopWindow() ); - DoMarkActive( label ); - if(event.IsChecked()) - DoTogglePane(false); - else - DoTogglePane(true); - - bool checked = event.IsChecked(); -#else - - wxAuiToolBarItem *item = m_buttons->FindTool(event.GetId()); - if(item) { - label = item->GetLabel(); - } - - if(label.IsEmpty()) - return; - - wxWindowUpdateLocker locker( wxTheApp->GetTopWindow() ); - DoMarkActive( label ); - - bool checked = m_buttons->GetToolToggled(event.GetId()); - if(checked) - DoTogglePane(false); - else - DoTogglePane(true); -#endif - - // Uncheck all the buttons except for the selected one - DoSetButtonState(checked ? event.GetId() : wxNOT_FOUND); -} - -void OutputViewControlBar::DoTogglePane(bool hide) -{ - static wxString saved_dock_info; - if ( m_book && m_aui ) { - wxAuiPaneInfo &pane_info = m_aui->GetPane(wxT("Output View")); - wxString dock_info ( wxString::Format(wxT("dock_size(%d,%d,%d)"), pane_info.dock_direction, pane_info.dock_layer, pane_info.dock_row) ); - if ( hide ) { - if ( pane_info.IsShown() ) { - wxTheApp->GetTopWindow()->Freeze(); - - DoFindDockInfo(m_aui->SavePerspective(), dock_info, saved_dock_info); - HackHidePane(true, pane_info, m_aui); - wxTheApp->GetTopWindow()->Thaw(); - } - - - } else { - // Show it - if ( pane_info.IsShown() == false ) { - wxTheApp->GetTopWindow()->Freeze(); - if ( saved_dock_info.IsEmpty() ) { - HackShowPane(pane_info, m_aui); - - } else { - wxString auiPerspective = m_aui->SavePerspective(); - if ( auiPerspective.Find(dock_info) == wxNOT_FOUND ) { - // the dock_info does not exist - auiPerspective << saved_dock_info << wxT("|"); - m_aui->LoadPerspective(auiPerspective, false); - HackShowPane(pane_info, m_aui); - - } else { - HackShowPane(pane_info, m_aui); - - } - } - wxTheApp->GetTopWindow()->Thaw(); - } - } - } - -#if wxVERSION_NUMBER >= 2900 - // This is needed in >=wxGTK-2.9, otherwise output pane doesn't fully expand, or on closing the auinotebook doesn't occupy its space - wxTheApp->GetTopWindow()->SendSizeEvent(wxSEND_EVENT_POST); -#endif -} - -void OutputViewControlBar::OnRender(wxAuiManagerEvent& event) -{ - if ( m_aui && m_aui->GetPane(wxT("Output View")).IsShown() == false ) { - DoMarkActive( wxEmptyString ); - DoSetButtonState(wxNOT_FOUND); - - } else if ( m_aui ) { - DoMarkActive ( m_book->GetPageText( m_book->GetSelection() ) ); - DoSetButtonState( m_book->GetPageText( m_book->GetSelection() ) ); - } - - event.Skip(); -} - -void OutputViewControlBar::DoMarkActive(const wxString& name) -{ - if ( m_book && name.IsEmpty() == false ) { - for (size_t i=0; iGetPageCount(); i++) { - if ( m_book->GetPageText(i) == name ) { - m_book->SetSelection(i); - break; - } - } - } -} - -void OutputViewControlBar::AddAllButtons() -{ - - if ( m_book ) { - for (size_t i=0; iGetPageCount(); i++) { - - wxString text = m_book->GetPageText(i); - wxBitmap bmp = m_book->GetBitmap(i); - - AddButton(text, bmp, (size_t)m_book->GetSelection() == i); - } - m_buttons->Realize(); - } - -} - -void OutputViewControlBar::OnPageChanged(wxChoicebookEvent& event) -{ - int cursel = m_book->GetSelection(); - if ( cursel != wxNOT_FOUND ) { - wxString selectedPageText = m_book->GetPageText(cursel); - DoMarkActive( selectedPageText ); - - DoSetButtonState( selectedPageText ); - } - - event.Skip(); -} - -bool OutputViewControlBar::DoFindDockInfo(const wxString &saved_perspective, const wxString &dock_name, wxString &dock_info) -{ - // search for the 'Output View' perspective - wxArrayString panes = wxStringTokenize(saved_perspective, wxT("|"), wxTOKEN_STRTOK); - for (size_t i=0; iGetOptions()->GetHideOutpuPaneOnUserClick()) { - - // Optionally don't hide the various panes (sometimes it's irritating, you click to do something and...) - int cursel(m_book->GetSelection()); - if (cursel != wxNOT_FOUND - && EditorConfigST::Get()->GetPaneStickiness(m_book->GetPageText(cursel))) { - return; - } - - // avoid auto-hiding when build is in progress - if (m_buildInProgress) - return; - - // and hide the output view - DoTogglePane(true); - } -} - -void OutputViewControlBar::DoSetButtonState(int btnId) -{ -#if !OP_USE_AUI_TOOLBAR - for(size_t i=0; iGetId() == btnId) { - m_buttons->ToggleTool(m_tools.at(i)->GetId(), true); - - } else { - m_buttons->ToggleTool(m_tools.at(i)->GetId(), false); - - } - } -#else - - for(size_t i=0; iGetToolCount(); i++) { - wxAuiToolBarItem *item = m_buttons->FindToolByIndex(i); - if(item && item->GetId() != wxNOT_FOUND) { - m_buttons->ToggleTool(item->GetId(), false); - } - } - if(btnId != wxNOT_FOUND) - m_buttons->ToggleTool(btnId, true); - - m_buttons->Refresh(); -#endif -} - -void OutputViewControlBar::DoSetButtonState(const wxString& label) -{ -#if !OP_USE_AUI_TOOLBAR - for(size_t i=0; iGetLabel() == label) { - DoSetButtonState( m_tools.at(i)->GetId() ); - return; - - } - } -#else - for(size_t i=0; iGetToolCount(); i++) { - wxAuiToolBarItem *item = m_buttons->FindToolByIndex(i); - if(item && item->GetLabel() == label) { - DoSetButtonState( item->GetId() ); - return; - } - } -#endif - DoSetButtonState(wxNOT_FOUND); -} - -void OutputViewControlBar::OnBuildEnded(wxCommandEvent& event) -{ - m_buildInProgress = false; - event.Skip(); -} - -void OutputViewControlBar::OnBuildStarted(wxCommandEvent& event) -{ - m_buildInProgress = true; - event.Skip(); -} - -// Overcome wxAui (wxWidgets v2.8) issue. When hiding a pane, its -// dimensions can get "lost" when it is subsequently shown. So, -// explicitly resize the pane during a Show() to its last known -// window width and height. -void OutputViewControlBar::HackHidePane(bool commit, wxAuiPaneInfo &pane_info, wxAuiManager *pAui) -{ - if ( pane_info.IsOk() && pAui ) { - int width = 0; - int height = 0; - pane_info.window->GetClientSize(&width, &height); - pane_info.BestSize(width,height); // save for later subsequent show - pane_info.Hide(); - - if ( commit ) { - pAui->Update(); - } - } -} - -void OutputViewControlBar::HackShowPane(wxAuiPaneInfo &pane_info, wxAuiManager *pAui) -{ - if ( pane_info.IsOk() && pAui ) { - pane_info.MinSize(pane_info.best_size); // saved while hiding - pane_info.Show(); - pAui->Update(); - pane_info.MinSize(10,5); // so it can't disappear if undocked - pAui->Update(); - } -} - - diff --git a/Plugin/outputviewcontrolbar.h b/Plugin/outputviewcontrolbar.h deleted file mode 100644 index 7a30c70388..0000000000 --- a/Plugin/outputviewcontrolbar.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef __auicontrolbar__ -#define __auicontrolbar__ - -#include -#include -#include -#include -#include -#include -#include "cl_defs.h" -#include "codelite_exports.h" -#if USE_AUI_TOOLBAR -#include -#include -#endif - -#include -#include -#include "output_pane_book.h" - -#if defined(__WXMAC__) -# define OP_USE_AUI_TOOLBAR 1 -#else -# define OP_USE_AUI_TOOLBAR 0 -#endif - -//-------------------------------------------------------- -class WXDLLIMPEXP_SDK OutputViewControlBar : public wxPanel -{ - wxAuiManager * m_aui; - OutputPaneBook* m_book; - -#if !OP_USE_AUI_TOOLBAR - wxToolBar* m_buttons; -#else - wxAuiToolBar* m_buttons; -#endif - - std::vector m_tools; - bool m_buildInProgress; - -protected: - void DoSetButtonState(int btnId); - void DoSetButtonState(const wxString &label); - -public: - OutputViewControlBar(wxWindow *win, OutputPaneBook *book, wxAuiManager *aui, wxWindowID id); - - virtual ~OutputViewControlBar(); - - void AddButton (const wxString &text, const wxBitmap & bmp, bool selected); - void AddAllButtons (); - - void OnButtonClicked (wxCommandEvent &event); - void OnPageChanged (wxChoicebookEvent &event); - void OnRender (wxAuiManagerEvent &event); - void OnEditorFocus (wxCommandEvent &event); - void OnBuildStarted (wxCommandEvent &event); - void OnBuildEnded (wxCommandEvent &event); - -protected: - void DoTogglePane (bool hide = true); - wxWindow * DoFindButton (const wxString &name); - void DoMarkActive (const wxString &name); - bool DoFindDockInfo (const wxString &saved_perspective, const wxString &dock_name, wxString &dock_info); - -public: - static void HackHidePane (bool commit, wxAuiPaneInfo &pane_info, wxAuiManager *pAui); - static void HackShowPane (wxAuiPaneInfo &pane_info, wxAuiManager *pAui); -}; - -#endif // __auicontrolbar__ - diff --git a/Plugin/plugin_sdk.project b/Plugin/plugin_sdk.project index 2a3c80d457..464f7fb99f 100644 --- a/Plugin/plugin_sdk.project +++ b/Plugin/plugin_sdk.project @@ -149,8 +149,6 @@ - - @@ -201,7 +199,6 @@ - diff --git a/Subversion2/subversion2.cpp b/Subversion2/subversion2.cpp index 3683f16606..57e0142d2e 100644 --- a/Subversion2/subversion2.cpp +++ b/Subversion2/subversion2.cpp @@ -104,6 +104,7 @@ Subversion2::Subversion2(IManager *manager) GetManager()->GetTheApp()->Connect(wxEVT_GET_ADDITIONAL_COMPILEFLAGS, wxCommandEventHandler(Subversion2::OnGetCompileLine), NULL, this); GetManager()->GetTheApp()->Connect(wxEVT_WORKSPACE_CONFIG_CHANGED, wxCommandEventHandler(Subversion2::OnWorkspaceConfigChanged), NULL, this); + GetManager()->GetTheApp()->Connect(wxEVT_PROJ_FILE_REMOVED, wxCommandEventHandler(Subversion2::OnFileRemoved), NULL, this); } Subversion2::~Subversion2() @@ -893,3 +894,32 @@ void Subversion2::OnWorkspaceConfigChanged(wxCommandEvent& event) event.Skip(); m_subversionView->BuildTree(); } + +void Subversion2::OnFileRemoved(wxCommandEvent& event) +{ + event.Skip(); + wxArrayString *files = (wxArrayString*)event.GetClientData(); + if(files && !files->IsEmpty()) { + + if(wxMessageBox(wxT("Would you like to delete the file(s) from the svn as well?"), + wxT("Subversion"), + wxYES_NO|wxCANCEL|wxCENTER, + GetManager()->GetTheApp()->GetTopWindow()) == wxYES) + { + wxString fileList; + for(size_t i=0; iGetCount(); i++) { + wxFileName fn(files->Item(i)); + fileList << wxT("\"") << fn.GetFullPath() << wxT("\" "); + } + + wxString command; + RecreateLocalSvnConfigFile(); + + command << GetSvnExeName(false) << wxT(" delete --force ") << fileList; + GetConsole()->Execute(command, + m_subversionView->GetRootDir(), + new SvnDefaultCommandHandler(this, event.GetId(), + this)); + } + } +} diff --git a/Subversion2/subversion2.h b/Subversion2/subversion2.h index 78a62d0a0d..108c206565 100644 --- a/Subversion2/subversion2.h +++ b/Subversion2/subversion2.h @@ -81,6 +81,7 @@ class Subversion2 : public IPlugin /////////////////////////////////////////////////////////// void OnGetCompileLine (wxCommandEvent &event); void OnWorkspaceConfigChanged(wxCommandEvent &event); + void OnFileRemoved (wxCommandEvent &event); wxMenu* CreateFileExplorerPopMenu(); bool IsSubversionViewDetached (); diff --git a/Subversion2/svn_console.cpp b/Subversion2/svn_console.cpp index 2e997d519a..4dfe2419c8 100644 --- a/Subversion2/svn_console.cpp +++ b/Subversion2/svn_console.cpp @@ -161,7 +161,7 @@ void SvnConsole::EnsureVisible() } // Select the Subversion tab - wxBookCtrlBase *book = m_plugin->GetManager()->GetOutputPaneNotebook(); + Notebook *book = m_plugin->GetManager()->GetOutputPaneNotebook(); for(size_t i=0; iGetPageCount(); i++) { if(book->GetPage(i) == m_plugin->GetConsole()) { diff --git a/cppchecker/cppchecker.cpp b/cppchecker/cppchecker.cpp index 4633c3ce8a..df3f4e75b7 100644 --- a/cppchecker/cppchecker.cpp +++ b/cppchecker/cppchecker.cpp @@ -355,7 +355,7 @@ void CppCheckPlugin::SetTabVisible(bool clearContent) } // Set the focus to the CppCheck tab - wxBookCtrlBase *book = m_mgr->GetOutputPaneNotebook(); + Notebook *book = m_mgr->GetOutputPaneNotebook(); if (book->GetPageText((size_t)book->GetSelection()) != wxT("CppCheck")) { for (size_t i=0; iGetPageCount(); i++) { if (book->GetPageText(i) == wxT("CppCheck")) { diff --git a/cscope/cscope.cpp b/cscope/cscope.cpp index 661251a9b1..a5bbf9393c 100644 --- a/cscope/cscope.cpp +++ b/cscope/cscope.cpp @@ -324,7 +324,7 @@ void Cscope::DoCscopeCommand(const wxString &command, const wxString &findWhat, } //set the focus to the cscope tab - wxBookCtrlBase *book = m_mgr->GetOutputPaneNotebook(); + Notebook *book = m_mgr->GetOutputPaneNotebook(); //make sure that the Output pane is visible wxAuiManager *aui = m_mgr->GetDockingManager();