Skip to content

Commit

Permalink
UI: changed the output bar pane to use notebook
Browse files Browse the repository at this point in the history
git-svn-id: https://codelite.svn.sourceforge.net/svnroot/codelite/trunk@4916 9da81c78-c036-0410-9e1f-a2b0375e4b5a
  • Loading branch information
eranif committed Jun 20, 2011
1 parent 951ec88 commit 8346ddd
Show file tree
Hide file tree
Showing 21 changed files with 98 additions and 524 deletions.
5 changes: 2 additions & 3 deletions Interfaces/imanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#ifndef IMANAGER_H
#define IMANAGER_H

#include "output_pane_book.h"
#include "ieditor.h"
#include "iconfigtool.h"
#include "ikeyboard.h"
Expand All @@ -36,7 +35,7 @@
#include "queuecommand.h"
#include <wx/aui/framemanager.h>
#include "bitmap_loader.h"

#include "notebook_ex.h"

class TagsManager;
class Workspace;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion LiteEditor/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <sys/wait.h>
Expand Down
24 changes: 9 additions & 15 deletions LiteEditor/frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "includepathlocator.h"
#include "localstable.h"
#include "console_frame.h"
#include "outputviewcontrolbar.h"
#include "clauidockart.h"

#include <set>
Expand Down Expand Up @@ -701,7 +700,7 @@ clMainFrame* clMainFrame::Get()

void clMainFrame::CreateGUIControls(void)
{
this->Freeze();
//this->Freeze();

#ifdef __WXMSW__
SetIcon(wxICON(aaaaa));
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -3447,7 +3441,7 @@ void clMainFrame::OnDockablePaneClosed(wxAuiManagerEvent &e)
DockablePane *pane = dynamic_cast<DockablePane*>(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"));
Expand Down
19 changes: 9 additions & 10 deletions LiteEditor/manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
}
Expand All @@ -1340,17 +1339,17 @@ 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();
if ( auiPerspective.Find(dock_info) == wxNOT_FOUND ) {
// 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();
Expand All @@ -1368,15 +1367,15 @@ 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; i<pane->GetNotebook()->GetPageCount(); i++) {
if(pane->GetNotebook()->GetPageText(i) == focusWin) {
index = (int)i;
break;
}
}

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) {
Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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);
}
}
}
Expand Down Expand Up @@ -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);
}
}

Expand Down
3 changes: 1 addition & 2 deletions LiteEditor/output_pane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#include <wx/xrc/xmlres.h>
#include "output_pane_book.h"
#include "frame.h"
#include "editor_config.h"
#include <wx/dcbuffer.h>
Expand Down Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions LiteEditor/output_pane.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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; }
Expand Down
6 changes: 3 additions & 3 deletions LiteEditor/outputtabwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down
2 changes: 1 addition & 1 deletion LiteEditor/pluginmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ wxTreeCtrl *PluginManager::GetTree(TreeType type)
}
}

OutputPaneBook* PluginManager::GetOutputPaneNotebook()
Notebook* PluginManager::GetOutputPaneNotebook()
{
return clMainFrame::Get()->GetOutputPane()->GetNotebook();
}
Expand Down
2 changes: 1 addition & 1 deletion LiteEditor/pluginmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions Plugin/cl_aui_notebook_art.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down Expand Up @@ -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);

Expand Down
31 changes: 28 additions & 3 deletions Plugin/dockablepanemenumanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,35 @@
#include <wx/aui/aui.h>
#include <wx/app.h>
#include <wx/xrc/xmlres.h>
#include "outputviewcontrolbar.h"
#include "dockablepanemenumanager.h"
#include <wx/log.h>

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)
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions Plugin/dockablepanemenumanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__
52 changes: 0 additions & 52 deletions Plugin/output_pane_book.h

This file was deleted.

Loading

0 comments on commit 8346ddd

Please sign in to comment.