Patch #2902 2010-01-06 16:28
alatar_
Improvement in TabSwitcher- Download
- 2902-Improvement_in.patch (22.0 KB)
Index: src/include/editormanager.h
===================================================================
--- src/include/editormanager.h (revision 6187)
+++ src/include/editormanager.h (working copy)
@@ -44,6 +44,20 @@
// forward decl
struct cbFindReplaceData;
+ /*
+ * Struct for store tabs stack info
+ */
+struct cbNotebookStack
+{
+ cbNotebookStack(wxWindow* a_pWindow = NULL)
+ : window (a_pWindow),
+ next (NULL)
+ {}
+
+ wxWindow* window;
+ cbNotebookStack* next;
+};
+
/*
* No description
*/
@@ -59,6 +73,10 @@
virtual void operator=(const EditorManager& rhs){ cbThrow(_T("Can't assign an EditorManager* !!!")); }
cbAuiNotebook* GetNotebook() { return m_pNotebook; }
+ cbNotebookStack* GetNotebookStack();
+ void DeleteNotebookStack();
+ void RebuildNotebookStack();
+
void CreateMenu(wxMenuBar* menuBar);
void ReleaseMenu(wxMenuBar* menuBar);
void Configure();
@@ -174,6 +192,9 @@
wxFileName FindHeaderSource(const wxArrayString& candidateFilesArray, const wxFileName& activeFile, bool& isCandidate);
cbAuiNotebook* m_pNotebook;
+ cbNotebookStack* m_pNotebookStackHead;
+ cbNotebookStack* m_pNotebookStackTail;
+ size_t m_nNotebookStackSize;
cbFindReplaceData* m_LastFindReplaceData;
EditorColourSet* m_Theme;
ListCtrlLogger* m_pSearchLog;
Index: src/sdk/editormanager.cpp
===================================================================
--- src/sdk/editormanager.cpp (revision 6187)
+++ src/sdk/editormanager.cpp (working copy)
@@ -156,6 +156,9 @@
EditorManager::EditorManager()
: m_pNotebook(0L),
+ m_pNotebookStackHead(new cbNotebookStack),
+ m_pNotebookStackTail(m_pNotebookStackHead),
+ m_nNotebookStackSize(0),
m_LastFindReplaceData(0L),
m_pSearchLog(0),
m_SearchLogIndex(-1),
@@ -187,12 +190,88 @@
CodeBlocksLogEvent evt(cbEVT_REMOVE_LOG_WINDOW, m_pSearchLog);
Manager::Get()->ProcessEvent(evt);
+ DeleteNotebookStack();
+ delete m_pNotebookStackHead;
delete m_Theme;
delete m_LastFindReplaceData;
delete m_pData;
Manager::Get()->GetConfigManager(_T("editor"))->Write(_T("/zoom"), m_Zoom);
}
+cbNotebookStack* EditorManager::GetNotebookStack()
+{
+ bool founded = false;
+ wxWindow* wnd;
+ cbNotebookStack* body;
+ cbNotebookStack* prev_body;
+
+ while(m_nNotebookStackSize != m_pNotebook->GetPageCount()) //Sync stack with Notebook
+ {
+ if(m_nNotebookStackSize < m_pNotebook->GetPageCount())
+ {
+ for(size_t i = 0; i<m_pNotebook->GetPageCount(); ++i)
+ {
+ wnd = m_pNotebook->GetPage(i);
+ founded = false;
+ for (body = m_pNotebookStackHead->next; body != NULL; body = body->next)
+ {
+ if(wnd == body->window)
+ {
+ founded = true;
+ break;
+ }
+ }
+ if(!founded)
+ {
+ m_pNotebookStackTail->next = new cbNotebookStack(wnd);
+ m_pNotebookStackTail = m_pNotebookStackTail->next;
+ ++m_nNotebookStackSize;
+ }
+ }
+ }
+ if(m_nNotebookStackSize > m_pNotebook->GetPageCount())
+ {
+ for (prev_body = m_pNotebookStackHead, body = prev_body->next; body != NULL; prev_body = body, body = body->next)
+ {
+ if(m_pNotebook->GetPageIndex(body->window) == wxNOT_FOUND)
+ {
+ prev_body->next = body->next;
+ delete body;
+ --m_nNotebookStackSize;
+ body = prev_body;
+ }
+ }
+ }
+ }
+
+ return m_pNotebookStackHead->next;
+}
+
+void EditorManager::DeleteNotebookStack()
+{
+ cbNotebookStack* tmp;
+ while(m_pNotebookStackHead->next)
+ {
+ tmp = m_pNotebookStackHead->next;
+ m_pNotebookStackHead->next = tmp->next;
+ delete tmp;
+ }
+ m_pNotebookStackTail = m_pNotebookStackHead;
+ m_nNotebookStackSize = 0;
+}
+
+void EditorManager::RebuildNotebookStack()
+{
+ DeleteNotebookStack();
+ for(size_t i = 0; i < m_pNotebook->GetPageCount(); ++i)
+ {
+ m_pNotebookStackTail->next = new cbNotebookStack(m_pNotebook->GetPage(i));
+ m_pNotebookStackTail = m_pNotebookStackTail->next;
+ ++m_nNotebookStackSize;
+ }
+}
+
+
void EditorManager::CreateMenu(wxMenuBar* menuBar)
{
}
@@ -2504,6 +2583,36 @@
CodeBlocksEvent evt(cbEVT_EDITOR_ACTIVATED, -1, 0, eb);
Manager::Get()->GetPluginManager()->NotifyPlugins(evt);
+ if (Manager::Get()->GetConfigManager(_T("app"))->ReadBool(_T("/environment/stacked
download for full patch...
History
Looks good to me so far (testing since publication in the forums) - I am taking it.
I post this patch in forum 3 months ago (http://forums.codeblocks.org/index.php/topic,11252.0.html) and for me it`s work all this time without any problems in everyday CodeBlocks usage.
I post this patch in forum 3 months ago (http://forums.codeblocks.org/index.php/topic,11252.0.html) and for me it`s work all this time without any problems in everyday CodeBlocks usage.
Version with Feneck91`s changes (settings fo enabling/disabling the stack and workaround choosing item with mouse) and some improvements. Fix potential bug (stack wasn`t deleted).
Version with Feneck91`s changes (settings fo enabling/disabling the stack and workaround choosing item with mouse) and some improvements. Fix potential bug (stack wasn`t deleted).
Ups.... Bugfix
Regenerated for r6187
Add some features that don`t directly related to stack-based tab switching (tab descriptions, selected item font colour fix)