2626
2727#include " clWorkspaceView.h"
2828#include " cl_config.h"
29- #include " cl_editor.h"
3029#include " codelite_events.h"
31- #include " dockablepanemenumanager.h"
3230#include " editor_config.h"
3331#include " event_notifier.h"
3432#include " fileexplorer.h"
35- #include " fileview.h"
36- #include " frame.h"
33+ #include " SecondarySideBar.hpp"
3734#include " globals.h"
3835#include " openwindowspanel.h"
3936#include " pluginmanager.h"
4037#include " tabgroupspane.h"
4138#include " workspacetab.h"
4239
4340#include < wx/app.h>
44- #include < wx/bitmap.h>
4541#include < wx/gauge.h>
4642#include < wx/menu.h>
4743#include < wx/sizer.h>
6157
6258namespace
6359{
64- const wxString WORKSPACE_LABEL = _(" Workspace" );
65- const wxString EXPLORER_LABEL = _(" Explorer" );
66- const wxString TABS_LABEL = _(" Tabs" );
67- const wxString GROUPS_LABEL = _(" Groups" );
60+ wxString WorkspaceLabel () { return _ (" Workspace" ); }
61+ wxString ExplorerLabel () { return _ (" Explorer" ); }
62+ wxString TabsLabel () { return _ (" Tabs" ); }
63+ wxString GroupsLabel () { return _ (" Groups" ); }
6864} // namespace
6965
7066SideBar::SideBar (wxWindow* parent, const wxString& caption, wxAuiManager* mgr, long style)
@@ -109,7 +105,7 @@ void SideBar::CreateGUIControls()
109105 // Calculate the widest tab (the one with the 'Workspace' label)
110106 int xx, yy;
111107 wxFont fnt = wxSystemSettings::GetFont (wxSYS_DEFAULT_GUI_FONT);
112- wxWindow::GetTextExtent (WORKSPACE_LABEL , &xx, &yy, NULL , NULL , &fnt);
108+ wxWindow::GetTextExtent (WorkspaceLabel () , &xx, &yy, NULL , NULL , &fnt);
113109
114110 mainSizer->Add (m_book, 1 , wxEXPAND | wxALL, 0 );
115111
@@ -126,37 +122,37 @@ void SideBar::CreateGUIControls()
126122 // the IManager instance
127123 IManager* mgr = PluginManager::Get ();
128124
129- m_workspaceTab = new WorkspaceTab (m_book, WORKSPACE_LABEL );
130- m_book->AddPage (m_workspaceTab, WORKSPACE_LABEL , " workspace-button" , true );
125+ m_workspaceTab = new WorkspaceTab (m_book, WorkspaceLabel () );
126+ m_book->AddPage (m_workspaceTab, WorkspaceLabel () , " workspace-button" , true );
131127
132- m_tabs.insert ( std::make_pair (WORKSPACE_LABEL , Tab (WORKSPACE_LABEL , m_workspaceTab) ));
133- mgr->AddWorkspaceTab (WORKSPACE_LABEL );
128+ m_tabs.emplace ( WorkspaceLabel () , Tab (WorkspaceLabel () , m_workspaceTab));
129+ mgr->AddWorkspaceTab (WorkspaceLabel () );
134130
135131 // Add the explorer tab
136- m_explorer = new FileExplorer (m_book, EXPLORER_LABEL );
137- m_book->AddPage (m_explorer, EXPLORER_LABEL , " file-explorer-button" , false );
132+ m_explorer = new FileExplorer (m_book, ExplorerLabel () );
133+ m_book->AddPage (m_explorer, ExplorerLabel () , " file-explorer-button" , false );
138134
139- m_tabs.insert ( std::make_pair (EXPLORER_LABEL , Tab (EXPLORER_LABEL , m_explorer) ));
140- mgr->AddWorkspaceTab (EXPLORER_LABEL );
135+ m_tabs.emplace ( ExplorerLabel () , Tab (ExplorerLabel () , m_explorer));
136+ mgr->AddWorkspaceTab (ExplorerLabel () );
141137
142138 // Add the "File Explorer" view to the list of files managed by the workspace-view
143- m_workspaceTab->GetView ()->AddPage (m_explorer, EXPLORER_LABEL , false );
139+ m_workspaceTab->GetView ()->AddPage (m_explorer, ExplorerLabel () , false );
144140
145141 // Add the Open Windows Panel (Tabs)
146142 // #ifndef __WXOSX__
147- m_openWindowsPane = new OpenWindowsPanel (m_book, TABS_LABEL );
148- m_book->AddPage (m_openWindowsPane, TABS_LABEL , " tabs-button" );
143+ m_openWindowsPane = new OpenWindowsPanel (m_book, TabsLabel () );
144+ m_book->AddPage (m_openWindowsPane, TabsLabel () , " tabs-button" );
149145
150- m_tabs.insert ( std::make_pair (TABS_LABEL , Tab (TABS_LABEL , m_openWindowsPane) ));
151- mgr->AddWorkspaceTab (TABS_LABEL );
146+ m_tabs.emplace ( TabsLabel () , Tab (TabsLabel () , m_openWindowsPane));
147+ mgr->AddWorkspaceTab (TabsLabel () );
152148 // #endif
153149
154150 // Add the Tabgroups tab
155- m_TabgroupsPane = new TabgroupsPane (m_book, GROUPS_LABEL );
156- m_book->AddPage (m_TabgroupsPane, GROUPS_LABEL , " groups-button" );
151+ m_TabgroupsPane = new TabgroupsPane (m_book, GroupsLabel () );
152+ m_book->AddPage (m_TabgroupsPane, GroupsLabel () , " groups-button" );
157153
158- m_tabs.insert ( std::make_pair (GROUPS_LABEL , Tab (GROUPS_LABEL , m_TabgroupsPane) ));
159- mgr->AddWorkspaceTab (GROUPS_LABEL );
154+ m_tabs.emplace ( GroupsLabel () , Tab (GroupsLabel () , m_TabgroupsPane));
155+ mgr->AddWorkspaceTab (GroupsLabel () );
160156
161157 if (m_book->GetPageCount () > 0 ) {
162158 m_book->SetSelection ((size_t )0 );
@@ -169,7 +165,7 @@ void SideBar::CreateGUIControls()
169165 wxTheApp->GetTopWindow ()->GetEventHandler ()->AddPendingEvent (event_chat);
170166 });
171167
172- m_book->AddActionButton (" chat-bot" , " Open AI Chat Window" , action_ptr);
168+ m_book->AddActionButton (" chat-bot" , _ ( " Open AI Chat Window" ) , action_ptr);
173169 m_mgr->Update ();
174170}
175171
@@ -224,44 +220,29 @@ void SideBar::SaveWorkspaceViewTabOrder() const
224220 clConfig::Get ().SetWorkspaceTabOrder (panes, m_book->GetSelection ());
225221}
226222
227- wxWindow* SideBar::DoGetControlByName (const wxString& title)
228- {
229- if (title == EXPLORER_LABEL)
230- return m_explorer;
231- else if (title == WORKSPACE_LABEL)
232- return m_workspaceTab;
233- #ifndef __WXOSX__
234- else if (title == TABS_LABEL)
235- return m_openWindowsPane;
236- #endif
237- else if (title == GROUPS_LABEL)
238- return m_TabgroupsPane;
239- return NULL ;
240- }
241-
242223bool SideBar::IsTabVisible (int flag)
243224{
244225 wxWindow* win (NULL );
245226 wxString title;
246227
247228 switch (flag) {
248229 case View_Show_Workspace_Tab:
249- title = WORKSPACE_LABEL ;
250- win = DoGetControlByName (WORKSPACE_LABEL) ;
230+ title = WorkspaceLabel () ;
231+ win = m_workspaceTab ;
251232 break ;
252233 case View_Show_Explorer_Tab:
253- title = EXPLORER_LABEL ;
254- win = DoGetControlByName (EXPLORER_LABEL) ;
234+ title = ExplorerLabel () ;
235+ win = m_explorer ;
255236 break ;
256237#ifndef __WXOSX__
257238 case View_Show_Tabs_Tab:
258- title = TABS_LABEL ;
259- win = DoGetControlByName (TABS_LABEL) ;
239+ title = TabsLabel () ;
240+ win = m_openWindowsPane ;
260241 break ;
261242#endif
262243 case View_Show_Tabgroups_Tab:
263- title = GROUPS_LABEL ;
264- win = DoGetControlByName (GROUPS_LABEL) ;
244+ title = GroupsLabel () ;
245+ win = m_TabgroupsPane ;
265246 break ;
266247 }
267248
0 commit comments