Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Speeding up "Close all"
rickg22:
I just noticed that regarding editor windows (tabs), "Close others" command works much faster than "close all", because "close all" changes the active tab and the screen is refreshed, carrying along a lot of UI overhead with it.
I was wondering if it was possible to implement "close all" by first "closing others" and then closing the current window.
DrewBoo:
That's an interesting observation. I've observed this same UI overhead.
It certainly sounds like you would get the desired result in all cases.
Furthermore, Code::Blocks already has the code to implement this, although it looks like it was implemented as a workaround to handling popup menus potentially existing for the open file.
Here's the current sdk/editorbase.cpp, starting at line 339
--- Code: --- else if (id == idCloseAll)
{
if (m_pData->m_DisplayingPopupMenu)
{
Manager::Get()->GetEditorManager()->CloseAllExcept(this);
m_pData->m_CloseMe = true; // defer delete 'this' until after PopupMenu() call returns
}
else
Manager::Get()->GetEditorManager()->CloseAll();
}
--- End code ---
I imagine that the change you describe would change the code to this:
--- Code: --- else if (id == idCloseAll)
{
Manager::Get()->GetEditorManager()->CloseAllExcept(this);
if (m_pData->m_DisplayingPopupMenu)
m_pData->m_CloseMe = true; // defer delete 'this' until after PopupMenu() call returns
else
Manager::Get()->GetEditorManager()->Close(this);
}
--- End code ---
As best I can tell, that change alone would give us the speedup you describe.
rickg22:
That looks interesting, but what about changing EditorManager::CloseAll directly, too? Would it be possible?
thomas:
I don't perceive the overhead very noticeable or even a problem, but sure... why not.
DrewBoo:
--- Quote from: thomas on August 25, 2008, 09:03:51 pm ---I don't perceive the overhead very noticeable or even a problem, but sure... why not.
--- End quote ---
In one of my environments -- a 3GHz machine -- C::B can close about 4 to 6 windows each second. That's a guess. And you can see that the time is spent drawing.
It's not a huge problem, but when you have 100 files open, it looks a little silly to see C::B labor for many seconds to show you each and every file that you just said you're no longer interested in seeing. :)
Navigation
[0] Message Index
[#] Next page
Go to full version